|
From: <kr_...@us...> - 2003-08-21 21:39:24
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv15930/port/src/cbits/Win32
Modified Files:
CheckBox.c RadioBox.c Window.c
Log Message:
Simplified API for RadioBox. The new API is much like the API for ToolGroup and MenuGroup
Index: CheckBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/CheckBox.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** CheckBox.c 10 Feb 2003 22:42:10 -0000 1.3
--- CheckBox.c 21 Aug 2003 17:34:01 -0000 1.4
***************
*** 1,6 ****
#include "CheckBox.h"
#include "Internals.h"
! WindowHandle osCreateCheckBox(WindowHandle window, char *title)
{
HWND hCheckBox;
--- 1,7 ----
#include "CheckBox.h"
#include "Internals.h"
+ #include "Handlers_stub.h"
! WindowHandle osCreateCheckBox(WindowHandle window)
{
HWND hCheckBox;
***************
*** 8,12 ****
hCheckBox = CreateWindow(
"BUTTON",
! title,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | WS_TABSTOP,
0,0,0,0,
--- 9,13 ----
hCheckBox = CreateWindow(
"BUTTON",
! NULL,
WS_CHILD | WS_VISIBLE | BS_AUTOCHECKBOX | WS_TABSTOP,
0,0,0,0,
***************
*** 36,39 ****
--- 37,54 ----
res[0] = sz.cx + ((tm.tmHeight+tm.tmDescent)*3)/2;
res[1] = tm.tmHeight+tm.tmDescent;
+ };
+
+ char *osGetCheckBoxText(WindowHandle checkbox)
+ {
+ int nLen = GetWindowTextLength(checkbox);
+ char *buffer = (char *) rmalloc(nLen+1);
+ GetWindowText(checkbox, buffer, nLen+1);
+ return buffer;
+ };
+
+ void osSetCheckBoxText(WindowHandle checkbox, char *txt)
+ {
+ SetWindowText(checkbox, txt);
+ handleWindowReLayout(GetParent(checkbox));
};
Index: RadioBox.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/RadioBox.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** RadioBox.c 10 Feb 2003 22:42:10 -0000 1.3
--- RadioBox.c 21 Aug 2003 17:34:01 -0000 1.4
***************
*** 1,6 ****
#include "RadioBox.h"
#include "Internals.h"
! WindowHandle osCreateRadioBox(WindowHandle window, BOOL isFirst, char *title)
{
HWND hCheckBox;
--- 1,7 ----
#include "RadioBox.h"
#include "Internals.h"
+ #include "Handlers_stub.h"
! WindowHandle osCreateRadioBox(WindowHandle window)
{
HWND hCheckBox;
***************
*** 8,13 ****
hCheckBox = CreateWindow(
"BUTTON",
! title,
! WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | WS_TABSTOP | (isFirst ? WS_GROUP : 0),
0,0,0,0,
window,
--- 9,14 ----
hCheckBox = CreateWindow(
"BUTTON",
! NULL,
! WS_CHILD | WS_VISIBLE | BS_AUTORADIOBUTTON | WS_TABSTOP,
0,0,0,0,
window,
***************
*** 16,19 ****
--- 17,21 ----
NULL
);
+ SetWindowLong(hCheckBox, GWL_USERDATA, (LONG) hCheckBox);
return checkWindow(hCheckBox, "RADIOBOX");
};
***************
*** 38,41 ****
--- 40,57 ----
};
+ char *osGetRadioBoxText(WindowHandle radiobox)
+ {
+ int nLen = GetWindowTextLength(radiobox);
+ char *buffer = (char *) rmalloc(nLen+1);
+ GetWindowText(radiobox, buffer, nLen+1);
+ return buffer;
+ };
+
+ void osSetRadioBoxText(WindowHandle radiobox, char *txt)
+ {
+ SetWindowText(radiobox, txt);
+ handleWindowReLayout(GetParent(radiobox));
+ };
+
BOOL osGetRadioBoxState(WindowHandle radiobox)
{
***************
*** 46,48 ****
--- 62,94 ----
{
SendMessage(radiobox,BM_SETCHECK,state ? BST_CHECKED : BST_UNCHECKED,0);
+ };
+
+ void osSetRadioBoxGroup(WindowHandle *handles)
+ {
+ WindowHandle first, next, child, handle, *phandle;
+
+ phandle=handles;
+ for (;;)
+ {
+ handle = *phandle;
+
+ first = (WindowHandle) GetWindowLong(handle, GWL_USERDATA);
+ child = first;
+ for (;;)
+ {
+ next = (WindowHandle) GetWindowLong(child, GWL_USERDATA);
+ if (next == handle) break;
+ child = next;
+ }
+ SetWindowLong(child, GWL_USERDATA, (LONG) first);
+
+ phandle++;
+ if (*phandle)
+ SetWindowLong(handle, GWL_USERDATA, (LONG) *phandle);
+ else
+ {
+ SetWindowLong(handle, GWL_USERDATA, (LONG) *handles);
+ break;
+ }
+ }
};
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** Window.c 20 Aug 2003 21:37:27 -0000 1.39
--- Window.c 21 Aug 2003 17:34:01 -0000 1.40
***************
*** 183,187 ****
--- 183,201 ----
else
if (_stricmp(buffer, "Button") == 0)
+ {
+ if ((GetWindowLong(hCtrl, GWL_STYLE) & BS_AUTORADIOBUTTON) == BS_AUTORADIOBUTTON)
+ {
+ HWND hNextCtrl = hCtrl;
+ for (;;)
+ {
+ hNextCtrl = (WindowHandle) GetWindowLong(hNextCtrl, GWL_USERDATA);
+ if (hNextCtrl == hCtrl) break;
+
+ SendMessage(hNextCtrl,BM_SETCHECK,BST_UNCHECKED,0);
+ }
+ }
+
handleControlCommand(hCtrl);
+ }
}
else
|