Mercurial > dwindows
comparison os2/dw.c @ 1047:5dbb931bac5a
Changed the data names from _dw_entry/_dw_group to _dw_buddy on OS/2.
This allows dw_window_set/get_text and dw_window_set/get_text to work
on both spinbuttons and groupboxes.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Sat, 28 May 2011 10:41:57 +0000 |
parents | 59343c7493a3 |
children | 140d04226c86 |
comparison
equal
deleted
inserted
replaced
1046:80cd7fed4995 | 1047:5dbb931bac5a |
---|---|
4079 * handle: The window (widget) handle. | 4079 * handle: The window (widget) handle. |
4080 * fontname: Name and size of the font in the form "size.fontname" | 4080 * fontname: Name and size of the font in the form "size.fontname" |
4081 */ | 4081 */ |
4082 int API dw_window_set_font(HWND handle, char *fontname) | 4082 int API dw_window_set_font(HWND handle, char *fontname) |
4083 { | 4083 { |
4084 HWND group = (HWND)dw_window_get_data(handle, "_dw_group"); | 4084 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
4085 return WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); | 4085 return WinSetPresParam(group ? group : handle, PP_FONTNAMESIZE, strlen(fontname)+1, fontname); |
4086 } | 4086 } |
4087 | 4087 |
4088 /* | 4088 /* |
4089 * Gets the font used by a specified window (widget) handle. | 4089 * Gets the font used by a specified window (widget) handle. |
4092 * fontname: Name and size of the font in the form "size.fontname" | 4092 * fontname: Name and size of the font in the form "size.fontname" |
4093 */ | 4093 */ |
4094 char * API dw_window_get_font(HWND handle) | 4094 char * API dw_window_get_font(HWND handle) |
4095 { | 4095 { |
4096 char *str = (char *)alloca(50); | 4096 char *str = (char *)alloca(50); |
4097 HWND group = (HWND)dw_window_get_data(handle, "_dw_group"); | 4097 HWND group = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
4098 if(str && WinQueryPresParam(group ? group : handle, PP_FONTNAMESIZE, 0, NULL, 50, str, QPF_NOINHERIT)) | 4098 if(str && WinQueryPresParam(group ? group : handle, PP_FONTNAMESIZE, 0, NULL, 50, str, QPF_NOINHERIT)) |
4099 return strdup(str); | 4099 return strdup(str); |
4100 return NULL; | 4100 return NULL; |
4101 } | 4101 } |
4102 | 4102 |
4413 | 4413 |
4414 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); | 4414 WinSetWindowPtr(newbox->hwnd, QWP_USER, newbox); |
4415 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); | 4415 dw_window_set_color(newbox->hwnd, DW_CLR_PALEGRAY, DW_CLR_PALEGRAY); |
4416 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); | 4416 dw_window_set_color(newbox->grouphwnd, DW_CLR_BLACK, DW_CLR_PALEGRAY); |
4417 dw_window_set_font(newbox->grouphwnd, DefaultFont); | 4417 dw_window_set_font(newbox->grouphwnd, DefaultFont); |
4418 dw_window_set_data(newbox->hwnd, "_dw_group", newbox->grouphwnd); | 4418 dw_window_set_data(newbox->hwnd, "_dw_buddy", newbox->grouphwnd); |
4419 return newbox->hwnd; | 4419 return newbox->hwnd; |
4420 } | 4420 } |
4421 | 4421 |
4422 /* | 4422 /* |
4423 * Create a new MDI Frame to be packed. | 4423 * Create a new MDI Frame to be packed. |
5345 blah = calloc(sizeof(WindowData), 1); | 5345 blah = calloc(sizeof(WindowData), 1); |
5346 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); | 5346 blah->oldproc = WinSubclassWindow(entry, _spinentryproc); |
5347 WinSetWindowPtr(entry, QWP_USER, blah); | 5347 WinSetWindowPtr(entry, QWP_USER, blah); |
5348 dw_window_set_font(tmp, DefaultFont); | 5348 dw_window_set_font(tmp, DefaultFont); |
5349 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); | 5349 dw_window_set_color(entry, DW_CLR_BLACK, DW_CLR_WHITE); |
5350 dw_window_set_data(tmp, "_dw_entry", (void *)entry); | 5350 dw_window_set_data(tmp, "_dw_buddy", (void *)entry); |
5351 return tmp; | 5351 return tmp; |
5352 } | 5352 } |
5353 | 5353 |
5354 /* | 5354 /* |
5355 * Create a new radiobutton window (widget) to be packed. | 5355 * Create a new radiobutton window (widget) to be packed. |
5769 * handle: Handle to the window. | 5769 * handle: Handle to the window. |
5770 * text: The text associsated with a given window. | 5770 * text: The text associsated with a given window. |
5771 */ | 5771 */ |
5772 void API dw_window_set_text(HWND handle, char *text) | 5772 void API dw_window_set_text(HWND handle, char *text) |
5773 { | 5773 { |
5774 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_entry"); | 5774 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
5775 WinSetWindowText(entryfield ? entryfield : handle, text); | 5775 WinSetWindowText(entryfield ? entryfield : handle, text); |
5776 } | 5776 } |
5777 | 5777 |
5778 /* | 5778 /* |
5779 * Gets the text used for a given window. | 5779 * Gets the text used for a given window. |
5782 * Returns: | 5782 * Returns: |
5783 * text: The text associsated with a given window. | 5783 * text: The text associsated with a given window. |
5784 */ | 5784 */ |
5785 char * API dw_window_get_text(HWND handle) | 5785 char * API dw_window_get_text(HWND handle) |
5786 { | 5786 { |
5787 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_entry"); | 5787 HWND entryfield = (HWND)dw_window_get_data(handle, "_dw_buddy"); |
5788 int len = WinQueryWindowTextLength(entryfield ? entryfield : handle); | 5788 int len = WinQueryWindowTextLength(entryfield ? entryfield : handle); |
5789 char *tempbuf = calloc(1, len + 2); | 5789 char *tempbuf = calloc(1, len + 2); |
5790 | 5790 |
5791 WinQueryWindowText(entryfield ? entryfield : handle, len + 1, tempbuf); | 5791 WinQueryWindowText(entryfield ? entryfield : handle, len + 1, tempbuf); |
5792 | 5792 |