aboutsummaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-24 05:57:15 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2007-11-24 05:57:15 +0000
commitb1ffed4b75b42b7e86899b4e8859f3b543418394 (patch)
treeed75215a72de21fab9011089132de99791db7014 /shared
parent380823b3bcbf0f5112308d1975f51e06e836b212 (diff)
- made selection color change restore previous background color
- moved scrollbar handling to tkwidgets.c svn path=/trunk/externals/tkwidgets/; revision=9032
Diffstat (limited to 'shared')
-rw-r--r--shared/tkwidgets.c26
-rw-r--r--shared/tkwidgets.h20
2 files changed, 26 insertions, 20 deletions
diff --git a/shared/tkwidgets.c b/shared/tkwidgets.c
index d58f643..a5d1b8c 100644
--- a/shared/tkwidgets.c
+++ b/shared/tkwidgets.c
@@ -24,14 +24,6 @@
#include <stdio.h>
#include <string.h>
-/* this should be part of the Pd API */
-t_symbol *canvas_getname(t_canvas *canvas)
-{
- char buf[MAXPDSTRING];
- snprintf(buf, MAXPDSTRING, ".x%lx", (unsigned long)glist_getcanvas(canvas));
- return gensym(buf);
-}
-
/* -------------------- options handling ------------------------------------ */
void tkwidgets_query_options(t_symbol *receive_name, t_symbol *widget_id,
@@ -207,6 +199,24 @@ void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag)
sys_vgui("%s delete %s\n", canvas_id->s_name, iolets_tag->s_name);
}
+/* -------------------- scrollbars ------------------------------------------ */
+
+void tkwidgets_draw_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id)
+{
+ sys_vgui("scrollbar %s -orient vertical -command {%s yview}\n",
+ scrollbar_id->s_name, widget_id->s_name);
+ sys_vgui("pack %s -side right -fill y -before %s \n",
+ scrollbar_id->s_name, widget_id->s_name);
+ sys_vgui("%s configure -yscrollcommand {%s set}\n",
+ widget_id->s_name, scrollbar_id->s_name);
+}
+
+void tkwidgets_erase_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id)
+{
+ sys_vgui("%s configure -yscrollcommand {}\n", widget_id->s_name);
+ sys_vgui("pack forget %s \n", scrollbar_id->s_name);
+ sys_vgui("destroy %s \n", scrollbar_id->s_name);
+}
/* -------------------- bind to keys and mouse events ----------------------- */
diff --git a/shared/tkwidgets.h b/shared/tkwidgets.h
index 0bc3996..e234ccd 100644
--- a/shared/tkwidgets.h
+++ b/shared/tkwidgets.h
@@ -37,6 +37,8 @@
#define TOTAL_INLETS 1
#define TOTAL_OUTLETS 2
+#define TKW_SELECTION_COLOR "#bdbddd"
+
/* size and offset for the resizing handle */
#define TKW_HANDLE_HEIGHT 15
#define TKW_HANDLE_WIDTH 15
@@ -60,18 +62,6 @@ typedef struct _tkwidgets
int selected; /* flag for when widget is selected */
} t_tkwidgets;
-/* query a tk widget for the state of all its options */
-void tkwidgets_query_options(t_symbol* receive_name, t_symbol *widget_id,
- int argc, char** argv);
-/* initialize things on new widget */
-void tkwidgets_new(t_tkwidgets* tkw);
-
-
-/* this should be part of the Pd API */
-t_symbol* canvas_getname(t_canvas *canvas);
-
-void tkwidgets_setcallbackname(void *x, char *widget_name);
-
/* handle options */
void tkwidgets_store_options(t_symbol *receive_name, t_symbol *tcl_namespace,
t_symbol *widget_id, int argc, char **argv);
@@ -98,10 +88,16 @@ void tkwidgets_draw_iolets(t_object *x, t_glist *glist, t_symbol *canvas_id,
t_symbol *iolets_tag, t_symbol *all_tag,
int width, int height);
void tkwidgets_erase_iolets(t_symbol* canvas_id, t_symbol* iolets_tag);
+void tkwidgets_draw_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id);
+void tkwidgets_erase_y_scrollbar(t_symbol *widget_id, t_symbol *scrollbar_id);
void tkwidgets_draw_handle(); // TODO draw resize handle when selected in editmode
void tkwidgets_draw_resize_window(); // TODO draw the resize window while resizing
+/* selection */
+
+
+
/* bind this widget to Cmd/Ctrl keys and mouse events to support things like
* then standard keys and right-click to bring up the Properties/Open/Help
* menu when the Tk widgets have focus */