Mercurial > dwindows
diff os2/dw.c @ 1392:943266c86aed
Refactoring OS/2 and Windows code... eliminating BubbleButton...
BubbleButton was no longer really used in Windows since I switched to native tooltips...
However parts of it were still hanging around. Merging BubbleButton into WindowData on
OS/2 to prepare for generic tooltip support. More coming very soon.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 26 Nov 2011 22:47:20 +0000 |
parents | 0512fbb08abf |
children | eb83c9830dfa |
line wrap: on
line diff
--- a/os2/dw.c Sat Nov 26 21:05:49 2011 +0000 +++ b/os2/dw.c Sat Nov 26 22:47:20 2011 +0000 @@ -3669,15 +3669,13 @@ MRESULT EXPENTRY _BtProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { - BubbleButton *bubble; + WindowData *blah = WinQueryWindowPtr(hwnd, QWL_USER); PFNWP oldproc; - bubble = (BubbleButton *)WinQueryWindowPtr(hwnd, QWL_USER); - - if(!bubble) + if(!blah) return WinDefWindowProc(hwnd, msg, mp1, mp2); - oldproc = bubble->pOldProc; + oldproc = blah->oldproc; switch(msg) { @@ -3813,7 +3811,7 @@ case 0x041e: - if(!*bubble->bubbletext) + if(!*blah->bubbletext) break; if(hwndBubble) @@ -3858,14 +3856,14 @@ &ulColor); WinSetWindowText(hwndBubble, - (PSZ)bubble->bubbletext); + (PSZ)blah->bubbletext); WinMapWindowPoints(hwnd, HWND_DESKTOP, &ptlWork, 1); hpsTemp = WinGetPS(hwndBubble); GpiQueryTextBox(hpsTemp, - strlen(bubble->bubbletext), - (PCH)bubble->bubbletext, + strlen(blah->bubbletext), + (PCH)blah->bubbletext, TXTBOX_COUNT, txtPointl); WinReleasePS(hpsTemp); @@ -5554,8 +5552,7 @@ */ HWND API dw_button_new(char *text, ULONG id) { - BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); - + WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, (PSZ)text, @@ -5567,11 +5564,9 @@ NULL, NULL); - bubble->id = id; - bubble->bubbletext[0] = '\0'; - bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); - - WinSetWindowPtr(tmp, QWP_USER, bubble); + blah->oldproc = WinSubclassWindow(tmp, _BtProc); + + WinSetWindowPtr(tmp, QWP_USER, blah); dw_window_set_font(tmp, DefaultFont); dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); return tmp; @@ -5620,7 +5615,7 @@ { char idbuf[256], *name = NULL; HWND tmp; - BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); + WindowData *blah = calloc(1, sizeof(WindowData)); HPOINTER icon = WinLoadPointer(HWND_DESKTOP, 0L, id); if(!icon) @@ -5642,12 +5637,11 @@ NULL, NULL); - bubble->id = id; - strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); - bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; - bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); - - WinSetWindowPtr(tmp, QWP_USER, bubble); + strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); + blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; + blah->old = WinSubclassWindow(tmp, _BtProc); + + WinSetWindowPtr(tmp, QWP_USER, blah); if(icon) dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); @@ -5666,7 +5660,7 @@ */ HWND API dw_bitmapbutton_new_from_file(char *text, unsigned long id, char *filename) { - BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); + WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, NULL, @@ -5741,12 +5735,11 @@ } } - bubble->id = id; - strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); - bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; - bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); - - WinSetWindowPtr(tmp, QWP_USER, bubble); + strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); + blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; + blah->oldproc = WinSubclassWindow(tmp, _BtProc); + + WinSetWindowPtr(tmp, QWP_USER, blah); if(icon) dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); @@ -5771,7 +5764,7 @@ HWND API dw_bitmapbutton_new_from_data(char *text, unsigned long id, char *data, int len) { FILE *fp; - BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); + WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, NULL, @@ -5841,12 +5834,11 @@ } } - bubble->id = id; - strncpy(bubble->bubbletext, text, BUBBLE_HELP_MAX - 1); - bubble->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; - bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); - - WinSetWindowPtr(tmp, QWP_USER, bubble); + strncpy(blah->bubbletext, text, BUBBLE_HELP_MAX - 1); + blah->bubbletext[BUBBLE_HELP_MAX - 1] = '\0'; + blah->oldproc = WinSubclassWindow(tmp, _BtProc); + + WinSetWindowPtr(tmp, QWP_USER, blah); if(icon) dw_window_set_data(tmp, "_dw_button_icon", (void *)icon); @@ -6008,7 +6000,7 @@ */ HWND API dw_checkbox_new(char *text, ULONG id) { - BubbleButton *bubble = calloc(sizeof(BubbleButton), 1); + WindowData *blah = calloc(1, sizeof(WindowData)); HWND tmp = WinCreateWindow(HWND_OBJECT, WC_BUTTON, (PSZ)text, @@ -6019,10 +6011,9 @@ id, NULL, NULL); - bubble->id = id; - bubble->bubbletext[0] = '\0'; - bubble->pOldProc = WinSubclassWindow(tmp, _BtProc); - WinSetWindowPtr(tmp, QWP_USER, bubble); + blah->bubbletext[0] = '\0'; + blah->oldproc = WinSubclassWindow(tmp, _BtProc); + WinSetWindowPtr(tmp, QWP_USER, blah); dw_window_set_font(tmp, DefaultFont); dw_window_set_color(tmp, DW_CLR_BLACK, DW_CLR_PALEGRAY); return tmp;