|
From: <kr_...@us...> - 2003-08-12 21:34:39
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv567/src/cbits/Win32
Modified Files:
Internals.h ToolBar.c
Log Message:
Add support for SetText and GetText
Index: Internals.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Internals.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Internals.h 10 Aug 2003 18:36:04 -0000 1.4
--- Internals.h 12 Aug 2003 19:09:56 -0000 1.5
***************
*** 32,35 ****
--- 32,47 ----
#endif
+ #ifndef TBSTYLE_EX_MIXEDBUTTONS
+ #define TBSTYLE_EX_MIXEDBUTTONS 8
+ #endif
+
+ #ifndef TBSTYLE_EX_MIXEDBUTTONS
+ #define TBSTYLE_EX_MIXEDBUTTONS 8
+ #endif
+
+ #ifndef BTNS_SHOWTEXT
+ #define BTNS_SHOWTEXT 0x0040
+ #endif
+
extern HMODULE ghModule;
extern HWND ghWndFrame;
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ToolBar.c 11 Aug 2003 17:28:38 -0000 1.5
--- ToolBar.c 12 Aug 2003 19:09:56 -0000 1.6
***************
*** 160,164 ****
LONG lStyle;
! lStyle = GetWindowLong(hToolBar, GWL_STYLE);
sz.cx = 0;
--- 160,164 ----
LONG lStyle;
! lStyle = GetWindowLong(hToolBar, GWL_USERDATA);
sz.cx = 0;
***************
*** 232,236 ****
pCtxt->bFlip = FALSE;
pCtxt->bDitherLast = FALSE;
! pCtxt->dwDockStyle = GetWindowLong(hToolBar, GWL_STYLE) & (HORZ | VERT);
SetRectEmpty(&pCtxt->rectLast);
--- 232,236 ----
pCtxt->bFlip = FALSE;
pCtxt->bDitherLast = FALSE;
! pCtxt->dwDockStyle = GetWindowLong(hToolBar, GWL_USERDATA) & (HORZ | VERT);
SetRectEmpty(&pCtxt->rectLast);
***************
*** 471,475 ****
hToolBar = pCtxt->hToolBar;
! lStyle = GetWindowLong(hToolBar, GWL_STYLE);
CanDock(pCtxt, &hControlBar);
--- 471,475 ----
hToolBar = pCtxt->hToolBar;
! lStyle = GetWindowLong(hToolBar, GWL_USERDATA);
CanDock(pCtxt, &hControlBar);
***************
*** 484,488 ****
rect = pCtxt->rectDragVert;
! SetWindowLong(hToolBar, GWL_STYLE, (lStyle & ~(VERT | HORZ | FLOAT)) | pCtxt->dwOverDockStyle);
ScreenToClient(hControlBar, ((POINT *) &rect));
ScreenToClient(hControlBar, ((POINT *) &rect)+1);
--- 484,488 ----
rect = pCtxt->rectDragVert;
! SetWindowLong(hToolBar, GWL_USERDATA, (lStyle & ~(VERT | HORZ | FLOAT)) | pCtxt->dwOverDockStyle);
ScreenToClient(hControlBar, ((POINT *) &rect));
ScreenToClient(hControlBar, ((POINT *) &rect)+1);
***************
*** 498,502 ****
rect = pCtxt->rectFrameDragVert;
! SetWindowLong(hToolBar, GWL_STYLE, lStyle | FLOAT);
szCaption = NULL;
--- 498,502 ----
rect = pCtxt->rectFrameDragVert;
! SetWindowLong(hToolBar, GWL_USERDATA, lStyle | FLOAT);
szCaption = NULL;
***************
*** 587,591 ****
{
LRESULT lResult = 0;
! LONG lStyle = GetWindowLong(hWnd, GWL_STYLE);
switch (uMsg)
--- 587,591 ----
{
LRESULT lResult = 0;
! LONG lStyle = GetWindowLong(hWnd, GWL_USERDATA);
switch (uMsg)
***************
*** 783,788 ****
| CCS_NOPARENTALIGN | CCS_NOMOVEY
| CCS_NODIVIDER | CCS_NORESIZE | TBSTYLE_WRAPABLE
! | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT
! | lStyle,
0,0,0,0,
hControlBar,
--- 783,787 ----
| CCS_NOPARENTALIGN | CCS_NOMOVEY
| CCS_NODIVIDER | CCS_NORESIZE | TBSTYLE_WRAPABLE
! | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST,
0,0,0,0,
hControlBar,
***************
*** 791,794 ****
--- 790,795 ----
NULL
);
+ SetWindowLong(hWnd, GWL_USERDATA, lStyle);
+ SendMessage(hWnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
SetWindowText(hWnd, name);
DockToolBar(hControlBar, hWnd, band_num, band_position, offset);
***************
*** 817,821 ****
tbb.idCommand = btn->nCommand;
tbb.fsState = (BYTE)TBSTATE_ENABLED;
! tbb.fsStyle = (BYTE)TBSTYLE_BUTTON;
tbb.dwData = (DWORD)btn;
tbb.iString = 0;
--- 818,822 ----
tbb.idCommand = btn->nCommand;
tbb.fsState = (BYTE)TBSTATE_ENABLED;
! tbb.fsStyle = (BYTE)TBSTYLE_BUTTON | BTNS_SHOWTEXT;
tbb.dwData = (DWORD)btn;
tbb.iString = 0;
***************
*** 949,957 ****
void osSetToolButtonText(ToolHandle toolButton, char *text)
{
}
char *osGetToolButtonText(ToolHandle toolButton)
{
! return NULL;
}
--- 950,973 ----
void osSetToolButtonText(ToolHandle toolButton, char *text)
{
+ TBBUTTONINFO tbbi;
+ tbbi.cbSize = sizeof(tbbi);
+ tbbi.dwMask = TBIF_TEXT;
+ tbbi.pszText = text;
+ tbbi.cchText = strlen(text);
+ SendMessage(toolButton->hToolBar, TB_SETBUTTONINFO, toolButton->nCommand, (LPARAM) &tbbi);
}
char *osGetToolButtonText(ToolHandle toolButton)
{
! char *buffer;
! int nLen = SendMessage(toolButton->hToolBar, TB_GETBUTTONTEXT, toolButton->nCommand, 0);
! buffer = malloc(nLen+1);
!
! if (buffer)
! {
! SendMessage(toolButton->hToolBar, TB_GETBUTTONTEXT, toolButton->nCommand, (LPARAM) buffer);
! }
!
! return buffer;
}
|