# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1322341214 0 # Node ID 0512fbb08abfa3ba467ba1da86e50543e259b753 # Parent 8fe15c1648c9cf1d07036e9740e8a5a9852f1621 Added dw_window_set_tooltip() for adding bubble help to most controls. Mac, Windows and GTK should be supported... OS/2 coming soon. diff -r 8fe15c1648c9 -r 0512fbb08abf dw.h --- a/dw.h Sat Nov 26 20:20:41 2011 +0000 +++ b/dw.h Sat Nov 26 21:00:14 2011 +0000 @@ -1536,6 +1536,7 @@ void API dw_window_set_bitmap_from_data(HWND handle, unsigned long id, char *data, int len); char * API dw_window_get_text(HWND handle); void API dw_window_set_text(HWND handle, char *text); +void API dw_window_set_tooltip(HWND handle, char *bubbletext); int API dw_window_set_border(HWND handle, int border); void API dw_window_disable(HWND handle); void API dw_window_enable(HWND handle); diff -r 8fe15c1648c9 -r 0512fbb08abf gtk/dw.c --- a/gtk/dw.c Sat Nov 26 20:20:41 2011 +0000 +++ b/gtk/dw.c Sat Nov 26 21:00:14 2011 +0000 @@ -4393,7 +4393,7 @@ { tooltips = gtk_tooltips_new(); gtk_tooltips_set_tip(tooltips, tmp, text, NULL); - gtk_object_set_data(GTK_OBJECT(tmp), "tooltip", (gpointer)tooltips); + gtk_object_set_data(GTK_OBJECT(tmp), "_dw_tooltip", (gpointer)tooltips); } gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); DW_MUTEX_UNLOCK; @@ -4454,7 +4454,7 @@ { tooltips = gtk_tooltips_new(); gtk_tooltips_set_tip( tooltips, button, text, NULL ); - gtk_object_set_data( GTK_OBJECT(button), "tooltip", (gpointer)tooltips ); + gtk_object_set_data( GTK_OBJECT(button), "_dw_tooltip", (gpointer)tooltips ); } gtk_object_set_data( GTK_OBJECT(button), "_dw_id", GINT_TO_POINTER(id) ); DW_MUTEX_UNLOCK; @@ -4491,7 +4491,7 @@ { tooltips = gtk_tooltips_new(); gtk_tooltips_set_tip(tooltips, tmp, text, NULL); - gtk_object_set_data(GTK_OBJECT(tmp), "tooltip", (gpointer)tooltips); + gtk_object_set_data(GTK_OBJECT(tmp), "_dw_tooltip", (gpointer)tooltips); } gtk_object_set_data(GTK_OBJECT(tmp), "_dw_id", GINT_TO_POINTER(id)); DW_MUTEX_UNLOCK; @@ -4924,6 +4924,24 @@ } /* + * Sets the text used for a given window's floating bubble help. + * Parameters: + * handle: Handle to the window (widget). + * bubbletext: The text in the floating bubble tooltip. + */ +void API dw_window_set_tooltip(HWND handle, char *bubbletext) +{ + int _locked_by_me = FALSE; + GtkTooltips *tooltips; + + DW_MUTEX_LOCK; + tooltips = gtk_tooltips_new(); + gtk_tooltips_set_tip(tooltips, handle, bubbletext ? bubbletext : "", NULL); + gtk_object_set_data(GTK_OBJECT(tmp), "_dw_tooltip", (gpointer)tooltips); + DW_MUTEX_UNLOCK; +} + +/* * Gets the text used for a given window. * Parameters: * handle: Handle to the window. diff -r 8fe15c1648c9 -r 0512fbb08abf gtk3/dw.c --- a/gtk3/dw.c Sat Nov 26 20:20:41 2011 +0000 +++ b/gtk3/dw.c Sat Nov 26 21:00:14 2011 +0000 @@ -4335,6 +4335,21 @@ } /* + * Sets the text used for a given window's floating bubble help. + * Parameters: + * handle: Handle to the window (widget). + * bubbletext: The text in the floating bubble tooltip. + */ +void API dw_window_set_tooltip(HWND handle, char *bubbletext) +{ + int _locked_by_me = FALSE; + + DW_MUTEX_LOCK; + gtk_widget_set_tooltip_text(tmp, bubbletext); + DW_MUTEX_UNLOCK; +} + +/* * Gets the text used for a given window. * Parameters: * handle: Handle to the window. diff -r 8fe15c1648c9 -r 0512fbb08abf mac/dw.m --- a/mac/dw.m Sat Nov 26 20:20:41 2011 +0000 +++ b/mac/dw.m Sat Nov 26 21:00:14 2011 +0000 @@ -8161,6 +8161,18 @@ } /* + * Sets the text used for a given window's floating bubble help. + * Parameters: + * handle: Handle to the window (widget). + * bubbletext: The text in the floating bubble tooltip. + */ +void API dw_window_set_tooltip(HWND handle, char *bubbletext) +{ + id object = handle; + [object setToolTip:[NSString stringWithUTF8String:bubbletext]]; +} + +/* * Disables given window (widget). * Parameters: * handle: Handle to the window. diff -r 8fe15c1648c9 -r 0512fbb08abf os2/dw.c --- a/os2/dw.c Sat Nov 26 20:20:41 2011 +0000 +++ b/os2/dw.c Sat Nov 26 21:00:14 2011 +0000 @@ -6317,6 +6317,19 @@ } /* + * Sets the text used for a given window's floating bubble help. + * Parameters: + * handle: Handle to the window (widget). + * bubbletext: The text in the floating bubble tooltip. + */ +void API dw_window_set_tooltip(HWND handle, char *bubbletext) +{ + /* TODO: Fill this in with generic bubble help code... + * like we do for the bitmap buttons. + */ +} + +/* * Gets the text used for a given window. * Parameters: * handle: Handle to the window. diff -r 8fe15c1648c9 -r 0512fbb08abf os2/dw.def --- a/os2/dw.def Sat Nov 26 20:20:41 2011 +0000 +++ b/os2/dw.def Sat Nov 26 21:00:14 2011 +0000 @@ -67,6 +67,7 @@ dw_bitmap_new @80 dw_window_set_bitmap_from_data @81 dw_window_get_font @82 + dw_window_set_tooltip @83 dw_button_new @90 dw_bitmapbutton_new @91 diff -r 8fe15c1648c9 -r 0512fbb08abf readme --- a/readme Sat Nov 26 20:20:41 2011 +0000 +++ b/readme Sat Nov 26 21:00:14 2011 +0000 @@ -36,6 +36,8 @@ Now you can use dw_window_destroy() on menu items handles also. Added dw_app_dir() which attempts to locate private application data for the current platform. +Added dw_window_set_tooltip() for adding tooltips to most widgets. + All platforms supported except OS/2 which will be coming soon. Fixed bubble help not being displayed on Windows. Fixed menu bar items remaining highlighted on Mac. diff -r 8fe15c1648c9 -r 0512fbb08abf template/dw.c --- a/template/dw.c Sat Nov 26 20:20:41 2011 +0000 +++ b/template/dw.c Sat Nov 26 21:00:14 2011 +0000 @@ -2807,6 +2807,16 @@ } /* + * Sets the text used for a given window's floating bubble help. + * Parameters: + * handle: Handle to the window (widget). + * bubbletext: The text in the floating bubble tooltip. + */ +void API dw_window_set_tooltip(HWND handle, char *bubbletext) +{ +} + +/* * Disables given window (widget). * Parameters: * handle: Handle to the window. diff -r 8fe15c1648c9 -r 0512fbb08abf win/dw-mingw.def --- a/win/dw-mingw.def Sat Nov 26 20:20:41 2011 +0000 +++ b/win/dw-mingw.def Sat Nov 26 21:00:14 2011 +0000 @@ -64,6 +64,7 @@ dw_bitmap_new @80 dw_window_set_bitmap_from_data @81 dw_window_get_font @82 + dw_window_set_tooltip @83 dw_button_new @90 dw_bitmapbutton_new @91 diff -r 8fe15c1648c9 -r 0512fbb08abf win/dw.c --- a/win/dw.c Sat Nov 26 20:20:41 2011 +0000 +++ b/win/dw.c Sat Nov 26 21:00:14 2011 +0000 @@ -6190,6 +6190,17 @@ } /* + * Sets the text used for a given window's floating bubble help. + * Parameters: + * handle: Handle to the window (widget). + * bubbletext: The text in the floating bubble tooltip. + */ +void API dw_window_set_tooltip(HWND handle, char *bubbletext) +{ + _create_tooltip(handle, bubbletext); +} + +/* * Gets the text used for a given window. * Parameters: * handle: Handle to the window. diff -r 8fe15c1648c9 -r 0512fbb08abf win/dw.def --- a/win/dw.def Sat Nov 26 20:20:41 2011 +0000 +++ b/win/dw.def Sat Nov 26 21:00:14 2011 +0000 @@ -64,6 +64,7 @@ dw_bitmap_new @80 dw_window_set_bitmap_from_data @81 dw_window_get_font @82 + dw_window_set_tooltip @83 dw_button_new @90 dw_bitmapbutton_new @91