You can subscribe to this list here.
| 2003 |
Jan
(30) |
Feb
(20) |
Mar
(151) |
Apr
(86) |
May
(23) |
Jun
(25) |
Jul
(107) |
Aug
(141) |
Sep
(55) |
Oct
(85) |
Nov
(65) |
Dec
(2) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(22) |
Feb
(18) |
Mar
(3) |
Apr
(16) |
May
(69) |
Jun
(3) |
Jul
(1) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(6) |
Dec
(1) |
| 2005 |
Jan
(2) |
Feb
(16) |
Mar
|
Apr
|
May
|
Jun
(47) |
Jul
(1) |
Aug
|
Sep
(6) |
Oct
(4) |
Nov
|
Dec
(34) |
| 2006 |
Jan
(39) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(5) |
Oct
|
Nov
(4) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
| 2008 |
Jan
|
Feb
|
Mar
(26) |
Apr
(1) |
May
(1) |
Jun
|
Jul
(5) |
Aug
(2) |
Sep
(8) |
Oct
(8) |
Nov
(22) |
Dec
(30) |
| 2009 |
Jan
(10) |
Feb
(13) |
Mar
(14) |
Apr
(14) |
May
(32) |
Jun
(25) |
Jul
(36) |
Aug
(10) |
Sep
(2) |
Oct
|
Nov
|
Dec
(10) |
| 2010 |
Jan
(9) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
|
Oct
(1) |
Nov
|
Dec
|
|
From: <kr_...@us...> - 2003-08-16 10:01:02
|
Update of /cvsroot/htoolkit/gio In directory sc8-pr-cvs1:/tmp/cvs-serv3392/gio Modified Files: makefile Log Message: Better support for "make clean" Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/gio/makefile,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** makefile 23 Jul 2003 16:26:27 -0000 1.13 --- makefile 16 Aug 2003 09:54:28 -0000 1.14 *************** *** 12,18 **** # # make clean - remove all generated files - # make cleanDOC - remove docs - # make cleanHS - remove haskell output files - # make cleanLIB - remove library # # dependencies are handled automatically. --- 12,15 ---- *************** *** 155,162 **** -include $(HDEPS) ! .PHONY: clean cleanHS cleanDOC cleanLIB #-------------------------------------------------------------------------- ! # EXTRA RULES: clean doc #-------------------------------------------------------------------------- clean: --- 152,159 ---- -include $(HDEPS) ! .PHONY: clean #-------------------------------------------------------------------------- ! # EXTRA RULES: clean & doc #-------------------------------------------------------------------------- clean: |
|
From: <kr_...@us...> - 2003-08-16 08:08:37
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv22881/src/cbits/GTK
Modified Files:
Menu.c
Log Message:
Simplified implementation for MenuRadioItems for GNOME
Index: Menu.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/Menu.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Menu.c 5 Jul 2003 06:42:38 -0000 1.8
--- Menu.c 16 Aug 2003 08:01:14 -0000 1.9
***************
*** 26,30 ****
static int recalcPos(GtkWidget *menu, int pos)
{
- BOOL b;
int new_pos;
GList *children;
--- 26,29 ----
***************
*** 34,50 ****
if (pos >= 0)
{
- b = TRUE;
new_pos = 0;
while (children && pos > 0)
{
! if (GTK_WIDGET_VISIBLE((GtkWidget*) children->data))
! {
! if (b) pos--;
! }
! else
! {
! b = !b;
! }
!
new_pos++;
children = children->next;
--- 33,40 ----
if (pos >= 0)
{
new_pos = 0;
while (children && pos > 0)
{
! pos--;
new_pos++;
children = children->next;
***************
*** 70,74 ****
{
menuItem = (GtkWidget *) child->data;
!
if (GTK_IS_IMAGE_MENU_ITEM(menuItem) ||
GTK_IS_CHECK_MENU_ITEM(menuItem) ||
--- 60,64 ----
{
menuItem = (GtkWidget *) child->data;
!
if (GTK_IS_IMAGE_MENU_ITEM(menuItem) ||
GTK_IS_CHECK_MENU_ITEM(menuItem) ||
***************
*** 173,246 ****
{
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)))
! handleMenuCommand(menuitem) ;
}
- MenuHandle osInsertMenuRadioGroup(MenuHandle parent, int pos)
- {
- GtkWidget *menu;
- GtkWidget *item1, *item2;
-
- menu = getMenu(parent);
- pos = recalcPos(menu, pos);
-
- item1 = gtk_separator_menu_item_new();
- gtk_menu_shell_insert(GTK_MENU_SHELL(menu), item1, pos);
-
- item2 = gtk_separator_menu_item_new();
- gtk_menu_shell_insert(GTK_MENU_SHELL(menu), item2, pos);
-
- gtk_signal_connect (GTK_OBJECT(item1), "destroy",
- GTK_SIGNAL_FUNC(handleMenuDestroy),
- parent);
-
- return item1;
- };
-
MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos)
{
! int new_pos;
! GList *children;
! GtkWidget *menu, *menuItem, *label;
! GSList *group;
!
! new_pos = 0;
! menu = gtk_widget_get_parent(parent);
! children = GTK_MENU_SHELL(menu)->children;
!
!
! while (children && children->data != parent)
! {
! new_pos++;
! children = children->next;
! }
!
! if (!children || !children->next)
! return NULL;
!
! new_pos++;
! children = children->next;
! group = NULL;
!
! if (pos < 0)
! {
! while (children && GTK_WIDGET_VISIBLE((GtkWidget *) children->data))
! {
! new_pos++;
! group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM((GtkWidget *) children->data));
! children = children->next;
! }
! }
! else
! {
! while (children && GTK_WIDGET_VISIBLE((GtkWidget *) children->data) && pos > 0)
! {
! pos--;
! new_pos++;
! group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM((GtkWidget *) children->data));
! children = children->next;
! }
! }
! menuItem = gtk_radio_menu_item_new (group);
label = gtk_accel_label_new("");
gtk_container_add(GTK_CONTAINER(menuItem), label);
--- 163,176 ----
{
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(menuitem)))
! handleMenuCommand(menuitem);
}
MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos)
{
! GtkWidget *menu;
! GtkWidget *menuItem, *label;
! menuItem = gtk_radio_menu_item_new(NULL);
! GTK_CHECK_MENU_ITEM (menuItem)->active = FALSE;
label = gtk_accel_label_new("");
gtk_container_add(GTK_CONTAINER(menuItem), label);
***************
*** 254,261 ****
NULL);
! gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuItem, new_pos);
! gtk_widget_show_all(menuItem);
return menuItem;
}
--- 184,205 ----
NULL);
! menu = getMenu(parent);
! pos = recalcPos(menu, pos);
+ gtk_menu_shell_insert(GTK_MENU_SHELL(menu), menuItem, pos);
+ gtk_widget_show_all(menuItem);
return menuItem;
+ }
+
+ void osSetMenuRadioGroup(MenuHandle *handles)
+ {
+ MenuHandle *phandle;
+ GSList *group = NULL;
+
+ for (phandle = handles; *phandle; phandle++)
+ {
+ gtk_radio_menu_item_set_group(GTK_RADIO_MENU_ITEM(*phandle), group);
+ group = gtk_radio_menu_item_get_group (GTK_RADIO_MENU_ITEM(*phandle));
+ }
}
|
|
From: <kr_...@us...> - 2003-08-16 08:07:24
|
Update of /cvsroot/htoolkit/port/src/cbits/GTK
In directory sc8-pr-cvs1:/tmp/cvs-serv22617/src/cbits/GTK
Modified Files:
ToolBar.c
Log Message:
Uncomment the implementation of the ToolBar
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/GTK/ToolBar.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ToolBar.c 10 Aug 2003 18:36:04 -0000 1.3
--- ToolBar.c 16 Aug 2003 07:59:42 -0000 1.4
***************
*** 46,50 ****
ToolHandle osInsertToolButton(WindowHandle toolbar, int pos)
{
- /*
GtkToolItem *item = gtk_tool_button_new("", gtk_image_new());
gtk_signal_connect (GTK_OBJECT(GTK_TOOL_BUTTON(item)->button), "clicked",
--- 46,49 ----
***************
*** 58,69 ****
gtk_widget_show_all(GTK_WIDGET(item));
return GTK_WIDGET(item);
- */
- printf("osInsertToolButton -> not implemented");
- return NULL;
}
ToolHandle osInsertToolCheckButton(WindowHandle toolbar, int pos)
{
- /*
GtkToolItem *item = gtk_toggle_tool_button_new();
gtk_signal_connect (GTK_OBJECT(GTK_TOOL_BUTTON(item)->button), "clicked",
--- 57,64 ----
***************
*** 79,90 ****
gtk_widget_show_all(GTK_WIDGET(item));
return GTK_WIDGET(item);
- */
- printf("osInsertToolCheckButton -> not implemented");
- return NULL;
}
ToolHandle osInsertToolLine(WindowHandle toolbar, int pos)
{
- /*
GtkToolItem *item = gtk_separator_tool_item_new();
gtk_signal_connect (GTK_OBJECT(item), "destroy",
--- 74,81 ----
***************
*** 94,105 ****
gtk_widget_show_all(GTK_WIDGET(item));
return GTK_WIDGET(item);
- */
- printf("osInsertToolLine -> not implemented");
- return NULL;
}
void osSetToolButtonBitmap(ToolHandle toolButton, BitmapHandle bitmap)
{
! //gtk_image_set_from_pixbuf(gtk_tool_button_get_icon_widget (GTK_TOOL_BUTTON(toolButton)), bitmap->pixbuf);
}
--- 85,93 ----
gtk_widget_show_all(GTK_WIDGET(item));
return GTK_WIDGET(item);
}
void osSetToolButtonBitmap(ToolHandle toolButton, BitmapHandle bitmap)
{
! gtk_image_set_from_pixbuf(gtk_tool_button_get_icon_widget (GTK_TOOL_BUTTON(toolButton)), bitmap->pixbuf);
}
***************
*** 116,153 ****
void osSetToolButtonTip(ToolHandle toolButton, char *text)
{
! //GtkWidget *toolbar = gtk_widget_get_parent(toolButton);
! //gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolButton), GTK_TOOLBAR(toolbar)->tooltips, text, NULL);
}
char *osGetToolButtonTip(ToolHandle toolButton)
{
! //GtkTooltipsData *tips_data = gtk_tooltips_data_get(GTK_BIN (toolButton)->child);
! //return strdup(tips_data->tip_text);
! return strdup("");
}
void osSetToolButtonText(ToolHandle toolButton, char *text)
{
! //GtkWidget *label = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON(toolButton));
! //gtk_label_set_text(GTK_LABEL(label), text);
}
char *osGetToolButtonText(ToolHandle toolButton)
{
! /*GtkWidget *label = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON(toolButton));
char *text = gtk_label_get_text(GTK_LABEL(label));
! return strdup(text);*/
! return strdup("");
}
void osSetToolButtonChecked(ToolHandle toolButton, BOOL bState)
{
! //gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(toolButton), bState);
};
BOOL osGetToolButtonChecked(ToolHandle toolButton)
{
! //return gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toolButton));
! return FALSE;
};
--- 104,138 ----
void osSetToolButtonTip(ToolHandle toolButton, char *text)
{
! GtkWidget *toolbar = gtk_widget_get_parent(toolButton);
! gtk_tool_item_set_tooltip(GTK_TOOL_ITEM(toolButton), GTK_TOOLBAR(toolbar)->tooltips, text, NULL);
}
char *osGetToolButtonTip(ToolHandle toolButton)
{
! GtkTooltipsData *tips_data = gtk_tooltips_data_get(GTK_BIN (toolButton)->child);
! return strdup(tips_data->tip_text);
}
void osSetToolButtonText(ToolHandle toolButton, char *text)
{
! GtkWidget *label = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON(toolButton));
! gtk_label_set_text(GTK_LABEL(label), text);
}
char *osGetToolButtonText(ToolHandle toolButton)
{
! GtkWidget *label = gtk_tool_button_get_label_widget (GTK_TOOL_BUTTON(toolButton));
char *text = gtk_label_get_text(GTK_LABEL(label));
! return strdup(text);
}
void osSetToolButtonChecked(ToolHandle toolButton, BOOL bState)
{
! gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON(toolButton), bState);
};
BOOL osGetToolButtonChecked(ToolHandle toolButton)
{
! return gtk_toggle_tool_button_get_active(GTK_TOGGLE_TOOL_BUTTON(toolButton));
};
***************
*** 159,164 ****
int osGetToolItemPos(ToolHandle toolItem)
{
! //GtkWidget *toolbar = gtk_widget_get_parent(toolItem);
! //return gtk_toolbar_get_item_index(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(toolItem));
! return 0;
}
--- 144,148 ----
int osGetToolItemPos(ToolHandle toolItem)
{
! GtkWidget *toolbar = gtk_widget_get_parent(toolItem);
! return gtk_toolbar_get_item_index(GTK_TOOLBAR(toolbar), GTK_TOOL_ITEM(toolItem));
}
|
|
From: <kr_...@us...> - 2003-08-16 00:56:18
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv20786/src/cbits/Win32
Modified Files:
Frame.c ToolBar.c Util.c
Added Files:
DockBar.c DockBar.h
Removed Files:
ControlBar.c ControlBar.h
Log Message:
Rename ControlBar to DockBar
--- NEW FILE: DockBar.c ---
#include "Types.h"
#include "Internals.h"
#include "DockBar.h"
#include "Handlers_stub.h"
typedef struct
{
int nSize;
int nOffset;
HWND hWnd;
} BarData;
typedef struct
{
int nSize;
int nOffset;
int nBarCount;
BarData *pBars;
} BandData;
typedef struct
{
int nBandCount;
BandData *pBands;
} DockBarData;
static void RecalcDockBarLayout(DockBarData *pData, BOOL bVert)
{
int i, j;
BarData *pBar;
BandData *pBand;
int nBarOffset, nBandOffset;
SIZE sz;
nBandOffset = 0;
for (i = 0; i < pData->nBandCount; i++)
{
pBand = &pData->pBands[i];
pBand->nSize = 0;
pBand->nOffset = nBandOffset;
nBarOffset = 0;
for (j = 0; j < pBand->nBarCount; j++)
{
pBar = &pBand->pBars[j];
GetToolBarSize(pBar->hWnd, &sz);
pBar->nOffset = max(pBar->nOffset, nBarOffset);
if (bVert)
{
pBand->nSize = max(pBand->nSize, sz.cx);
pBar->nSize = sz.cy;
SetWindowPos(pBar->hWnd,NULL,pBand->nOffset,pBar->nOffset,sz.cx,sz.cy,SWP_NOZORDER);
}
else
{
pBand->nSize = max(pBand->nSize, sz.cy);
pBar->nSize = sz.cx;
SetWindowPos(pBar->hWnd,NULL,pBar->nOffset,pBand->nOffset,sz.cx,sz.cy,SWP_NOZORDER);
}
nBarOffset = pBar->nOffset + pBar->nSize;
}
nBandOffset = pBand->nOffset + pBand->nSize;
}
}
static int GetDockBarSize(HWND hDockBar)
{
int i, nSize;
DockBarData *pData;
nSize = 0;
pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA);
RecalcDockBarLayout(pData, GetWindowLong(hDockBar, GWL_STYLE) & CCS_VERT);
for (i = 0; i < pData->nBandCount; i++)
nSize += pData->pBands[i].nSize;
return nSize;
}
void RelayoutFrameBars()
{
RECT rect;
FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
int nWidth, nHeight, nLeft, nTop, nRight, nBottom;
GetClientRect(ghWndFrame, &rect);
nWidth = rect.right-rect.left;
nHeight = rect.bottom-rect.top;
nLeft = GetDockBarSize(pData->hLeftBar);
nTop = GetDockBarSize(pData->hTopBar);
nRight = GetDockBarSize(pData->hRightBar);
nBottom = GetDockBarSize(pData->hBottomBar);
SetWindowPos(pData->hLeftBar, NULL,0,nTop,nLeft,nHeight-(nBottom+nTop),SWP_NOZORDER);
SetWindowPos(pData->hTopBar, NULL,0,0,nWidth,nTop,SWP_NOZORDER);
SetWindowPos(pData->hRightBar, NULL,nWidth-nRight,nTop,nRight,nHeight-(nBottom+nTop),SWP_NOZORDER);
SetWindowPos(pData->hBottomBar,NULL,0,nHeight-nBottom,nWidth,nBottom,SWP_NOZORDER);
SetWindowPos(pData->hClientWnd,NULL,nLeft,nTop,nWidth-(nRight+nLeft),nHeight-(nBottom+nTop),SWP_NOZORDER);
}
LRESULT CALLBACK HDockBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
DockBarData *pData = (DockBarData *) GetWindowLong(hWnd, GWL_USERDATA);
switch (uMsg)
{
case WM_CREATE:
{
HMENU hMenu;
if (((CREATESTRUCT *) lParam)->style & WS_CHILD)
{
pData = malloc(sizeof(DockBarData));
if (!pData) return -1;
pData->nBandCount = 0;
pData->pBands = NULL;
SetWindowLong(hWnd, GWL_USERDATA, (LONG) pData);
}
hMenu = GetSystemMenu(hWnd, FALSE);
if (hMenu)
{
DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND);
DeleteMenu(hMenu, SC_MINIMIZE, MF_BYCOMMAND);
DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND);
DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
AppendMenu(hMenu, MF_STRING, SC_CLOSE, "Hide");
}
}
break;
case WM_DESTROY:
if (pData)
{
int i;
SetWindowLong(hWnd, GWL_USERDATA, 0);
for (i = 0; i < pData->nBandCount; i++)
free(pData->pBands[i].pBars);
free(pData->pBands);
free(pData);
}
break;
case WM_CLOSE:
ShowWindow(hWnd, SW_HIDE);
return 0;
case WM_COMMAND:
{
TBBUTTONINFO tbbi;
HWND hToolBar = (HWND) lParam;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_LPARAM;
tbbi.lParam = 0;
SendMessage(hToolBar, TB_GETBUTTONINFO, LOWORD(wParam), (LPARAM) &tbbi);
handleToolCommand((WindowHandle) tbbi.lParam);
}
break;
case WM_SIZE:
if (!pData)
{
int nWidth = LOWORD(lParam);
int nHeight = HIWORD(lParam);
SetWindowPos(GetWindow(hWnd, GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER);
}
break;
case WM_NCLBUTTONDOWN:
if (wParam == HTCAPTION)
SendMessage(GetWindow(hWnd, GW_CHILD), uMsg, wParam, lParam);
break;
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
void DockToolBarToRect(HWND hDockBar, HWND hWnd, RECT rect)
{
int nBandNum;
int nPosition;
int nOffset;
int nCentralOffset;
DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA);
BOOL bVert = GetWindowLong(hDockBar, GWL_STYLE) & CCS_VERT;
BandData *pBand;
RecalcDockBarLayout(pData, bVert);
if (bVert)
{
nOffset = rect.top;
nCentralOffset = (rect.right-rect.left)/2;
}
else
{
nOffset = rect.left;
nCentralOffset = (rect.bottom-rect.top)/2;
}
for (nBandNum = 0; nBandNum < pData->nBandCount; nBandNum++)
{
if (pData->pBands[nBandNum].nOffset <= nCentralOffset &&
nCentralOffset <= pData->pBands[nBandNum].nOffset+pData->pBands[nBandNum].nSize)
break;
}
if (nBandNum >= pData->nBandCount)
nPosition = 0;
else
{
pBand = &pData->pBands[nBandNum];
if (nOffset < pBand->pBars[0].nOffset)
nPosition = 0;
else
{
for (nPosition = 1; nPosition < pBand->nBarCount; nPosition++)
{
if (nOffset < pBand->pBars[nPosition].nOffset)
break;
}
}
}
DockToolBar(hDockBar, hWnd, nBandNum, nPosition, nOffset);
}
void DockToolBar(HWND hDockBar, HWND hWnd, int nBandNum, int nPosition, int nOffset)
{
BarData *pBar;
BandData *pBand;
DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA);
SetParent(hWnd, hDockBar);
if (pData)
{
if (nBandNum >= pData->nBandCount)
{
pData->pBands = realloc(pData->pBands, (pData->nBandCount+1)*sizeof(BandData));
memset(pData->pBands+pData->nBandCount, 0, sizeof(BandData));
nBandNum = pData->nBandCount;
pData->nBandCount++;
}
pBand = &pData->pBands[nBandNum];
if (nPosition >= pBand->nBarCount)
nPosition = pBand->nBarCount;
pBand->pBars = realloc(pBand->pBars, (pBand->nBarCount+1)*sizeof(BarData));
memmove(pBand->pBars+nPosition+1, pBand->pBars+nPosition, (pBand->nBarCount-nPosition)*sizeof(BarData));
pBand->nBarCount++;
pBar = &pBand->pBars[nPosition];
memset(pBar, 0, sizeof(BarData));
pBar->nOffset = nOffset;
pBar->hWnd = hWnd;
RecalcDockBarLayout(pData, GetWindowLong(hWnd, GWL_STYLE) & CCS_VERT);
}
}
void UndockToolBar(HWND hDockBar, HWND hWnd)
{
int i, j;
BarData *pBar;
BandData *pBand;
DockBarData *pData = (DockBarData *) GetWindowLong(hDockBar, GWL_USERDATA);
SetParent(hWnd, NULL);
if (pData)
{
for (i = 0; i < pData->nBandCount; i++)
{
pBand = &pData->pBands[i];
for (j = 0; j < pBand->nBarCount; j++)
{
pBar = &pBand->pBars[j];
if (pBar->hWnd == hWnd)
{
memmove(pBand->pBars+j, pBand->pBars+j+1, (pBand->nBarCount-j-1)*sizeof(BarData));
pBand->pBars = realloc(pBand->pBars, (pBand->nBarCount-1)*sizeof(BarData));
pBand->nBarCount--;
if (pBand->nBarCount == 0)
{
memmove(pData->pBands+i, pData->pBands+i+1, (pData->nBandCount-i-1)*sizeof(BandData));
pData->pBands = realloc(pData->pBands, (pData->nBandCount-1)*sizeof(BandData));
pData->nBandCount--;
}
return;
}
}
}
}
else
{
DestroyWindow(hDockBar);
}
}
--- NEW FILE: DockBar.h ---
#ifndef CONTROLBAR_H
#define CONTROLBAR_H
void RelayoutFrameBars();
void DockToolBar(HWND hControlBar, HWND hWnd, int nBandNum, int nPosition, int nOffset);
void DockToolBarToRect(HWND hControlBar, HWND hWnd, RECT rect);
void UndockToolBar(HWND hControlBar, HWND hWnd);
void GetToolBarSize(HWND hToolBar, SIZE *pSize);
#endif
Index: Frame.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** Frame.c 10 Aug 2003 18:36:04 -0000 1.12
--- Frame.c 15 Aug 2003 16:40:01 -0000 1.13
***************
*** 95,99 ****
}
! pData->hLeftBar = CreateWindow("HCONTROLBAR",
NULL,
WS_CHILD | WS_VISIBLE | CCS_VERT,
--- 95,99 ----
}
! pData->hLeftBar = CreateWindow("HDOCKBAR",
NULL,
WS_CHILD | WS_VISIBLE | CCS_VERT,
***************
*** 103,107 ****
(HANDLE) ghModule,
NULL);
! pData->hTopBar = CreateWindow("HCONTROLBAR",
NULL,
WS_CHILD | WS_VISIBLE,
--- 103,107 ----
(HANDLE) ghModule,
NULL);
! pData->hTopBar = CreateWindow("HDOCKBAR",
NULL,
WS_CHILD | WS_VISIBLE,
***************
*** 111,115 ****
(HANDLE) ghModule,
NULL);
! pData->hRightBar = CreateWindow("HCONTROLBAR",
NULL,
WS_CHILD | WS_VISIBLE | CCS_VERT,
--- 111,115 ----
(HANDLE) ghModule,
NULL);
! pData->hRightBar = CreateWindow("HDOCKBAR",
NULL,
WS_CHILD | WS_VISIBLE | CCS_VERT,
***************
*** 119,123 ****
(HANDLE) ghModule,
NULL);
! pData->hBottomBar= CreateWindow("HCONTROLBAR",
NULL,
WS_CHILD | WS_VISIBLE,
--- 119,123 ----
(HANDLE) ghModule,
NULL);
! pData->hBottomBar= CreateWindow("HDOCKBAR",
NULL,
WS_CHILD | WS_VISIBLE,
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** ToolBar.c 12 Aug 2003 21:10:08 -0000 1.11
--- ToolBar.c 15 Aug 2003 16:40:01 -0000 1.12
***************
*** 1,4 ****
#include "ToolBar.h"
! #include "ControlBar.h"
#include "Internals.h"
#include "Handlers_stub.h"
--- 1,4 ----
#include "ToolBar.h"
! #include "DockBar.h"
#include "Internals.h"
#include "Handlers_stub.h"
***************
*** 366,374 ****
}
! static BOOL CanDockBar(HWND hControlBar, RECT *pRect)
{
RECT rect;
! GetWindowRect(hControlBar, &rect);
if (rect.left == rect.right ) rect.right++;
if (rect.top == rect.bottom) rect.bottom++;
--- 366,374 ----
}
! static BOOL CanDockBar(HWND hDockBar, RECT *pRect)
{
RECT rect;
! GetWindowRect(hDockBar, &rect);
if (rect.left == rect.right ) rect.right++;
if (rect.top == rect.bottom) rect.bottom++;
***************
*** 377,381 ****
}
! static DWORD CanDock(DockContext *pCtxt, HWND *phControlBar)
{
RECT rect;
--- 377,381 ----
}
! static DWORD CanDock(DockContext *pCtxt, HWND *phDockBar)
{
RECT rect;
***************
*** 393,397 ****
if (CanDockBar(pData->hLeftBar, &rect))
{
! if (phControlBar) *phControlBar = pData->hLeftBar;
return VERT;
}
--- 393,397 ----
if (CanDockBar(pData->hLeftBar, &rect))
{
! if (phDockBar) *phDockBar = pData->hLeftBar;
return VERT;
}
***************
*** 399,403 ****
if (CanDockBar(pData->hTopBar, &rect))
{
! if (phControlBar) *phControlBar = pData->hTopBar;
return HORZ;
}
--- 399,403 ----
if (CanDockBar(pData->hTopBar, &rect))
{
! if (phDockBar) *phDockBar = pData->hTopBar;
return HORZ;
}
***************
*** 405,409 ****
if (CanDockBar(pData->hRightBar, &rect))
{
! if (phControlBar) *phControlBar = pData->hRightBar;
return VERT;
}
--- 405,409 ----
if (CanDockBar(pData->hRightBar, &rect))
{
! if (phDockBar) *phDockBar = pData->hRightBar;
return VERT;
}
***************
*** 411,415 ****
if (CanDockBar(pData->hBottomBar, &rect))
{
! if (phControlBar) *phControlBar = pData->hBottomBar;
return HORZ;
}
--- 411,415 ----
if (CanDockBar(pData->hBottomBar, &rect))
{
! if (phDockBar) *phDockBar = pData->hBottomBar;
return HORZ;
}
***************
*** 465,469 ****
RECT rect;
HWND hToolBar;
! HWND hControlBar = NULL;
LONG lStyle;
char *szCaption;
--- 465,469 ----
RECT rect;
HWND hToolBar;
! HWND hDockBar = NULL;
LONG lStyle;
char *szCaption;
***************
*** 473,481 ****
lStyle = GetWindowLong(hToolBar, GWL_USERDATA);
! CanDock(pCtxt, &hControlBar);
// undock the toolbar
UndockToolBar(GetParent(hToolBar), hToolBar);
! if (hControlBar)
{
if (pCtxt->dwOverDockStyle & HORZ)
--- 473,481 ----
lStyle = GetWindowLong(hToolBar, GWL_USERDATA);
! CanDock(pCtxt, &hDockBar);
// undock the toolbar
UndockToolBar(GetParent(hToolBar), hToolBar);
! if (hDockBar)
{
if (pCtxt->dwOverDockStyle & HORZ)
***************
*** 485,493 ****
SetWindowLong(hToolBar, GWL_USERDATA, (lStyle & ~(VERT | HORZ | FLOAT)) | pCtxt->dwOverDockStyle);
! ScreenToClient(hControlBar, ((POINT *) &rect));
! ScreenToClient(hControlBar, ((POINT *) &rect)+1);
// dock it at the specified position
! DockToolBarToRect(hControlBar, hToolBar, rect);
}
else
--- 485,493 ----
SetWindowLong(hToolBar, GWL_USERDATA, (lStyle & ~(VERT | HORZ | FLOAT)) | pCtxt->dwOverDockStyle);
! ScreenToClient(hDockBar, ((POINT *) &rect));
! ScreenToClient(hDockBar, ((POINT *) &rect)+1);
// dock it at the specified position
! DockToolBarToRect(hDockBar, hToolBar, rect);
}
else
***************
*** 511,516 ****
}
! hControlBar = CreateWindowEx(WS_EX_TOOLWINDOW,
! "HCONTROLBAR",
szCaption,
WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SYSMENU | WS_THICKFRAME,
--- 511,516 ----
}
! hDockBar = CreateWindowEx(WS_EX_TOOLWINDOW,
! "HDOCKBAR",
szCaption,
WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SYSMENU | WS_THICKFRAME,
***************
*** 520,525 ****
(HANDLE) ghModule,
NULL);
! SetParent(hToolBar, hControlBar);
! SetWindowPos(hControlBar, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
free(szCaption);
--- 520,525 ----
(HANDLE) ghModule,
NULL);
! SetParent(hToolBar, hDockBar);
! SetWindowPos(hDockBar, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
free(szCaption);
***************
*** 752,756 ****
WindowHandle osCreateToolBar(char *name, DockPlace place, int band_num, int band_position, int offset)
{
! HWND hControlBar, hWnd;
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
LONG lStyle;
--- 752,756 ----
WindowHandle osCreateToolBar(char *name, DockPlace place, int band_num, int band_position, int offset)
{
! HWND hDockBar, hWnd;
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
LONG lStyle;
***************
*** 759,775 ****
{
case DockLeft:
! hControlBar = pFrameData->hLeftBar;
lStyle = VERT;
break;
case DockTop:
! hControlBar = pFrameData->hTopBar;
lStyle = HORZ;
break;
case DockRight:
! hControlBar = pFrameData->hRightBar;
lStyle = VERT;
break;
case DockBottom:
! hControlBar = pFrameData->hBottomBar;
lStyle = HORZ;
break;
--- 759,775 ----
{
case DockLeft:
! hDockBar = pFrameData->hLeftBar;
lStyle = VERT;
break;
case DockTop:
! hDockBar = pFrameData->hTopBar;
lStyle = HORZ;
break;
case DockRight:
! hDockBar = pFrameData->hRightBar;
lStyle = VERT;
break;
case DockBottom:
! hDockBar = pFrameData->hBottomBar;
lStyle = HORZ;
break;
***************
*** 785,789 ****
| TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST,
0,0,0,0,
! hControlBar,
(HMENU) NULL,
(HANDLE) ghModule,
--- 785,789 ----
| TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST,
0,0,0,0,
! hDockBar,
(HMENU) NULL,
(HANDLE) ghModule,
***************
*** 793,797 ****
SendMessage(hWnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
SetWindowText(hWnd, name);
! DockToolBar(hControlBar, hWnd, band_num, band_position, offset);
return hWnd;
}
--- 793,797 ----
SendMessage(hWnd, TB_SETEXTENDEDSTYLE, 0, TBSTYLE_EX_MIXEDBUTTONS);
SetWindowText(hWnd, name);
! DockToolBar(hDockBar, hWnd, band_num, band_position, offset);
return hWnd;
}
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** Util.c 10 Aug 2003 18:36:04 -0000 1.16
--- Util.c 15 Aug 2003 16:40:01 -0000 1.17
***************
*** 33,37 ****
extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
! extern LRESULT CALLBACK HControlBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HToolBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
--- 33,37 ----
extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
! extern LRESULT CALLBACK HDockBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HToolBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
***************
*** 112,118 ****
RegisterClass(&wc);
! // ControlBar class
wc.style = CS_DBLCLKS;
! wc.lpfnWndProc = HControlBarFunction;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
--- 112,118 ----
RegisterClass(&wc);
! // DockBar class
wc.style = CS_DBLCLKS;
! wc.lpfnWndProc = HDockBarFunction;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
***************
*** 122,126 ****
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wc.lpszMenuName = NULL;
! wc.lpszClassName = "HCONTROLBAR";
RegisterClass(&wc);
--- 122,126 ----
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
wc.lpszMenuName = NULL;
! wc.lpszClassName = "HDOCKBAR";
RegisterClass(&wc);
--- ControlBar.c DELETED ---
--- ControlBar.h DELETED ---
|
|
From: <kr_...@us...> - 2003-08-15 21:34:51
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv21732 Modified Files: makefile Log Message: Rename ControlBar to DockBar Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** makefile 13 Aug 2003 19:36:16 -0000 1.27 --- makefile 15 Aug 2003 16:44:27 -0000 1.28 *************** *** 51,55 **** ifeq "$(GUILIB)" "WIN32" ! CSRCS += MenuHandlesMap.c ControlBar.c endif --- 51,55 ---- ifeq "$(GUILIB)" "WIN32" ! CSRCS += MenuHandlesMap.c DockBar.c endif |
|
From: <kr_...@us...> - 2003-08-15 21:26:05
|
Update of /cvsroot/htoolkit/gio/src/examples/worm
In directory sc8-pr-cvs1:/tmp/cvs-serv11074/gio/src/examples/worm
Modified Files:
Main.hs
Log Message:
Simplified API for MenuRadioItems
Index: Main.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/worm/Main.hs,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** Main.hs 16 Jul 2003 22:22:00 -0000 1.7
--- Main.hs 15 Aug 2003 21:24:55 -0000 1.8
***************
*** 34,47 ****
-- Options menu
mopts <- menu [title =: "Options"] mainMenu
! mspeed <- menuRadioGroup [] mopts
! menuRadioItem [title =: "Slow"
! ,on command =: onSetSpeed ref easySpeed
! ] mspeed
! menuRadioItem [title =: "Medium"
! , on command =: onSetSpeed ref mediumSpeed
! ] mspeed
! menuRadioItem [title =: "Fast"
! ,on command =: onSetSpeed ref hardSpeed
! ] mspeed
menuline mopts
menuitem [title =: "High Scores"
--- 34,50 ----
-- Options menu
mopts <- menu [title =: "Options"] mainMenu
! mSlow <- menuRadioItem
! [ title =: "Slow"
! , on command =: onSetSpeed ref easySpeed
! ] mopts
! mMedium <- menuRadioItem
! [ title =: "Medium"
! , on command =: onSetSpeed ref mediumSpeed
! ] mopts
! mFast <- menuRadioItem
! [ title =: "Fast"
! , on command =: onSetSpeed ref hardSpeed
! ] mopts
! setMenuRadioGroup [mSlow, mMedium, mFast]
menuline mopts
menuitem [title =: "High Scores"
|
|
From: <kr_...@us...> - 2003-08-15 21:26:04
|
Update of /cvsroot/htoolkit/gio/src/examples/simple
In directory sc8-pr-cvs1:/tmp/cvs-serv11074/gio/src/examples/simple
Modified Files:
Hanoi.hs SimpleMenu.hs
Log Message:
Simplified API for MenuRadioItems
Index: Hanoi.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/Hanoi.hs,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Hanoi.hs 13 Jul 2003 18:25:58 -0000 1.2
--- Hanoi.hs 15 Aug 2003 21:24:54 -0000 1.3
***************
*** 34,49 ****
mhanoi <- menu [title =: "&Hanoi"] mainMenu
mrun <- menu [title =: "&Run (nr disks)"] mhanoi
! rg1 <- menuRadioGroup [] mrun
! sequence [menuRadioItem [title =: show i, on command =: onRun i mrun mcont mhalt t w ref] rg1
! | i <- [minDisks..maxDisks]]
mhalt <- menuitem [title =: "Halt", accel =: KeyChar '.', enabled =: False, on command =: onHalt mrun mcont mhalt t] mhanoi
mcont <- menuitem [title =: "Continue", accel =: KeyChar ',', enabled =: False, on command =: onCont mrun mcont mhalt t] mhanoi
! mspeed <- menu [title =: "&Speed"] mhanoi
! rg2 <- menuRadioGroup [] mspeed
! menuRadioItem [title =: "V&ery Slow", accel =: KeyChar '\^A', on command =: onSetSpeed speed1 t] rg2
! menuRadioItem [title =: "&Slow", accel =: KeyChar '\^S', on command =: onSetSpeed speed2 t] rg2
! menuRadioItem [title =: "&Normal", accel =: KeyChar '\^D', on command =: onSetSpeed speed3 t] rg2
! menuRadioItem [title =: "&Fast", accel =: KeyChar '\^F', on command =: onSetSpeed speed4 t] rg2
! menuRadioItem [title =: "&Very Fast", accel =: KeyChar '\^G', on command =: onSetSpeed speed5 t] rg2
menuline mhanoi
menuitem [title =: "E&xit", on command =: halt] mhanoi
--- 34,48 ----
mhanoi <- menu [title =: "&Hanoi"] mainMenu
mrun <- menu [title =: "&Run (nr disks)"] mhanoi
! sequence [menuRadioItem [title =: show i, on command =: onRun i mrun mcont mhalt t w ref] mrun
! | i <- [minDisks..maxDisks]] >>= setMenuRadioGroup
mhalt <- menuitem [title =: "Halt", accel =: KeyChar '.', enabled =: False, on command =: onHalt mrun mcont mhalt t] mhanoi
mcont <- menuitem [title =: "Continue", accel =: KeyChar ',', enabled =: False, on command =: onCont mrun mcont mhalt t] mhanoi
! mspeed <- menu [title =: "&Speed"] mhanoi
! mVerySlow <- menuRadioItem [title =: "V&ery Slow", accel =: KeyChar '\^A', on command =: onSetSpeed speed1 t] mspeed
! mSlow <- menuRadioItem [title =: "&Slow", accel =: KeyChar '\^S', on command =: onSetSpeed speed2 t] mspeed
! mNormal <- menuRadioItem [title =: "&Normal", accel =: KeyChar '\^D', on command =: onSetSpeed speed3 t] mspeed
! mFast <- menuRadioItem [title =: "&Fast", accel =: KeyChar '\^F', on command =: onSetSpeed speed4 t] mspeed
! mVeryFast <- menuRadioItem [title =: "&Very Fast", accel =: KeyChar '\^G', on command =: onSetSpeed speed5 t] mspeed
! setMenuRadioGroup [mVerySlow,mSlow,mNormal,mFast,mVeryFast]
menuline mhanoi
menuitem [title =: "E&xit", on command =: halt] mhanoi
Index: SimpleMenu.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/examples/simple/SimpleMenu.hs,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** SimpleMenu.hs 12 Jul 2003 08:08:49 -0000 1.8
--- SimpleMenu.hs 15 Aug 2003 21:24:54 -0000 1.9
***************
*** 32,43 ****
menuitem [title =: "&Exit", on command =: halt] fm
! cm <- menu [title =: "&Color"] mainMenu
! tgl <- menucheck [title =: "&Transparent", accel =: KeyChar '\^T'] cm
! set tgl [on command =: onToggleTransparent tgl]
! menuline cm
! rg <- menuRadioGroup [] cm
! menuRadioItem [title =: "&Red", on command =: messageAlert "RED COLOR" ] rg
! menuRadioItem [title =: "&Green", on command =: messageAlert "GREEN COLOR"] rg
! menuRadioItem [title =: "&Blue", on command =: messageAlert "BLUE COLOR" ] rg
where
onToggleTransparent tgl = do
--- 32,42 ----
menuitem [title =: "&Exit", on command =: halt] fm
! mColor <- menu [title =: "&Color"] mainMenu
! menucheck [title =: "&Transparent", accel =: KeyChar '\^T', on command =:: onToggleTransparent] mColor
! menuline mColor
! mRed <- menuRadioItem [title =: "&Red", on command =: messageAlert "RED COLOR" ] mColor
! mGreen <- menuRadioItem [title =: "&Green", on command =: messageAlert "GREEN COLOR"] mColor
! mBlue <- menuRadioItem [title =: "&Blue", on command =: messageAlert "BLUE COLOR" ] mColor
! setMenuRadioGroup [mRed, mGreen, mBlue]
where
onToggleTransparent tgl = do
|
|
From: <kr_...@us...> - 2003-08-15 21:26:04
|
Update of /cvsroot/htoolkit/port/src/Port
In directory sc8-pr-cvs1:/tmp/cvs-serv11074/port/src/Port
Modified Files:
Menu.hs
Log Message:
Simplified API for MenuRadioItems
Index: Menu.hs
===================================================================
RCS file: /cvsroot/htoolkit/port/src/Port/Menu.hs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Menu.hs 17 Jul 2003 19:30:03 -0000 1.9
--- Menu.hs 15 Aug 2003 21:24:54 -0000 1.10
***************
*** 22,34 ****
, insertMenuItem
, insertMenuSeparatorItem
! , insertMenuCheckItem
, setMenuItemAccel, getMenuItemAccel
, setMenuItemEnabled, getMenuItemEnabled
, setMenuItemChecked, getMenuItemChecked
! , setMenuItemBitmap, getMenuItemBitmap
! -- * Radio groups and radio items
! , insertMenuRadioGroup
! , insertMenuRadioItem
! , setMenuRadioGroupSelection, getMenuRadioGroupSelection
-- * Common functions
, destroyMenu
--- 22,32 ----
, insertMenuItem
, insertMenuSeparatorItem
! , insertMenuCheckItem
! , insertMenuRadioItem
! , setMenuRadioGroup
, setMenuItemAccel, getMenuItemAccel
, setMenuItemEnabled, getMenuItemEnabled
, setMenuItemChecked, getMenuItemChecked
! , setMenuItemBitmap, getMenuItemBitmap
-- * Common functions
, destroyMenu
***************
*** 70,76 ****
-----------------------------------------------------------------------------------------
! -- | Add a menu item. Use a null character ('keyNull') if no
! -- short-cut key should be registered. An event handler for a menu item can be
! -- installed with 'registerMenuCommand'.
insertMenuItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuItem handle pos = osInsertMenuItem handle (fromMaybe (-1) pos)
--- 68,73 ----
-----------------------------------------------------------------------------------------
! -- | Add a menu item. An event handler for a menu item can be
! -- installed with 'setMenuCommandHandler'.
insertMenuItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuItem handle pos = osInsertMenuItem handle (fromMaybe (-1) pos)
***************
*** 78,86 ****
-- | Add a checkable menu item. An event handler for a menu item can be
! -- installed with 'registerMenuCommand'.
insertMenuCheckItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuCheckItem handle pos = osInsertMenuCheckItem handle (fromMaybe (-1) pos)
foreign import ccall osInsertMenuCheckItem :: MenuHandle -> Int -> IO MenuHandle
-- | Add a menu item separator line.
insertMenuSeparatorItem :: MenuHandle -> Maybe Int -> IO MenuHandle
--- 75,93 ----
-- | Add a checkable menu item. An event handler for a menu item can be
! -- installed with 'setMenuCommandHandler'.
insertMenuCheckItem :: MenuHandle -> Maybe Int -> IO MenuHandle
insertMenuCheckItem handle pos = osInsertMenuCheckItem handle (fromMaybe (-1) pos)
foreign import ccall osInsertMenuCheckItem :: MenuHandle -> Int -> IO MenuHandle
+ -- | Add a menu radio item. . An event handler for a menu item can be
+ -- installed with 'setMenuCommandHandler'.
+ insertMenuRadioItem :: MenuHandle -> Maybe Int -> IO MenuHandle
+ insertMenuRadioItem handle pos = osInsertMenuRadioItem handle (fromMaybe (-1) pos)
+ foreign import ccall osInsertMenuRadioItem :: MenuHandle -> Int -> IO MenuHandle
+
+ setMenuRadioGroup :: [MenuHandle] -> IO ()
+ setMenuRadioGroup handles = withArray0 nullHandle handles osSetMenuRadioGroup
+ foreign import ccall osSetMenuRadioGroup :: Ptr MenuHandle -> IO ()
+
-- | Add a menu item separator line.
insertMenuSeparatorItem :: MenuHandle -> Maybe Int -> IO MenuHandle
***************
*** 131,154 ****
map <- readMVar menuBitmaps
return (PtrMap.lookup hmenu map)
-
- -----------------------------------------------------------------------------------------
- -- Radio groups and radio items
- -----------------------------------------------------------------------------------------
-
- -- | Add a radio group to the menu.
- insertMenuRadioGroup :: MenuHandle -> Maybe Int -> IO MenuHandle
- insertMenuRadioGroup handle pos = osInsertMenuRadioGroup handle (fromMaybe (-1) pos)
- foreign import ccall osInsertMenuRadioGroup :: MenuHandle -> Int -> IO MenuHandle
-
- -- | Add a menu radio item to the radio group.
- insertMenuRadioItem :: MenuHandle -> Maybe Int -> IO MenuHandle
- insertMenuRadioItem handle pos = osInsertMenuRadioItem handle (fromMaybe (-1) pos)
- foreign import ccall osInsertMenuRadioItem :: MenuHandle -> Int -> IO MenuHandle
-
- -- | Select an active item in the radio group.
- foreign import ccall "osSetMenuRadioGroupSelection" setMenuRadioGroupSelection :: MenuHandle -> Int -> IO ()
-
- -- | returns an index of the currently selected radio item.
- foreign import ccall "osGetMenuRadioGroupSelection" getMenuRadioGroupSelection :: MenuHandle -> IO Int
-----------------------------------------------------------------------------------------
--- 138,141 ----
|
|
From: <kr_...@us...> - 2003-08-15 21:25:22
|
Update of /cvsroot/htoolkit/port/src/include In directory sc8-pr-cvs1:/tmp/cvs-serv11074/port/src/include Modified Files: Menu.h Log Message: Simplified API for MenuRadioItems Index: Menu.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/include/Menu.h,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Menu.h 23 Apr 2003 21:48:57 -0000 1.6 --- Menu.h 15 Aug 2003 21:24:54 -0000 1.7 *************** *** 8,14 **** MenuHandle osInsertMenuCheckItem(MenuHandle parent, int pos); MenuHandle osInsertMenuSeparatorItem(MenuHandle parent, int pos); - MenuHandle osInsertMenuRadioGroup(MenuHandle parent, int pos); MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos); void osDestroyMenu(MenuHandle handle); --- 8,15 ---- MenuHandle osInsertMenuCheckItem(MenuHandle parent, int pos); MenuHandle osInsertMenuSeparatorItem(MenuHandle parent, int pos); MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos); + void osSetMenuRadioGroup(MenuHandle *handles); + void osDestroyMenu(MenuHandle handle); *************** *** 19,24 **** void osSetMenuItemChecked(MenuHandle item, BOOL bState); BOOL osGetMenuItemChecked(MenuHandle item); - void osSetMenuRadioGroupSelection(MenuHandle handle, int selection); - int osGetMenuRadioGroupSelection(MenuHandle handle); void osSetMenuLabel(MenuHandle item, char* title); --- 20,23 ---- |
|
From: <kr_...@us...> - 2003-08-15 21:25:22
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv11074/port/src/cbits/Win32
Modified Files:
Frame.c Menu.c MenuHandlesMap.c MenuHandlesMap.h Window.c
Log Message:
Simplified API for MenuRadioItems
Index: Frame.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** Frame.c 15 Aug 2003 16:40:01 -0000 1.13
--- Frame.c 15 Aug 2003 21:24:54 -0000 1.14
***************
*** 1,4 ****
--- 1,6 ----
#include "Types.h"
#include "Window.h"
+ #include "Menu.h"
+ #include "DockBar.h"
#include "MenuHandlesMap.h"
#include "Canvas.h"
***************
*** 21,25 ****
LRESULT CALLBACK HFrameSharedFunction(int DocumentInterface, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! int pos, ppos;
HMENU hParent;
MENUITEMINFO mii;
--- 23,27 ----
LRESULT CALLBACK HFrameSharedFunction(int DocumentInterface, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! int pos;
HMENU hParent;
MENUITEMINFO mii;
***************
*** 140,163 ****
if (handle)
{
! hParent = getParentHMENU(handle);
! pos = getMenuPos(pData->pMenuHandlesMap, handle);
!
! mii.cbSize = sizeof(mii);
! mii.fMask = MIIM_STATE;
! GetMenuItemInfo(hParent, pos, TRUE, &mii);
!
! switch (handle->type)
! {
! case MENU_RADIO_ITEM:
! ppos = getMenuPos(pData->pMenuHandlesMap, handle->parent);
! CheckMenuRadioItem(hParent, ppos, ppos+getChildrenCount(pData->pMenuHandlesMap, handle->parent)-1, pos, MF_BYPOSITION);
! break;
! case MENU_CHECK_ITEM:
! CheckMenuItem(hParent, pos, ((mii.fState & MFS_CHECKED) ? MF_UNCHECKED : MF_CHECKED) | MF_BYPOSITION);
! break;
! default:
! }
!
! handleMenuCommand(handle);
}
}
--- 142,148 ----
if (handle)
{
! if (handle->type & (MENU_RADIO_ITEM | MENU_CHECK_ITEM))
! osSetMenuItemChecked(handle, TRUE);
! handleMenuCommand(handle);
}
}
Index: Menu.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Menu.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Menu.c 23 Jul 2003 16:25:21 -0000 1.11
--- Menu.c 15 Aug 2003 21:24:54 -0000 1.12
***************
*** 182,202 ****
}
- MenuHandle osInsertMenuRadioGroup(MenuHandle parent, int pos)
- {
- FrameData *pFrameData;
-
- CHECK_MENU_TYPE(parent, MENU_POPUP, NULL);
-
- pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
-
- return newMenuHandle(pFrameData->pMenuHandlesMap, parent, MENU_RADIO_GROUP, pos);
- };
-
MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos)
{
MenuHandle handle;
FrameData *pFrameData;
! CHECK_MENU_TYPE(parent, MENU_RADIO_GROUP, NULL);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
--- 182,192 ----
}
MenuHandle osInsertMenuRadioItem(MenuHandle parent, int pos)
{
MenuHandle handle;
FrameData *pFrameData;
+ MENUITEMINFO mii;
! CHECK_MENU_TYPE(parent, MENU_POPUP, NULL);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
***************
*** 205,209 ****
if (handle)
{
! InsertMenu(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),MF_BYPOSITION | MF_STRING,handle->id,"");
updateMenuBar(parent);
}
--- 195,204 ----
if (handle)
{
! mii.cbSize = sizeof(mii);
! mii.fMask = MIIM_ID | MIIM_STATE | MIIM_TYPE;
! mii.wID = handle->id;
! mii.fState = MFS_ENABLED;
! mii.fType = MFT_RADIOCHECK;
! InsertMenuItem(getParentHMENU(handle),getMenuPos(pFrameData->pMenuHandlesMap, handle),TRUE,&mii);
updateMenuBar(parent);
}
***************
*** 212,236 ****
};
void osDestroyMenu(MenuHandle handle)
{
- int pos, count;
- HMENU hParent;
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
notifyHandleForDestroy(handle);
!
! hParent = getParentHMENU(handle);
! pos = getMenuPos(pFrameData->pMenuHandlesMap, handle);
!
! if (handle->type != MENU_RADIO_GROUP)
! DeleteMenu(hParent, pos, MF_BYPOSITION);
! else
! {
! count = getChildrenCount(pFrameData->pMenuHandlesMap, handle);
! while (count--)
! DeleteMenu(hParent, pos, MF_BYPOSITION);
! }
!
deleteMenuHandle(pFrameData->pMenuHandlesMap, handle);
updateMenuBar(handle->parent);
}
--- 207,244 ----
};
+ void osSetMenuRadioGroup(MenuHandle *handles)
+ {
+ MenuHandle child, handle, *phandle;
+
+ phandle=handles;
+ for (;;)
+ {
+ handle = *phandle;
+
+ child = handle->nextInGroup;
+ while (child->nextInGroup != handle)
+ child = child->nextInGroup;
+ child->nextInGroup = handle->nextInGroup;
+
+ phandle++;
+ if (*phandle)
+ handle->nextInGroup = *phandle;
+ else
+ {
+ handle->nextInGroup = *handles;
+ break;
+ }
+ }
+ }
+
void osDestroyMenu(MenuHandle handle)
{
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
notifyHandleForDestroy(handle);
!
! DeleteMenu(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), MF_BYPOSITION);
deleteMenuHandle(pFrameData->pMenuHandlesMap, handle);
+
updateMenuBar(handle->parent);
}
***************
*** 240,244 ****
FrameData *pFrameData;
! CHECK_MENU_TYPE(handle, MENU_RADIO_GROUP | MENU_POPUP, 0);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
--- 248,252 ----
FrameData *pFrameData;
! CHECK_MENU_TYPE(handle, MENU_POPUP, 0);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
***************
*** 277,286 ****
{
FrameData *pFrameData;
! CHECK_MENU_TYPE_V(handle, MENU_CHECK_ITEM);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
! CheckMenuItem(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), (bState ? MF_CHECKED : MF_UNCHECKED) | MF_BYPOSITION);
updateMenuBar(handle->parent);
--- 285,308 ----
{
FrameData *pFrameData;
+ MenuHandle child;
! CHECK_MENU_TYPE_V(handle, MENU_CHECK_ITEM | MENU_RADIO_ITEM);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
! if (bState)
! {
! child = handle->nextInGroup;
! while (child != handle)
! {
! CheckMenuItem(getParentHMENU(child), getMenuPos(pFrameData->pMenuHandlesMap, child), MF_UNCHECKED | MF_BYPOSITION);
! child = child->nextInGroup;
! }
!
! CheckMenuItem(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), MF_CHECKED | MF_BYPOSITION);
! }
! else
! CheckMenuItem(getParentHMENU(handle), getMenuPos(pFrameData->pMenuHandlesMap, handle), MF_UNCHECKED | MF_BYPOSITION);
!
updateMenuBar(handle->parent);
***************
*** 293,297 ****
FrameData *pFrameData;
! CHECK_MENU_TYPE(handle, MENU_CHECK_ITEM, FALSE);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
--- 315,319 ----
FrameData *pFrameData;
! CHECK_MENU_TYPE(handle, MENU_CHECK_ITEM | MENU_RADIO_ITEM, FALSE);
pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
***************
*** 303,359 ****
}
- void osSetMenuRadioGroupSelection(MenuHandle handle, int index)
- {
- int pos;
- HMENU hParent;
- FrameData *pFrameData;
- MenuHandle child;
-
- CHECK_MENU_TYPE_V(handle, MENU_RADIO_GROUP);
-
- pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
- hParent = getParentHMENU(handle);
- pos = getMenuPos(pFrameData->pMenuHandlesMap, handle);
- child = getNthChild(pFrameData->pMenuHandlesMap, handle, index);
-
- if (!child) return;
-
- CheckMenuRadioItem(hParent, pos, pos+getChildrenCount(pFrameData->pMenuHandlesMap, handle)-1, pos+index, MF_BYPOSITION);
- updateMenuBar(handle->parent);
-
- handleMenuCommand(child);
- }
-
- int osGetMenuRadioGroupSelection(MenuHandle handle)
- {
- HMENU hParent;
- int pos, index;
- MenuHandle child;
- FrameData *pFrameData;
-
- CHECK_MENU_TYPE(handle, MENU_RADIO_GROUP, -1);
-
- pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
- hParent = getParentHMENU(handle);
- pos = getMenuPos(pFrameData->pMenuHandlesMap, handle);
-
- index = 0;
- child = handle->children;
- while (child)
- {
- MENUITEMINFO mii;
- mii.cbSize = sizeof(mii);
- mii.fMask = MIIM_STATE;
- GetMenuItemInfo(hParent, pos+index, TRUE, &mii);
- if (mii.fState & MFT_RADIOCHECK)
- return index;
-
- index++;
- child = child->sibling;
- }
-
- return index;
- }
-
char *osGetMenuLabel(MenuHandle handle)
{
--- 325,328 ----
***************
*** 513,516 ****
{
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
! return getMenuIndex(pFrameData->pMenuHandlesMap, handle);
}
--- 482,485 ----
{
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
! return getMenuPos(pFrameData->pMenuHandlesMap, handle);
}
Index: MenuHandlesMap.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/MenuHandlesMap.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** MenuHandlesMap.c 23 Apr 2003 21:48:53 -0000 1.1
--- MenuHandlesMap.c 15 Aug 2003 21:24:54 -0000 1.2
***************
*** 83,86 ****
--- 83,87 ----
handle->type = type;
handle->hMenu = NULL;
+ handle->nextInGroup = handle;
if (parent)
***************
*** 167,170 ****
--- 168,176 ----
}
+ child = handle->nextInGroup;
+ while (child->nextInGroup != handle)
+ child = child->nextInGroup;
+ child->nextInGroup = handle->nextInGroup;
+
handle->next = pMap->pFreeList;
pMap->pFreeList = handle;
***************
*** 287,361 ****
};
! static BOOL getMenuPosEx(MenuHandle firstSibling, MenuHandle handle, int *pos)
{
MenuHandle h;
! h = firstSibling;
! while (h)
{
! if (h == handle)
! return TRUE;
!
! if (h->type != MENU_RADIO_GROUP)
! *pos += 1;
! else
! {
! if (getMenuPosEx(h->children, handle, pos))
! return TRUE;
! }
!
h = h->sibling;
}
-
- return FALSE;
- };
-
- int getMenuPos(MenuHandlesMap *pMap, MenuHandle handle)
- {
- int pos;
- MenuHandle parent;
-
- parent = handle->parent;
- while (parent && parent->hMenu == NULL)
- parent = parent->parent;
-
- pos = 0;
- if (!getMenuPosEx(parent ? parent->children : pMap->children, handle, &pos))
- return -1;
return pos;
};
- int getMenuIndex(MenuHandlesMap *pMap, MenuHandle handle)
- {
- int index;
- MenuHandle child;
-
- index = 0;
- child = handle->parent ? handle->parent->children : pMap->children;
- while (child)
- {
- if (child == handle)
- break;
-
- index += 1;
- child = child->sibling;
- }
-
- return index;
- };
-
HMENU getParentHMENU(MenuHandle handle)
{
! MenuHandle parent;
!
! parent = handle->parent;
! while (parent && parent->hMenu == NULL)
! parent = parent->parent;
!
! if (parent == NULL)
return GetMenu(ghWndFrame);
else
! return parent->hMenu;
}
--- 293,318 ----
};
! int getMenuPos(MenuHandlesMap *pMap, MenuHandle handle)
{
+ int pos;
MenuHandle h;
! pos = 0;
! h = handle->parent ? handle->parent->children : pMap->children;
! while (h && h != handle)
{
! pos++;
h = h->sibling;
}
return pos;
};
HMENU getParentHMENU(MenuHandle handle)
{
! if (handle->parent == NULL)
return GetMenu(ghWndFrame);
else
! return handle->parent->hMenu;
}
Index: MenuHandlesMap.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/MenuHandlesMap.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** MenuHandlesMap.h 23 Jul 2003 16:25:21 -0000 1.2
--- MenuHandlesMap.h 15 Aug 2003 21:24:54 -0000 1.3
***************
*** 12,17 ****
, MENU_POPUP = 4
, MENU_CHECK_ITEM = 8
! , MENU_RADIO_GROUP = 16
! , MENU_RADIO_ITEM = 32
};
--- 12,16 ----
, MENU_POPUP = 4
, MENU_CHECK_ITEM = 8
! , MENU_RADIO_ITEM = 16
};
***************
*** 24,27 ****
--- 23,27 ----
struct MenuHandle *children;
struct MenuHandle *sibling;
+ struct MenuHandle *nextInGroup;
UINT id;
***************
*** 55,59 ****
MenuHandle getMenuHandle(MenuHandlesMap *pMap, UINT id);
int getMenuPos(MenuHandlesMap *pMap, MenuHandle handle);
- int getMenuIndex(MenuHandlesMap *pMap, MenuHandle handle);
void updateAccelTable(MenuHandlesMap *pMap, MenuHandle item, int key, unsigned int mods);
HACCEL getAccelTableFromMap(MenuHandlesMap *pMap);
--- 55,58 ----
Index: Window.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Window.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** Window.c 15 Jul 2003 19:00:30 -0000 1.36
--- Window.c 15 Aug 2003 21:24:54 -0000 1.37
***************
*** 1,3 ****
--- 1,4 ----
#include "Window.h"
+ #include "Menu.h"
#include "Internals.h"
#include "Handlers_stub.h"
***************
*** 186,192 ****
else
{
- int pos, ppos;
- HMENU hParent;
- MENUITEMINFO mii;
FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
MenuHandle handle = getMenuHandle(pData->pMenuHandlesMap, (UINT) LOWORD(wParam));
--- 187,190 ----
***************
*** 194,220 ****
if (handle)
{
! hParent = getParentHMENU(handle);
! pos = getMenuPos(pData->pMenuHandlesMap, handle);
!
! mii.cbSize = sizeof(mii);
! mii.fMask = MIIM_STATE;
! GetMenuItemInfo(hParent, pos, TRUE, &mii);
!
! if ((mii.fState & MFS_DISABLED) == 0)
! {
! switch (handle->type)
! {
! case MENU_RADIO_ITEM:
! ppos = getMenuPos(pData->pMenuHandlesMap, handle->parent);
! CheckMenuRadioItem(hParent, ppos, ppos+getChildrenCount(pData->pMenuHandlesMap, handle->parent)-1, pos, MF_BYPOSITION);
! break;
! case MENU_CHECK_ITEM:
! CheckMenuItem(hParent, pos, ((mii.fState & MFS_CHECKED) ? MF_UNCHECKED : MF_CHECKED) | MF_BYPOSITION);
! break;
! default:
! }
!
! handleMenuCommand(handle);
! }
}
}
--- 192,198 ----
if (handle)
{
! if (handle->type & (MENU_RADIO_ITEM | MENU_CHECK_ITEM))
! osSetMenuItemChecked(handle, TRUE);
! handleMenuCommand(handle);
}
}
|
|
From: <kr_...@us...> - 2003-08-15 21:25:22
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv11074/gio/src/Graphics/UI/GIO
Modified Files:
Menu.hs
Log Message:
Simplified API for MenuRadioItems
Index: Menu.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/Menu.hs,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** Menu.hs 17 Jul 2003 19:30:05 -0000 1.9
--- Menu.hs 15 Aug 2003 21:24:54 -0000 1.10
***************
*** 19,25 ****
-- ** Checked menu items
, MenuCheck, menucheck, menucheckAt
! -- ** Radio group and radio items
! , MenuRadioGroup, menuRadioGroupAt, menuRadioGroup
, MenuRadioItem, menuRadioItemAt, menuRadioItem
-- ** Menu separator
, MenuLine, menuline, menulineAt
--- 19,25 ----
-- ** Checked menu items
, MenuCheck, menucheck, menucheckAt
! -- ** Radio items
, MenuRadioItem, menuRadioItemAt, menuRadioItem
+ , setMenuRadioGroup
-- ** Menu separator
, MenuLine, menuline, menulineAt
***************
*** 119,158 ****
--------------------------------------------------------------------
! -- Menu radio groups and radio items
--------------------------------------------------------------------
- -- | Menu items are labeled entries in a menu.
- newtype MenuRadioGroup = MenuRadioGroup MenuHandle
- hradiogroup (MenuRadioGroup h) = h
-
- -- | Create a menu item and insert it at specified position.
- menuRadioGroupAt :: Maybe Int -> [Prop MenuRadioGroup] -> Menu -> IO MenuRadioGroup
- menuRadioGroupAt pos props menu
- = do mradiogroup <- do hradiogroup <- Lib.insertMenuRadioGroup (hmenu menu) pos
- return (MenuRadioGroup hradiogroup)
- set mradiogroup props
- return mradiogroup
-
- -- | Create a menu item and appends it to parent menu.
- menuRadioGroup :: [Prop MenuRadioGroup] -> Menu -> IO MenuRadioGroup
- menuRadioGroup = menuRadioGroupAt Nothing
-
- instance Positioned MenuRadioGroup where
- pos = readAttr "pos" (Lib.getMenuItemPos . hradiogroup)
-
- instance Deadly MenuRadioGroup where
- destroyWidget m = Lib.destroyMenu (hradiogroup m)
- destroy = newEvent (Lib.getMenuDestroyHandler . hradiogroup) (Lib.setMenuDestroyHandler . hradiogroup) (Lib.setMenuDestroyDefHandler . hradiogroup)
-
- instance SingleSelect MenuRadioGroup where
- selected = newAttr (Lib.getMenuRadioGroupSelection . hradiogroup) (Lib.setMenuRadioGroupSelection . hradiogroup)
! -- | Menu items are labeled entries in a menu.
newtype MenuRadioItem = MenuRadioItem MenuHandle
hradioitem (MenuRadioItem h) = h
-- | Create a menu item and insert it at specified position.
! menuRadioItemAt :: Maybe Int -> [Prop MenuRadioItem] -> MenuRadioGroup -> IO MenuRadioItem
! menuRadioItemAt pos props group
! = do mradioitem <- do hradioitem <- Lib.insertMenuRadioItem (hradiogroup group) pos
return (MenuRadioItem hradioitem)
set mradioitem props
--- 119,133 ----
--------------------------------------------------------------------
! -- Menu radio items
--------------------------------------------------------------------
! -- | Radio menu items are labeled entries in a menu.
newtype MenuRadioItem = MenuRadioItem MenuHandle
hradioitem (MenuRadioItem h) = h
-- | Create a menu item and insert it at specified position.
! menuRadioItemAt :: Maybe Int -> [Prop MenuRadioItem] -> Menu -> IO MenuRadioItem
! menuRadioItemAt pos props menu
! = do mradioitem <- do hradioitem <- Lib.insertMenuRadioItem (hmenu menu) pos
return (MenuRadioItem hradioitem)
set mradioitem props
***************
*** 160,164 ****
-- | Create a menu item and appends it to parent menu.
! menuRadioItem :: [Prop MenuRadioItem] -> MenuRadioGroup -> IO MenuRadioItem
menuRadioItem = menuRadioItemAt Nothing
--- 135,139 ----
-- | Create a menu item and appends it to parent menu.
! menuRadioItem :: [Prop MenuRadioItem] -> Menu -> IO MenuRadioItem
menuRadioItem = menuRadioItemAt Nothing
***************
*** 174,177 ****
--- 149,155 ----
instance Positioned MenuRadioItem where
pos = readAttr "pos" (Lib.getMenuItemPos . hradioitem)
+
+ instance Checked MenuRadioItem where
+ checked = newAttr (Lib.getMenuItemChecked . hradioitem) (Lib.setMenuItemChecked . hradioitem)
instance Deadly MenuRadioItem where
***************
*** 184,187 ****
--- 162,168 ----
instance Accelerated MenuRadioItem where
accel = newAttr (Lib.getMenuItemAccel . hradioitem) (Lib.setMenuItemAccel . hradioitem)
+
+ setMenuRadioGroup :: [MenuRadioItem] -> IO ()
+ setMenuRadioGroup items = Lib.setMenuRadioGroup (map hradioitem items)
--------------------------------------------------------------------
|
|
From: <kr_...@us...> - 2003-08-15 20:53:00
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv2885/src/cbits/Win32 Modified Files: DockBar.h Log Message: Rename ControlBar to DockBar Index: DockBar.h =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/DockBar.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** DockBar.h 15 Aug 2003 16:40:01 -0000 1.1 --- DockBar.h 15 Aug 2003 20:48:21 -0000 1.2 *************** *** 1,4 **** ! #ifndef CONTROLBAR_H ! #define CONTROLBAR_H void RelayoutFrameBars(); --- 1,4 ---- ! #ifndef DOCKBAR_H ! #define DOCKBAR_H void RelayoutFrameBars(); |
|
From: <kr_...@us...> - 2003-08-15 19:26:25
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv12165 Modified Files: makefile Log Message: bugfix Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.28 retrieving revision 1.29 diff -C2 -d -r1.28 -r1.29 *** makefile 15 Aug 2003 16:44:27 -0000 1.28 --- makefile 15 Aug 2003 18:44:11 -0000 1.29 *************** *** 115,119 **** HOBJS = $(patsubst %.hs,$(HOUTDIR)/%.o, $(HSRCS)) HDEPS = $(patsubst %.hs,$(HOUTDIR)/%.d, $(HSRCS)) - HHIS = $(patsubst %.hs,$(HOUTDIR)/%.hi, $(HSRCS)) COBJS = $(patsubst %.c,$(COUTDIR)/%.c.o, $(CSRCS)) --- 115,118 ---- *************** *** 141,145 **** install -d $(LIBDIR)/doc/html/port install -m 644 src/include/HsPort.h $(LIBDIR)/include/port ! install -m 644 $(HHIS) $(LIBDIR)/imports/Graphics/UI install -m 644 $(MAINLIB) $(LIBDIR) install -m 644 src/include/HsPort.h $(LIBDIR)/include --- 140,145 ---- install -d $(LIBDIR)/doc/html/port install -m 644 src/include/HsPort.h $(LIBDIR)/include/port ! install -m 644 $(HOUTDIR)/*.hi $(LIBDIR)/imports/Graphics/UI ! install -m 644 $(HOUTDIR)/Port/*.hi $(LIBDIR)/imports/Graphics/UI/Port install -m 644 $(MAINLIB) $(LIBDIR) install -m 644 src/include/HsPort.h $(LIBDIR)/include |
|
From: <kr_...@us...> - 2003-08-13 20:40:37
|
Update of /cvsroot/htoolkit/port
In directory sc8-pr-cvs1:/tmp/cvs-serv3423
Modified Files:
configure
Log Message:
bugfix
Index: configure
===================================================================
RCS file: /cvsroot/htoolkit/port/configure,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** configure 17 Jul 2003 19:34:37 -0000 1.17
--- configure 13 Aug 2003 20:20:08 -0000 1.18
***************
*** 323,327 ****
extralibs="$extralibs\""
fi
!
if test ! -z "$extralibdirs"; then
extralibdirs="$extralibdirs\""
--- 323,327 ----
extralibs="$extralibs\""
fi
!
if test ! -z "$extralibdirs"; then
extralibdirs="$extralibdirs\""
***************
*** 334,338 ****
# create list of extra include directories needed, comma seperated and quoted.
# expects $cincflags to be in the form: -Idir1 -Idir2 ...
! incdirs=""
incopts=""
for flag in $cincflags; do
--- 334,339 ----
# create list of extra include directories needed, comma seperated and quoted.
# expects $cincflags to be in the form: -Idir1 -Idir2 ...
! echo $cincflags
! incdirs="\"$libdir/include\""
incopts=""
for flag in $cincflags; do
|
|
From: <kr_...@us...> - 2003-08-13 19:39:28
|
Update of /cvsroot/htoolkit/port In directory sc8-pr-cvs1:/tmp/cvs-serv28890 Modified Files: makefile Log Message: bugfix Index: makefile =================================================================== RCS file: /cvsroot/htoolkit/port/makefile,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** makefile 23 Jul 2003 16:26:28 -0000 1.26 --- makefile 13 Aug 2003 19:36:16 -0000 1.27 *************** *** 14,21 **** # # make clean - remove all generated files - # make cleanDOC - remove docs - # make cleanHS - remove haskell output files - # make cleanC - remove C output files - # make cleanLIB - remove library # # dependencies are handled automatically. --- 14,17 ---- *************** *** 228,235 **** $(RM) $(HOUTDIR)/Port/*.* $(RM) $(COUTDIR)/*.* - $(RMDIR) $(HOUTDIR) $(RMDIR) $(HOUTDIR)/Port $(RMDIR) $(COUTDIR) ! # documentation doc: $(DOCFILE) --- 224,231 ---- $(RM) $(HOUTDIR)/Port/*.* $(RM) $(COUTDIR)/*.* $(RMDIR) $(HOUTDIR)/Port + $(RMDIR) $(HOUTDIR) $(RMDIR) $(COUTDIR) ! # documentation doc: $(DOCFILE) |
|
From: <kr_...@us...> - 2003-08-12 21:36:39
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv20936/src/cbits/Win32
Modified Files:
ToolBar.c
Log Message:
Support for checked buttons
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ToolBar.c 12 Aug 2003 20:01:32 -0000 1.10
--- ToolBar.c 12 Aug 2003 21:10:08 -0000 1.11
***************
*** 833,837 ****
ToolHandle osInsertToolCheckButton(WindowHandle toolBar, int pos)
{
! return NULL;
}
--- 833,860 ----
ToolHandle osInsertToolCheckButton(WindowHandle toolBar, int pos)
{
! TBBUTTON tbb;
! ToolHandle btn;
!
! btn = malloc(sizeof(struct ToolHandle));
! if (!btn) return NULL;
!
! btn->nCommand = ++nNextToolButtonID;
! btn->hToolBar = toolBar;
! btn->bitmap = NULL;
!
! tbb.iBitmap = I_IMAGENONE;
! tbb.idCommand = btn->nCommand;
! tbb.fsState = TBSTATE_ENABLED;
! tbb.fsStyle = TBSTYLE_BUTTON | TBSTYLE_CHECK;
! tbb.dwData = (DWORD)btn;
! tbb.iString = 0;
!
! if (pos > 0)
! SendMessage(toolBar,TB_INSERTBUTTON,pos,(LPARAM)&tbb);
! else
! SendMessage(toolBar,TB_ADDBUTTONS, 1, (LPARAM)&tbb);
!
! RelayoutFrameBars();
! return btn;
}
***************
*** 951,956 ****
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
! tbbi.dwMask = TBIF_TEXT | TBIF_STYLE;
! tbbi.fsStyle = TBSTYLE_BUTTON | ((text && *text) ? BTNS_SHOWTEXT : 0);
tbbi.pszText = text;
tbbi.cchText = strlen(text);
--- 974,984 ----
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
!
! tbbi.dwMask = TBIF_STYLE;
! tbbi.fsStyle = TBSTYLE_BUTTON;
! SendMessage(toolButton->hToolBar, TB_GETBUTTONINFO, toolButton->nCommand, (LPARAM) &tbbi);
!
! tbbi.dwMask = TBIF_TEXT | TBIF_STYLE;
! tbbi.fsStyle = (text && *text) ? (tbbi.fsStyle | BTNS_SHOWTEXT) : (tbbi.fsStyle & ~BTNS_SHOWTEXT);
tbbi.pszText = text;
tbbi.cchText = strlen(text);
***************
*** 976,984 ****
void osSetToolButtonChecked(ToolHandle toolButton, BOOL bState)
{
};
BOOL osGetToolButtonChecked(ToolHandle toolButton)
{
! return FALSE;
}
--- 1004,1020 ----
void osSetToolButtonChecked(ToolHandle toolButton, BOOL bState)
{
+ int nState = SendMessage(toolButton->hToolBar, TB_GETSTATE, toolButton->nCommand, 0);
+
+ if (bState)
+ nState = nState | TBSTATE_CHECKED;
+ else
+ nState = nState & ~TBSTATE_CHECKED;
+
+ SendMessage(toolButton->hToolBar,TB_SETSTATE,toolButton->nCommand,MAKELONG(nState, 0));
};
BOOL osGetToolButtonChecked(ToolHandle toolButton)
{
! return SendMessage(toolButton->hToolBar, TB_GETSTATE, toolButton->nCommand, 0) & TBSTATE_CHECKED;
}
|
|
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;
}
|
|
From: <kr_...@us...> - 2003-08-12 20:15:46
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv8952/src/cbits/Win32 Modified Files: ToolBar.c Log Message: Invoke RelayoutFrameBars at appropriate places Index: ToolBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ToolBar.c 12 Aug 2003 19:46:48 -0000 1.9 --- ToolBar.c 12 Aug 2003 20:01:32 -0000 1.10 *************** *** 884,888 **** toolButton->bitmap = bitmap; ! InvalidateRect(toolButton->hToolBar,NULL,TRUE); } --- 884,888 ---- toolButton->bitmap = bitmap; ! RelayoutFrameBars(); } *************** *** 956,959 **** --- 956,961 ---- tbbi.cchText = strlen(text); SendMessage(toolButton->hToolBar, TB_SETBUTTONINFO, toolButton->nCommand, (LPARAM) &tbbi); + + RelayoutFrameBars(); } *************** *** 992,994 **** --- 994,998 ---- SendMessage(toolItem->hToolBar, TB_DELETEBUTTON, osGetToolItemPos(toolItem), 0); free(toolItem); + + RelayoutFrameBars(); } |
|
From: <kr_...@us...> - 2003-08-12 20:10:46
|
Update of /cvsroot/htoolkit/gio/src/Graphics/UI/GIO
In directory sc8-pr-cvs1:/tmp/cvs-serv15294/src/Graphics/UI/GIO
Modified Files:
CommonDialogs.hs
Log Message:
comments
Index: CommonDialogs.hs
===================================================================
RCS file: /cvsroot/htoolkit/gio/src/Graphics/UI/GIO/CommonDialogs.hs,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** CommonDialogs.hs 2 May 2003 06:35:30 -0000 1.4
--- CommonDialogs.hs 12 Aug 2003 17:38:12 -0000 1.5
***************
*** 40,45 ****
runInputFileDialog title filter mb_owner = Lib.runInputFileDialog title filter (getWHandle mb_owner)
! -- | Run a dialog to select an input file. Returns 'Nothing' when cancelled.
! runInputFilesDialog :: String -- ^ The dialog title
-> [(String,[String])] -- ^ Filter for acceptable file types. The filter is a
-- list of pairs where the first element of pair is a
--- 40,45 ----
runInputFileDialog title filter mb_owner = Lib.runInputFileDialog title filter (getWHandle mb_owner)
! -- | Run a dialog to select one or more input files. Returns empty list when cancelled.
! runInputFilesDialog :: String -- ^ The dialog title
-> [(String,[String])] -- ^ Filter for acceptable file types. The filter is a
-- list of pairs where the first element of pair is a
|
|
From: <kr_...@us...> - 2003-08-12 19:59:07
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv6900/src/cbits/Win32 Modified Files: ToolBar.c Log Message: fix: BTNS_SHOWTEXT flag should be set only for buttons with real caption Index: ToolBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** ToolBar.c 12 Aug 2003 19:14:56 -0000 1.8 --- ToolBar.c 12 Aug 2003 19:46:48 -0000 1.9 *************** *** 817,822 **** tbb.iBitmap = I_IMAGENONE; tbb.idCommand = btn->nCommand; ! tbb.fsState = (BYTE)TBSTATE_ENABLED; ! tbb.fsStyle = (BYTE)TBSTYLE_BUTTON | BTNS_SHOWTEXT; tbb.dwData = (DWORD)btn; tbb.iString = 0; --- 817,822 ---- tbb.iBitmap = I_IMAGENONE; tbb.idCommand = btn->nCommand; ! tbb.fsState = TBSTATE_ENABLED; ! tbb.fsStyle = TBSTYLE_BUTTON; tbb.dwData = (DWORD)btn; tbb.iString = 0; *************** *** 951,955 **** TBBUTTONINFO tbbi; tbbi.cbSize = sizeof(tbbi); ! tbbi.dwMask = TBIF_TEXT; tbbi.pszText = text; tbbi.cchText = strlen(text); --- 951,956 ---- TBBUTTONINFO tbbi; tbbi.cbSize = sizeof(tbbi); ! tbbi.dwMask = TBIF_TEXT | TBIF_STYLE; ! tbbi.fsStyle = TBSTYLE_BUTTON | ((text && *text) ? BTNS_SHOWTEXT : 0); tbbi.pszText = text; tbbi.cchText = strlen(text); |
|
From: <kr_...@us...> - 2003-08-12 19:39:37
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv1539/src/cbits/Win32
Modified Files:
ToolBar.c
Log Message:
remove unused variables
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** ToolBar.c 12 Aug 2003 19:12:40 -0000 1.7
--- ToolBar.c 12 Aug 2003 19:14:56 -0000 1.8
***************
*** 874,878 ****
TBADDBITMAP tbab;
TBBUTTONINFO tbbi;
- int iOldImage = SendMessage(toolButton->hToolBar, TB_GETBITMAP, toolButton->nCommand, 0);
tbab.hInst = NULL;
--- 874,877 ----
***************
*** 988,997 ****
void osDestroyToolItem(ToolHandle toolItem)
{
- int iOldImage = SendMessage(toolItem->hToolBar, TB_GETBITMAP, toolItem->nCommand, 0);
-
handleToolDestroy(toolItem);
SendMessage(toolItem->hToolBar, TB_DELETEBUTTON, osGetToolItemPos(toolItem), 0);
-
free(toolItem);
}
--- 987,993 ----
|
|
From: <kr_...@us...> - 2003-08-12 19:23:22
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32 In directory sc8-pr-cvs1:/tmp/cvs-serv1283/src/cbits/Win32 Modified Files: ToolBar.c Log Message: bugfix Index: ToolBar.c =================================================================== RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ToolBar.c 12 Aug 2003 19:09:56 -0000 1.6 --- ToolBar.c 12 Aug 2003 19:12:40 -0000 1.7 *************** *** 874,878 **** TBADDBITMAP tbab; TBBUTTONINFO tbbi; ! int iOldImage = SendMessage(toolItem->hToolBar, TB_GETBITMAP, toolItem->nCommand, 0); tbab.hInst = NULL; --- 874,878 ---- TBADDBITMAP tbab; TBBUTTONINFO tbbi; ! int iOldImage = SendMessage(toolButton->hToolBar, TB_GETBITMAP, toolButton->nCommand, 0); tbab.hInst = NULL; |
|
From: <kr_...@us...> - 2003-08-11 17:58:13
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv9714/src/cbits/Win32
Modified Files:
ToolBar.c
Log Message:
Support for destroyToolbar and destroyToolItem
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** ToolBar.c 10 Aug 2003 18:36:04 -0000 1.4
--- ToolBar.c 11 Aug 2003 17:28:38 -0000 1.5
***************
*** 2,5 ****
--- 2,6 ----
#include "ControlBar.h"
#include "Internals.h"
+ #include "Handlers_stub.h"
#include <windowsx.h>
***************
*** 134,138 ****
TBBUTTON button;
! // now hit test against CToolBar buttons
nButtons = (int) SendMessage(hToolBar, TB_BUTTONCOUNT, 0, 0);
for (i = 0; i < nButtons; i++)
--- 135,139 ----
TBBUTTON button;
! // now hit test against toolbar buttons
nButtons = (int) SendMessage(hToolBar, TB_BUTTONCOUNT, 0, 0);
for (i = 0; i < nButtons; i++)
***************
*** 194,198 ****
}
-
////////////////////////////////////////////
// The DockContext
--- 195,198 ----
***************
*** 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_STYLE, (lStyle & ~(VERT | HORZ | FLOAT)) | pCtxt->dwOverDockStyle);
ScreenToClient(hControlBar, ((POINT *) &rect));
ScreenToClient(hControlBar, ((POINT *) &rect)+1);
***************
*** 718,721 ****
--- 718,740 ----
}
break;
+ case WM_DESTROY:
+ {
+ int i, nButtons;
+ TBBUTTON tbb;
+
+ nButtons = (int) SendMessage(hWnd, TB_BUTTONCOUNT, 0, 0);
+
+ for (i = 0; i < nButtons; i++)
+ {
+ if (SendMessage(hWnd, TB_GETBUTTON, i, (LPARAM)&tbb) && (tbb.fsStyle & TBSTYLE_SEP) == 0)
+ {
+ handleToolDestroy((ToolHandle *) tbb.dwData);
+ free((ToolHandle *) tbb.dwData);
+ }
+ }
+
+ handleWindowDestroy(hWnd);
+ }
+ break;
}
***************
*** 779,782 ****
--- 798,803 ----
void osDestroyToolBar(WindowHandle toolbar)
{
+ UndockToolBar(GetParent(toolbar), toolbar);
+ DestroyWindow(toolbar);
}
***************
*** 803,807 ****
SendMessage(toolBar,TB_INSERTBUTTON,pos,(LPARAM)&tbb);
else
! SendMessage(toolBar, TB_ADDBUTTONS, 1, (LPARAM)&tbb);
RelayoutFrameBars();
--- 824,828 ----
SendMessage(toolBar,TB_INSERTBUTTON,pos,(LPARAM)&tbb);
else
! SendMessage(toolBar,TB_ADDBUTTONS, 1, (LPARAM)&tbb);
RelayoutFrameBars();
***************
*** 850,883 ****
void osSetToolButtonBitmap(ToolHandle toolButton, BitmapHandle bitmap)
{
TBBUTTONINFO tbbi;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_IMAGE;
! tbbi.iImage = I_IMAGENONE;
! SendMessage(toolButton->hToolBar, TB_GETBUTTONINFO, toolButton->nCommand, (LPARAM) &tbbi);
!
! if (tbbi.iImage == I_IMAGENONE)
! {
! TBADDBITMAP tbab;
!
! tbab.hInst = NULL;
! tbab.nID = (UINT) bitmap->hBitmap;
!
! tbbi.iImage = SendMessage(toolButton->hToolBar, TB_ADDBITMAP, 1, (LPARAM) &tbab);
!
! SendMessage(toolButton->hToolBar, TB_SETBUTTONINFO, toolButton->nCommand, (LPARAM) &tbbi);
! }
! else
! {
! TBREPLACEBITMAP tbrb;
!
! tbrb.hInstOld = NULL;
! tbrb.nIDOld = (UINT) toolButton->bitmap->hBitmap;
! tbrb.hInstNew = NULL;
! tbrb.nIDNew = (UINT) bitmap->hBitmap;
! tbrb.nButtons = 1;
!
! SendMessage(toolButton->hToolBar, TB_REPLACEBITMAP, 0, (LPARAM) &tbrb);
! }
toolButton->bitmap = bitmap;
--- 871,884 ----
void osSetToolButtonBitmap(ToolHandle toolButton, BitmapHandle bitmap)
{
+ TBADDBITMAP tbab;
TBBUTTONINFO tbbi;
+ int iOldImage = SendMessage(toolItem->hToolBar, TB_GETBITMAP, toolItem->nCommand, 0);
+ tbab.hInst = NULL;
+ tbab.nID = (UINT) bitmap->hBitmap;
tbbi.cbSize = sizeof(tbbi);
tbbi.dwMask = TBIF_IMAGE;
! tbbi.iImage = SendMessage(toolButton->hToolBar, TB_ADDBITMAP, 1, (LPARAM) &tbab);
! SendMessage(toolButton->hToolBar, TB_SETBUTTONINFO, toolButton->nCommand, (LPARAM) &tbbi);
toolButton->bitmap = bitmap;
***************
*** 971,973 ****
--- 972,981 ----
void osDestroyToolItem(ToolHandle toolItem)
{
+ int iOldImage = SendMessage(toolItem->hToolBar, TB_GETBITMAP, toolItem->nCommand, 0);
+
+ handleToolDestroy(toolItem);
+
+ SendMessage(toolItem->hToolBar, TB_DELETEBUTTON, osGetToolItemPos(toolItem), 0);
+
+ free(toolItem);
}
|
|
From: <kr_...@us...> - 2003-08-11 17:31:52
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv8473/src/cbits/Win32
Modified Files:
ControlBar.c
Log Message:
Add break statement to case in the switch statement
Index: ControlBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ControlBar.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ControlBar.c 10 Aug 2003 18:36:04 -0000 1.2
--- ControlBar.c 11 Aug 2003 17:21:21 -0000 1.3
***************
*** 177,180 ****
--- 177,181 ----
SetWindowPos(GetWindow(hWnd, GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER);
}
+ break;
case WM_NCLBUTTONDOWN:
if (wParam == HTCAPTION)
|
|
From: <kr_...@us...> - 2003-08-10 18:36:07
|
Update of /cvsroot/htoolkit/port/src/cbits/Win32
In directory sc8-pr-cvs1:/tmp/cvs-serv18716/src/cbits/Win32
Modified Files:
ControlBar.c ControlBar.h Frame.c Internals.h ToolBar.c Util.c
Log Message:
Added complete implementation for floating toolbars for Windows
Index: ControlBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ControlBar.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ControlBar.c 8 Jul 2003 20:31:29 -0000 1.1
--- ControlBar.c 10 Aug 2003 18:36:04 -0000 1.2
***************
*** 5,27 ****
! int GetControlBarSize(HWND hControlBar)
{
! HWND hCtrl;
! LONG lStyle;
! int nSize;
! RECT rect;
!
! lStyle = GetWindowLong(hControlBar, GWL_STYLE);
! nSize = 0;
! hCtrl = GetTopWindow(hControlBar);
! while (hCtrl)
! {
! GetClientRect(hCtrl,&rect);
! nSize = max(nSize, (lStyle & CCS_VERT) ? rect.right : rect.bottom);
! hCtrl = GetNextWindow(hCtrl,GW_HWNDNEXT);
! }
return nSize;
--- 5,86 ----
! typedef struct
{
! int nSize;
! int nOffset;
! HWND hWnd;
! } BarData;
! typedef struct
! {
! int nSize;
! int nOffset;
! int nBarCount;
! BarData *pBars;
! } BandData;
! typedef struct
! {
! int nBandCount;
! BandData *pBands;
! } ControlBarData;
! static void RecalcControlBarLayout(ControlBarData *pData, BOOL bVert)
! {
! int i, j;
! BarData *pBar;
! BandData *pBand;
! int nBarOffset, nBandOffset;
! SIZE sz;
!
! nBandOffset = 0;
! for (i = 0; i < pData->nBandCount; i++)
! {
! pBand = &pData->pBands[i];
!
! pBand->nSize = 0;
! pBand->nOffset = nBandOffset;
!
! nBarOffset = 0;
! for (j = 0; j < pBand->nBarCount; j++)
! {
! pBar = &pBand->pBars[j];
! GetToolBarSize(pBar->hWnd, &sz);
!
! pBar->nOffset = max(pBar->nOffset, nBarOffset);
! if (bVert)
! {
! pBand->nSize = max(pBand->nSize, sz.cx);
! pBar->nSize = sz.cy;
!
! SetWindowPos(pBar->hWnd,NULL,pBand->nOffset,pBar->nOffset,sz.cx,sz.cy,SWP_NOZORDER);
! }
! else
! {
! pBand->nSize = max(pBand->nSize, sz.cy);
! pBar->nSize = sz.cx;
!
! SetWindowPos(pBar->hWnd,NULL,pBar->nOffset,pBand->nOffset,sz.cx,sz.cy,SWP_NOZORDER);
! }
!
! nBarOffset = pBar->nOffset + pBar->nSize;
! }
!
! nBandOffset = pBand->nOffset + pBand->nSize;
! }
! }
!
! static int GetControlBarSize(HWND hControlBar)
! {
! int i, nSize;
! ControlBarData *pData;
!
! nSize = 0;
! pData = (ControlBarData *) GetWindowLong(hControlBar, GWL_USERDATA);
!
! RecalcControlBarLayout(pData, GetWindowLong(hControlBar, GWL_STYLE) & CCS_VERT);
!
! for (i = 0; i < pData->nBandCount; i++)
! nSize += pData->pBands[i].nSize;
return nSize;
***************
*** 53,89 ****
LRESULT CALLBACK HControlBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! HWND hToolBar;
! TBBUTTONINFO tbbi;
!
! tbbi.cbSize = sizeof(tbbi);
! tbbi.dwMask = TBIF_LPARAM;
! tbbi.lParam = NULL;
switch (uMsg)
{
case WM_COMMAND:
{
! hToolBar = (HWND) lParam;
SendMessage(hToolBar, TB_GETBUTTONINFO, LOWORD(wParam), (LPARAM) &tbbi);
handleToolCommand((WindowHandle) tbbi.lParam);
}
break;
! case WM_NOTIFY:
{
! LPNMTTDISPINFO lpnmtdi = (LPNMTTDISPINFO) lParam;
! if (lpnmtdi->hdr.code == TTN_NEEDTEXT)
! {
! hToolBar = lpnmtdi->lParam;
! printf("2> hToolBar=%p\n", hToolBar);
! printf("2> lpnmtdi->hdr.idFrom=%p\n", lpnmtdi->hdr.idFrom);
!
! SendMessage(hToolBar, TB_GETBUTTONINFO, lpnmtdi->hdr.idFrom, (LPARAM) &tbbi);
! printf("2> tbbi.lParam=%p\n", tbbi.lParam);
! printf("2> lpnmtdi->lParam=%p\n", lpnmtdi->lParam);
!
! //lpnmtdi->lpszText = ((ToolButton) tbbi.lParam)->lpszToolTip;
! }
}
break;
}
--- 112,183 ----
LRESULT CALLBACK HControlBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
! ControlBarData *pData = (ControlBarData *) GetWindowLong(hWnd, GWL_USERDATA);
switch (uMsg)
{
+ case WM_CREATE:
+ {
+ HMENU hMenu;
+
+ if (((CREATESTRUCT *) lParam)->style & WS_CHILD)
+ {
+ pData = malloc(sizeof(ControlBarData));
+ if (!pData) return -1;
+
+ pData->nBandCount = 0;
+ pData->pBands = NULL;
+
+ SetWindowLong(hWnd, GWL_USERDATA, (LONG) pData);
+ }
+
+ hMenu = GetSystemMenu(hWnd, FALSE);
+ if (hMenu)
+ {
+ DeleteMenu(hMenu, SC_RESTORE, MF_BYCOMMAND);
+ DeleteMenu(hMenu, SC_MINIMIZE, MF_BYCOMMAND);
+ DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND);
+ DeleteMenu(hMenu, SC_CLOSE, MF_BYCOMMAND);
+ AppendMenu(hMenu, MF_STRING, SC_CLOSE, "Hide");
+ }
+ }
+ break;
+ case WM_DESTROY:
+ if (pData)
+ {
+ int i;
+
+ SetWindowLong(hWnd, GWL_USERDATA, 0);
+ for (i = 0; i < pData->nBandCount; i++)
+ free(pData->pBands[i].pBars);
+ free(pData->pBands);
+ free(pData);
+ }
+ break;
+ case WM_CLOSE:
+ ShowWindow(hWnd, SW_HIDE);
+ return 0;
case WM_COMMAND:
{
! TBBUTTONINFO tbbi;
! HWND hToolBar = (HWND) lParam;
+ tbbi.cbSize = sizeof(tbbi);
+ tbbi.dwMask = TBIF_LPARAM;
+ tbbi.lParam = 0;
SendMessage(hToolBar, TB_GETBUTTONINFO, LOWORD(wParam), (LPARAM) &tbbi);
handleToolCommand((WindowHandle) tbbi.lParam);
}
break;
! case WM_SIZE:
! if (!pData)
{
! int nWidth = LOWORD(lParam);
! int nHeight = HIWORD(lParam);
!
! SetWindowPos(GetWindow(hWnd, GW_CHILD),NULL,0,0,nWidth,nHeight,SWP_NOZORDER);
}
+ case WM_NCLBUTTONDOWN:
+ if (wParam == HTCAPTION)
+ SendMessage(GetWindow(hWnd, GW_CHILD), uMsg, wParam, lParam);
break;
}
***************
*** 91,92 ****
--- 185,314 ----
return DefWindowProc(hWnd, uMsg, wParam, lParam);
}
+
+ void DockToolBarToRect(HWND hControlBar, HWND hWnd, RECT rect)
+ {
+ int nBandNum;
+ int nPosition;
+ int nOffset;
+ int nCentralOffset;
+ ControlBarData *pData = (ControlBarData *) GetWindowLong(hControlBar, GWL_USERDATA);
+ BOOL bVert = GetWindowLong(hControlBar, GWL_STYLE) & CCS_VERT;
+ BandData *pBand;
+
+ RecalcControlBarLayout(pData, bVert);
+
+ if (bVert)
+ {
+ nOffset = rect.top;
+ nCentralOffset = (rect.right-rect.left)/2;
+ }
+ else
+ {
+ nOffset = rect.left;
+ nCentralOffset = (rect.bottom-rect.top)/2;
+ }
+
+ for (nBandNum = 0; nBandNum < pData->nBandCount; nBandNum++)
+ {
+ if (pData->pBands[nBandNum].nOffset <= nCentralOffset &&
+ nCentralOffset <= pData->pBands[nBandNum].nOffset+pData->pBands[nBandNum].nSize)
+ break;
+ }
+
+ if (nBandNum >= pData->nBandCount)
+ nPosition = 0;
+ else
+ {
+ pBand = &pData->pBands[nBandNum];
+
+ if (nOffset < pBand->pBars[0].nOffset)
+ nPosition = 0;
+ else
+ {
+ for (nPosition = 1; nPosition < pBand->nBarCount; nPosition++)
+ {
+ if (nOffset < pBand->pBars[nPosition].nOffset)
+ break;
+ }
+ }
+ }
+
+ DockToolBar(hControlBar, hWnd, nBandNum, nPosition, nOffset);
+ }
+
+ void DockToolBar(HWND hControlBar, HWND hWnd, int nBandNum, int nPosition, int nOffset)
+ {
+ BarData *pBar;
+ BandData *pBand;
+ ControlBarData *pData = (ControlBarData *) GetWindowLong(hControlBar, GWL_USERDATA);
+
+ SetParent(hWnd, hControlBar);
+
+ if (pData)
+ {
+ if (nBandNum >= pData->nBandCount)
+ {
+ pData->pBands = realloc(pData->pBands, (pData->nBandCount+1)*sizeof(BandData));
+ memset(pData->pBands+pData->nBandCount, 0, sizeof(BandData));
+ nBandNum = pData->nBandCount;
+ pData->nBandCount++;
+ }
+ pBand = &pData->pBands[nBandNum];
+
+ if (nPosition >= pBand->nBarCount)
+ nPosition = pBand->nBarCount;
+ pBand->pBars = realloc(pBand->pBars, (pBand->nBarCount+1)*sizeof(BarData));
+ memmove(pBand->pBars+nPosition+1, pBand->pBars+nPosition, (pBand->nBarCount-nPosition)*sizeof(BarData));
+ pBand->nBarCount++;
+
+ pBar = &pBand->pBars[nPosition];
+ memset(pBar, 0, sizeof(BarData));
+ pBar->nOffset = nOffset;
+ pBar->hWnd = hWnd;
+
+ RecalcControlBarLayout(pData, GetWindowLong(hWnd, GWL_STYLE) & CCS_VERT);
+ }
+ }
+
+ void UndockToolBar(HWND hControlBar, HWND hWnd)
+ {
+ int i, j;
+ BarData *pBar;
+ BandData *pBand;
+ ControlBarData *pData = (ControlBarData *) GetWindowLong(hControlBar, GWL_USERDATA);
+
+ SetParent(hWnd, NULL);
+
+ if (pData)
+ {
+ for (i = 0; i < pData->nBandCount; i++)
+ {
+ pBand = &pData->pBands[i];
+
+ for (j = 0; j < pBand->nBarCount; j++)
+ {
+ pBar = &pBand->pBars[j];
+
+ if (pBar->hWnd == hWnd)
+ {
+ memmove(pBand->pBars+j, pBand->pBars+j+1, (pBand->nBarCount-j-1)*sizeof(BarData));
+ pBand->pBars = realloc(pBand->pBars, (pBand->nBarCount-1)*sizeof(BarData));
+ pBand->nBarCount--;
+
+ if (pBand->nBarCount == 0)
+ {
+ memmove(pData->pBands+i, pData->pBands+i+1, (pData->nBandCount-i-1)*sizeof(BandData));
+ pData->pBands = realloc(pData->pBands, (pData->nBandCount-1)*sizeof(BandData));
+ pData->nBandCount--;
+ }
+
+ return;
+ }
+ }
+ }
+ }
+ else
+ {
+ DestroyWindow(hControlBar);
+ }
+ }
\ No newline at end of file
Index: ControlBar.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ControlBar.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ControlBar.h 8 Jul 2003 20:31:29 -0000 1.1
--- ControlBar.h 10 Aug 2003 18:36:04 -0000 1.2
***************
*** 2,7 ****
#define CONTROLBAR_H
- int GetControlBarSize(HWND hControlBar);
void RelayoutFrameBars();
#endif
--- 2,12 ----
#define CONTROLBAR_H
void RelayoutFrameBars();
+
+ void DockToolBar(HWND hControlBar, HWND hWnd, int nBandNum, int nPosition, int nOffset);
+ void DockToolBarToRect(HWND hControlBar, HWND hWnd, RECT rect);
+ void UndockToolBar(HWND hControlBar, HWND hWnd);
+
+ void GetToolBarSize(HWND hToolBar, SIZE *pSize);
#endif
Index: Frame.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Frame.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** Frame.c 3 Jul 2003 17:46:00 -0000 1.11
--- Frame.c 10 Aug 2003 18:36:04 -0000 1.12
***************
*** 94,107 ****
GetWindowText(hWnd,pData->lpszAppName,nLen+1);
}
!
SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData);
}
break;
case WM_SIZE:
! {
! int nWidth = LOWORD(lParam);
! int nHeight = HIWORD(lParam);
! SetWindowPos(pData->hClientWnd,NULL,0,0,nWidth,nHeight,SWP_NOZORDER);
! }
break;
case WM_COMMAND:
--- 94,136 ----
GetWindowText(hWnd,pData->lpszAppName,nLen+1);
}
!
! pData->hLeftBar = CreateWindow("HCONTROLBAR",
! NULL,
! WS_CHILD | WS_VISIBLE | CCS_VERT,
! 0,0,0,0,
! hWnd,
! NULL,
! (HANDLE) ghModule,
! NULL);
! pData->hTopBar = CreateWindow("HCONTROLBAR",
! NULL,
! WS_CHILD | WS_VISIBLE,
! 0,0,0,0,
! hWnd,
! NULL,
! (HANDLE) ghModule,
! NULL);
! pData->hRightBar = CreateWindow("HCONTROLBAR",
! NULL,
! WS_CHILD | WS_VISIBLE | CCS_VERT,
! 0,0,0,0,
! hWnd,
! NULL,
! (HANDLE) ghModule,
! NULL);
! pData->hBottomBar= CreateWindow("HCONTROLBAR",
! NULL,
! WS_CHILD | WS_VISIBLE,
! 0,0,0,0,
! hWnd,
! NULL,
! (HANDLE) ghModule,
! NULL);
!
SetWindowLong(hWnd,GWL_USERDATA,(LONG) pData);
}
break;
case WM_SIZE:
! RelayoutFrameBars();
break;
case WM_COMMAND:
Index: Internals.h
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Internals.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Internals.h 8 Jul 2003 21:18:06 -0000 1.3
--- Internals.h 10 Aug 2003 18:36:04 -0000 1.4
***************
*** 13,16 ****
--- 13,35 ----
#endif
+ #ifndef NCCALCSIZE_PARAMS
+ typedef struct tagNCCALCSIZE_PARAMS {
+ RECT rgrc[3];
+ PWINDOWPOS lppos;
+ } NCCALCSIZE_PARAMS, *LPNCCALCSIZE_PARAMS;
+ #endif
+
+ #ifndef TB_GETMAXSIZE
+ #define TB_GETMAXSIZE (WM_USER + 83)
+ #endif
+
+ #ifndef TB_SETSTYLE
+ #define TB_SETSTYLE (WM_USER + 56)
+ #endif
+
+ #ifndef TB_GETSTYLE
+ #define TB_GETSTYLE (WM_USER + 57)
+ #endif
+
extern HMODULE ghModule;
extern HWND ghWndFrame;
Index: ToolBar.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/ToolBar.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** ToolBar.c 8 Jul 2003 21:36:39 -0000 1.3
--- ToolBar.c 10 Aug 2003 18:36:04 -0000 1.4
***************
*** 2,5 ****
--- 2,21 ----
#include "ControlBar.h"
#include "Internals.h"
+ #include <windowsx.h>
+
+ #define CX_GRIPPER 3
+ #define CY_GRIPPER 3
+ #define CX_BORDER_GRIPPER 2
+ #define CY_BORDER_GRIPPER 2
+ #define CX_BORDER 1
+ #define CY_BORDER 1
+
+ #define HORZ 0x1000L
+ #define VERT 0x2000L
+ #define FLOAT 0x4000L
+
+ WNDPROC DefToolBarProc = NULL;
+
+ static int nNextToolButtonID = 0;
struct ToolHandle
***************
*** 9,39 ****
BitmapHandle bitmap;
};
- static int nNextToolButtonID = 0;
! WindowHandle osCreateToolBar(char *name, int place, int band_num, int band_position, int offset)
{
HWND hControlBar, hWnd;
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
switch (place)
{
! case 0: hControlBar = pFrameData->hLeftBar; break;
! case 1: hControlBar = pFrameData->hTopBar; break;
! case 2: hControlBar = pFrameData->hRightBar; break;
! case 3: hControlBar = pFrameData->hBottomBar; break;
}
! hWnd = CreateWindow (TOOLBARCLASSNAME,
! NULL,
! WS_CHILD | WS_VISIBLE | WS_BORDER | WS_CLIPSIBLINGS | CCS_TOP | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT,
0,0,0,0,
hControlBar,
(HMENU) NULL,
(HANDLE) ghModule,
! 0
);
! SendMessage (hWnd, TB_AUTOSIZE, (WPARAM)0, (LPARAM)0);
! SendMessage (hWnd, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), (LPARAM) 0);
!
return hWnd;
}
--- 25,777 ----
BitmapHandle bitmap;
};
! ////////////////////////////////////////////
! // Drawing & GDI utilities
! ////////////////////////////////////////////
!
! static void FillSolidRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clr)
! {
! RECT rect;
! rect.left = x;
! rect.top = y;
! rect.right = x + cx;
! rect.bottom = y + cy;
!
! SetBkColor(hDC, clr);
! ExtTextOut(hDC, 0, 0, ETO_OPAQUE, &rect, NULL, 0, NULL);
! }
!
! static void Draw3dRect(HDC hDC, int x, int y, int cx, int cy, COLORREF clrTopLeft, COLORREF clrBottomRight)
! {
! FillSolidRect(hDC, x, y, cx - 1, 1, clrTopLeft);
! FillSolidRect(hDC, x, y, 1, cy - 1, clrTopLeft);
! FillSolidRect(hDC, x + cx, y, -1, cy, clrBottomRight);
! FillSolidRect(hDC, x, y + cy, cx, -1, clrBottomRight);
! }
!
! static HBRUSH CreateHalftoneBrush()
! {
! static WORD grayPattern[] = {0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA, 0x5555, 0xAAAA};
!
! HBITMAP hGrayBitmap;
! HBRUSH hHalftoneBrush = NULL;
!
! hGrayBitmap = CreateBitmap(8, 8, 1, 1, &grayPattern);
! if (hGrayBitmap != NULL)
! {
! hHalftoneBrush = CreatePatternBrush(hGrayBitmap);
! DeleteObject(hGrayBitmap);
! }
!
! return hHalftoneBrush;
! }
!
! static void DrawDragRect(HDC hDC, RECT *pRect, SIZE size, RECT *pRectLast, SIZE sizeLast, HBRUSH hBrush, HBRUSH hBrushLast)
! {
! RECT rect;
! HRGN hRgnNew, hRgnOutside, hRgnInside, hRgnLast, hRgnUpdate;
! HBRUSH hBrushOld;
!
! // first, determine the update region and select it
! rect = *pRect;
! InflateRect(&rect, -size.cx, -size.cy);
! IntersectRect(&rect, &rect, pRect);
! hRgnOutside = CreateRectRgnIndirect(pRect);
! hRgnInside = CreateRectRgnIndirect(&rect);
! hRgnNew = CreateRectRgn(0, 0, 0, 0);
! CombineRgn(hRgnNew, hRgnOutside, hRgnInside, RGN_XOR);
!
! // find difference between new region and old region
! rect = *pRectLast;
! InflateRect(&rect, -sizeLast.cx, -sizeLast.cy);
! IntersectRect(&rect, &rect, pRectLast);
! SetRectRgn(hRgnOutside, pRectLast->left, pRectLast->top, pRectLast->right, pRectLast->bottom);
! SetRectRgn(hRgnInside, rect.left, rect.top, rect.right, rect.bottom);
! hRgnLast = CreateRectRgn(0, 0, 0, 0);
! CombineRgn(hRgnLast, hRgnOutside, hRgnInside, RGN_XOR);
!
! // only diff them if brushes are the same
! hRgnUpdate = NULL;
! if (hBrush == hBrushLast)
! {
! hRgnUpdate = CreateRectRgn(0, 0, 0, 0);
! CombineRgn(hRgnUpdate, hRgnLast, hRgnNew, RGN_XOR);
! }
!
! if (hBrush != hBrushLast && pRectLast != NULL)
! {
! // brushes are different -- erase old region first
! SelectClipRgn(hDC, hRgnLast);
! GetClipBox(hDC, &rect);
! hBrushOld = SelectObject(hDC, hBrushLast);
! PatBlt(hDC, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, PATINVERT);
! SelectObject(hDC, hBrushOld);
! }
!
! // draw into the update/new region
! SelectClipRgn(hDC, hRgnUpdate != NULL ? hRgnUpdate : hRgnNew);
! GetClipBox(hDC, &rect);
! hBrushOld = SelectObject(hDC, hBrush);
! PatBlt(hDC, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, PATINVERT);
! SelectObject(hDC, hBrushOld);
! SelectClipRgn(hDC, NULL);
!
! if (hRgnNew) DeleteObject(hRgnNew);
! if (hRgnOutside) DeleteObject(hRgnOutside);
! if (hRgnInside) DeleteObject(hRgnInside);
! if (hRgnLast) DeleteObject(hRgnLast);
! if (hRgnUpdate) DeleteObject(hRgnUpdate);
! }
!
! ////////////////////////////////////////////
! // utility functions
! ////////////////////////////////////////////
!
! static BOOL ToolHitTest(HWND hToolBar, POINT point)
! {
! RECT rect;
! int i, nButtons;
! TBBUTTON button;
!
! // now hit test against CToolBar buttons
! nButtons = (int) SendMessage(hToolBar, TB_BUTTONCOUNT, 0, 0);
! for (i = 0; i < nButtons; i++)
! {
! if (SendMessage(hToolBar, TB_GETITEMRECT, i, (LPARAM)&rect))
! {
! if ((point.x >= rect.left && point.x <= rect.right &&
! point.y >= rect.top && point.y <= rect.bottom))
! {
! if (SendMessage(hToolBar, TB_GETBUTTON, i, (LPARAM)&button) && (button.fsStyle & TBSTYLE_SEP) == 0)
! return TRUE;
! }
! }
! }
!
! return FALSE;
! }
!
! void GetToolBarSize(HWND hToolBar, SIZE *pSize)
! {
! RECT rect;
! SIZE sz;
! int i, nButtons;
! LONG lStyle;
!
! lStyle = GetWindowLong(hToolBar, GWL_STYLE);
!
! sz.cx = 0;
! sz.cy = 0;
!
! nButtons = (int) SendMessage(hToolBar, TB_BUTTONCOUNT, 0, 0);
! for (i = 0; i < nButtons; i++)
! {
! if (SendMessage(hToolBar, TB_GETITEMRECT, i, (LPARAM)&rect))
! {
! if (lStyle & HORZ)
! {
! sz.cx += rect.right-rect.left;
! sz.cy = max(sz.cy,rect.bottom-rect.top);
! }
! else
! if (lStyle & VERT)
! {
! sz.cx = max(sz.cx,rect.right-rect.left);
! sz.cy += rect.bottom-rect.top;
! }
! }
! }
!
! sz.cx += 4*CX_BORDER;
! sz.cy += 4*CY_BORDER;
! if (lStyle & HORZ)
! sz.cx += CX_BORDER_GRIPPER+CX_GRIPPER+CX_BORDER_GRIPPER;
! else
! if (lStyle & VERT)
! sz.cy += CY_BORDER_GRIPPER+CY_GRIPPER+CY_BORDER_GRIPPER;
!
! *pSize = sz;
! }
!
!
! ////////////////////////////////////////////
! // The DockContext
! ////////////////////////////////////////////
!
! typedef struct
! {
! HWND hToolBar;
! POINT ptLast;
! RECT rectLast;
! SIZE sizeLast;
!
! HWND hDesktopWnd;
! HDC hDesktopDC;
!
! BOOL bDitherLast;
! HBRUSH hWhiteBrush, hDitherBrush;
!
! RECT rectDragHorz, rectFrameDragHorz;
! RECT rectDragVert, rectFrameDragVert;
!
! DWORD dwOverDockStyle;
! DWORD dwDockStyle;
!
! BOOL bFlip;
! BOOL bForceFrame;
! } DockContext;
!
! static BOOL InitDockContext(HWND hToolBar, POINT pos, DockContext *pCtxt)
! {
! RECT rect;
!
! memset(pCtxt, 0, sizeof(DockContext));
! pCtxt->ptLast = pos;
! pCtxt->hToolBar = hToolBar;
! pCtxt->bForceFrame = FALSE;
! pCtxt->bFlip = FALSE;
! pCtxt->bDitherLast = FALSE;
! pCtxt->dwDockStyle = GetWindowLong(hToolBar, GWL_STYLE) & (HORZ | VERT);
! SetRectEmpty(&pCtxt->rectLast);
!
! // don't handle if capture already set
! if (GetCapture() != NULL)
! return FALSE;
!
! // get desktop window
! pCtxt->hDesktopWnd = GetDesktopWindow();
! if (!pCtxt->hDesktopWnd)
! return FALSE;
!
! // get the device context for the desktop window
! if (LockWindowUpdate(pCtxt->hDesktopWnd))
! pCtxt->hDesktopDC = GetDCEx(pCtxt->hDesktopWnd, NULL, DCX_WINDOW|DCX_CACHE|DCX_LOCKWINDOWUPDATE);
! else
! pCtxt->hDesktopDC = GetDCEx(pCtxt->hDesktopWnd, NULL, DCX_WINDOW|DCX_CACHE);
!
! if (!pCtxt->hDesktopDC)
! return FALSE;
!
! // get white brush
! pCtxt->hWhiteBrush = (HBRUSH) GetStockObject(WHITE_BRUSH);
! if (!pCtxt->hWhiteBrush)
! {
! ReleaseDC(pCtxt->hDesktopWnd, pCtxt->hDesktopDC);
! return FALSE;
! }
!
! // create dither brush
! pCtxt->hDitherBrush = CreateHalftoneBrush();
! if (!pCtxt->hDitherBrush)
! {
! DeleteObject(pCtxt->hWhiteBrush);
! ReleaseDC(pCtxt->hDesktopWnd, pCtxt->hDesktopDC);
! return FALSE;
! }
!
! GetWindowRect(hToolBar, &rect);
! ScreenToClient(hToolBar, ((POINT *) &rect));
! ScreenToClient(hToolBar, ((POINT *) &rect)+1);
!
! // calculate inverted dragging rect
! if (pCtxt->dwDockStyle & HORZ)
! {
! pCtxt->rectDragHorz = rect;
! pCtxt->rectDragVert.left = pos.x - (rect.bottom - rect.top)/2;
! pCtxt->rectDragVert.top = rect.top;
! pCtxt->rectDragVert.right = pCtxt->rectDragVert.left+(rect.bottom - rect.top );
! pCtxt->rectDragVert.bottom = pCtxt->rectDragVert.top +(rect.right - rect.left);
! }
! else // vertical orientation
! {
! pCtxt->rectDragVert = rect;
! pCtxt->rectDragHorz.left = rect.left;
! pCtxt->rectDragHorz.top = pos.y - (rect.right - rect.left)/2;
! pCtxt->rectDragHorz.right = pCtxt->rectDragHorz.left+(rect.bottom - rect.top );
! pCtxt->rectDragHorz.bottom = pCtxt->rectDragHorz.top +(rect.right - rect.left);
! }
!
! // calculate frame dragging rectangle
! pCtxt->rectFrameDragHorz = pCtxt->rectDragHorz;
! pCtxt->rectFrameDragVert = pCtxt->rectDragVert;
!
! AdjustWindowRectEx(&pCtxt->rectFrameDragHorz, WS_THICKFRAME | WS_CAPTION, FALSE, WS_EX_PALETTEWINDOW);
! AdjustWindowRectEx(&pCtxt->rectFrameDragVert, WS_THICKFRAME | WS_CAPTION, FALSE, WS_EX_PALETTEWINDOW);
! InflateRect(&pCtxt->rectFrameDragHorz, -CX_BORDER*2, -CY_BORDER*2);
! InflateRect(&pCtxt->rectFrameDragVert, -CX_BORDER*2, -CY_BORDER*2);
!
! // set capture to the window which received this message
! SetCapture(pCtxt->hToolBar);
!
! return TRUE;
! }
!
! static void ReleaseDockContext(DockContext *pCtxt)
! {
! DeleteObject(pCtxt->hDitherBrush);
! DeleteObject(pCtxt->hWhiteBrush);
!
! LockWindowUpdate(NULL);
! ReleaseDC(pCtxt->hDesktopWnd, pCtxt->hDesktopDC);
!
! ReleaseCapture();
! }
!
! ////////////////////////////////////////////////////////
!
! static void DrawDockRect(DockContext *pCtxt, BOOL bRemoveRect)
! {
! SIZE size;
! RECT rect;
! HBRUSH hBrush = pCtxt->hWhiteBrush;
!
! // default to thin frame
! size.cx = CX_BORDER;
! size.cy = CY_BORDER;
!
! // determine new rect and size
! if (pCtxt->dwOverDockStyle & HORZ)
! rect = pCtxt->rectDragHorz;
! else
! if (pCtxt->dwOverDockStyle & VERT)
! rect = pCtxt->rectDragVert;
! else
! {
! // use thick frame instead
! size.cx = GetSystemMetrics(SM_CXFRAME) - CX_BORDER;
! size.cy = GetSystemMetrics(SM_CYFRAME) - CY_BORDER;
!
! if (((pCtxt->dwDockStyle & HORZ) && !pCtxt->bFlip) || ((pCtxt->dwDockStyle & VERT) && pCtxt->bFlip))
! rect = pCtxt->rectFrameDragHorz;
! else
! rect = pCtxt->rectFrameDragVert;
! hBrush = pCtxt->hDitherBrush;
! }
!
! if (bRemoveRect)
! size.cx = size.cy = 0;
!
! if (pCtxt->dwOverDockStyle & (VERT | HORZ))
! {
! // looks better one pixel in (makes the bar look pushed down)
! InflateRect(&rect, -CX_BORDER, -CY_BORDER);
! }
!
! // draw it and remember last size
! DrawDragRect(pCtxt->hDesktopDC, &rect, size, &pCtxt->rectLast, pCtxt->sizeLast,
! hBrush, pCtxt->bDitherLast ? pCtxt->hDitherBrush : pCtxt->hWhiteBrush);
! pCtxt->rectLast = rect;
! pCtxt->sizeLast = size;
! pCtxt->bDitherLast = (hBrush == pCtxt->hDitherBrush);
! }
!
! static BOOL CanDockBar(HWND hControlBar, RECT *pRect)
! {
! RECT rect;
!
! GetWindowRect(hControlBar, &rect);
! if (rect.left == rect.right ) rect.right++;
! if (rect.top == rect.bottom) rect.bottom++;
!
! return IntersectRect(&rect, &rect, pRect);
! }
!
! static DWORD CanDock(DockContext *pCtxt, HWND *phControlBar)
! {
! RECT rect;
! FrameData *pData = (FrameData *) GetWindowLong(ghWndFrame, GWL_USERDATA);
! int nSize;
!
! if (((pCtxt->dwDockStyle & HORZ) && !pCtxt->bFlip) || ((pCtxt->dwDockStyle & VERT) && pCtxt->bFlip))
! rect = pCtxt->rectDragHorz;
! else
! rect = pCtxt->rectDragVert;
! nSize = min(rect.right-rect.left, rect.bottom-rect.top);
! rect.right = rect.left + nSize;
! rect.bottom = rect.top + nSize;
!
! if (CanDockBar(pData->hLeftBar, &rect))
! {
! if (phControlBar) *phControlBar = pData->hLeftBar;
! return VERT;
! }
!
! if (CanDockBar(pData->hTopBar, &rect))
! {
! if (phControlBar) *phControlBar = pData->hTopBar;
! return HORZ;
! }
!
! if (CanDockBar(pData->hRightBar, &rect))
! {
! if (phControlBar) *phControlBar = pData->hRightBar;
! return VERT;
! }
!
! if (CanDockBar(pData->hBottomBar, &rect))
! {
! if (phControlBar) *phControlBar = pData->hBottomBar;
! return HORZ;
! }
!
! return 0;
! }
!
! static void Move(DockContext *pCtxt, POINT pt)
! {
! POINT ptOffset;
!
! ptOffset.x = pt.x - pCtxt->ptLast.x;
! ptOffset.y = pt.y - pCtxt->ptLast.y;
!
! // offset all drag rects to new position
! OffsetRect(&pCtxt->rectDragHorz, ptOffset.x, ptOffset.y);
! OffsetRect(&pCtxt->rectFrameDragHorz, ptOffset.x, ptOffset.y);
! OffsetRect(&pCtxt->rectDragVert, ptOffset.x, ptOffset.y);
! OffsetRect(&pCtxt->rectFrameDragVert, ptOffset.x, ptOffset.y);
! pCtxt->ptLast = pt;
!
! // if control key is down don't dock
! pCtxt->dwOverDockStyle = pCtxt->bForceFrame ? 0 : CanDock(pCtxt, NULL);
!
! // update feedback
! DrawDockRect(pCtxt, FALSE);
! }
!
! static void OnKey(DockContext *pCtxt, int nChar, BOOL bDown)
! {
! switch (nChar)
! {
! case VK_CONTROL:
! if (pCtxt->bForceFrame == bDown)
! return;
! pCtxt->bForceFrame = bDown;
! break;
! case VK_SHIFT:
! if (pCtxt->bFlip == bDown)
! return;
! pCtxt->bFlip = bDown;
! break;
! default:
! return;
! }
!
! pCtxt->dwOverDockStyle = (pCtxt->bForceFrame) ? 0 : CanDock(pCtxt, NULL);
! DrawDockRect(pCtxt, FALSE);
! }
!
! static void EndDrag(DockContext *pCtxt)
! {
! RECT rect;
! HWND hToolBar;
! HWND hControlBar = NULL;
! LONG lStyle;
! char *szCaption;
! int nLen;
!
! hToolBar = pCtxt->hToolBar;
! lStyle = GetWindowLong(hToolBar, GWL_STYLE);
!
! CanDock(pCtxt, &hControlBar);
!
! // undock the toolbar
! UndockToolBar(GetParent(hToolBar), hToolBar);
! if (hControlBar)
! {
! if (pCtxt->dwOverDockStyle & HORZ)
! rect = pCtxt->rectDragHorz;
! else
! rect = pCtxt->rectDragVert;
!
! SetWindowLong(hToolBar, GWL_STYLE, lStyle & ~(VERT | HORZ | FLOAT) | pCtxt->dwOverDockStyle);
! ScreenToClient(hControlBar, ((POINT *) &rect));
! ScreenToClient(hControlBar, ((POINT *) &rect)+1);
!
! // dock it at the specified position
! DockToolBarToRect(hControlBar, hToolBar, rect);
! }
! else
! {
! if (((pCtxt->dwDockStyle & HORZ) && !pCtxt->bFlip) || ((pCtxt->dwDockStyle & VERT) && pCtxt->bFlip))
! rect = pCtxt->rectFrameDragHorz;
! else
! rect = pCtxt->rectFrameDragVert;
!
! SetWindowLong(hToolBar, GWL_STYLE, lStyle | FLOAT);
!
! szCaption = NULL;
! nLen = GetWindowTextLength(hToolBar);
! if (nLen > 0)
! {
! szCaption = malloc(nLen+1);
! if (!szCaption)
! szCaption = NULL;
! else
! GetWindowText(hToolBar,szCaption,nLen+1);
! }
!
! hControlBar = CreateWindowEx(WS_EX_TOOLWINDOW,
! "HCONTROLBAR",
! szCaption,
! WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SYSMENU | WS_THICKFRAME,
! 0,0,0,0,
! ghWndFrame,
! NULL,
! (HANDLE) ghModule,
! NULL);
! SetParent(hToolBar, hControlBar);
! SetWindowPos(hControlBar, NULL, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, SWP_NOZORDER);
!
! free(szCaption);
! }
! RelayoutFrameBars();
! }
!
! static void StartDrag(HWND hToolBar, POINT pos)
! {
! MSG msg;
! DockContext ctxt;
!
! // handle pending WM_PAINT messages
! while (PeekMessage(&msg, NULL, WM_PAINT, WM_PAINT, PM_NOREMOVE))
! {
! if (!GetMessage(&msg, NULL, WM_PAINT, WM_PAINT))
! return;
! DispatchMessage(&msg);
! }
!
! if (!InitDockContext(hToolBar, pos, &ctxt))
! return;
!
! // get messages until capture lost or cancelled/accepted
! while (GetCapture() == hToolBar)
! {
! if (!GetMessage(&msg, NULL, 0, 0))
! {
! PostQuitMessage((int)msg.wParam);
! break;
! }
!
! switch (msg.message)
! {
! case WM_LBUTTONUP:
! EndDrag(&ctxt);
! goto end_loop;
! case WM_MOUSEMOVE:
! Move(&ctxt, msg.pt);
! break;
! case WM_KEYUP:
! OnKey(&ctxt, (int)msg.wParam, FALSE);
! break;
! case WM_KEYDOWN:
! OnKey(&ctxt, (int)msg.wParam, TRUE);
! if (msg.wParam == VK_ESCAPE)
! goto end_loop;
! break;
! case WM_RBUTTONDOWN:
! goto end_loop;
!
! // just dispatch rest of the messages
! default:
! DispatchMessage(&msg);
! break;
! }
! }
!
! end_loop:
! DrawDockRect(&ctxt, TRUE);
! ReleaseDockContext(&ctxt);
! }
!
! LRESULT CALLBACK HToolBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
! {
! LRESULT lResult = 0;
! LONG lStyle = GetWindowLong(hWnd, GWL_STYLE);
!
! switch (uMsg)
! {
! case WM_NCCALCSIZE:
! if ((lStyle & FLOAT) == 0)
! {
! NCCALCSIZE_PARAMS *lpncsp = (NCCALCSIZE_PARAMS *) lParam;
!
! lpncsp->rgrc[0].left += CX_BORDER*2;
! lpncsp->rgrc[0].top += CY_BORDER*2;
! lpncsp->rgrc[0].right -= CX_BORDER*2;
! lpncsp->rgrc[0].bottom -= CY_BORDER*2;
!
! if (lStyle & HORZ)
! lpncsp->rgrc[0].left += CX_BORDER_GRIPPER+CX_GRIPPER+CX_BORDER_GRIPPER;
! else
! if (lStyle & VERT)
! lpncsp->rgrc[0].top += CY_BORDER_GRIPPER+CY_GRIPPER+CY_BORDER_GRIPPER;
!
! return 0;
! };
! break;
! case WM_NCHITTEST:
! {
! POINT pos;
!
! pos.x = GET_X_LPARAM(lParam);
! pos.y = GET_Y_LPARAM(lParam);
! ScreenToClient(hWnd, &pos);
! if (ToolHitTest(hWnd, pos))
! return HTCLIENT;
! else
! return HTCAPTION;
! }
! break;
! case WM_NCPAINT:
! if ((lStyle & FLOAT) == 0)
! {
! HDC hDC;
! POINT pt;
! RECT rectClient, rectWindow, rect1, rect2;
! COLORREF clrBtnHilite, clrBtnShadow;
!
! clrBtnHilite = GetSysColor(COLOR_BTNHIGHLIGHT);
! clrBtnShadow = GetSysColor(COLOR_BTNSHADOW);
!
! // get window DC that is clipped to the non-client area
! hDC = GetWindowDC(hWnd);
!
! GetClientRect(hWnd, &rectClient);
! GetWindowRect(hWnd, &rectWindow);
!
! pt.x = rectWindow.left;
! pt.y = rectWindow.top;
! ScreenToClient(hWnd, &pt);
!
! rectClient.left -= pt.x;
! rectClient.top -= pt.y;
! rectClient.right -= pt.x;
! rectClient.bottom -= pt.y;
!
! ExcludeClipRect(hDC, rectClient.left, rectClient.top, rectClient.right, rectClient.bottom);
!
! rectWindow.right = rectWindow.right-rectWindow.left;
! rectWindow.bottom = rectWindow.bottom-rectWindow.top;
! rectWindow.left = 0;
! rectWindow.top = 0;
!
! rect1 = rectWindow;
! rect2 = rectWindow;
!
! rect1.right -= CX_BORDER;
! rect1.bottom -= CY_BORDER;
! rect2.top += CY_BORDER*2;
! rect2.bottom -= CY_BORDER*2;
!
! // draw left and top dark line
! FillSolidRect(hDC, 0, rect2.top, CX_BORDER, rect2.bottom-rect2.top, clrBtnShadow);
! FillSolidRect(hDC, 0, 0, rectWindow.right, CY_BORDER, clrBtnShadow);
!
! // draw right and bottom dark line
! FillSolidRect(hDC, rect1.right, rect2.top, -CX_BORDER, rect2.bottom-rect2.top, clrBtnShadow);
! FillSolidRect(hDC, 0, rect1.bottom, rectWindow.right, -CY_BORDER, clrBtnShadow);
!
! // draw left and top hilite lines
! FillSolidRect(hDC, 1, rect2.top, CX_BORDER, rect2.bottom-rect2.top, clrBtnHilite);
! FillSolidRect(hDC, 0, 1, rectWindow.right, CY_BORDER, clrBtnHilite);
!
! // draw right and bottom
! FillSolidRect(hDC, rectWindow.right, rect2.top, -CX_BORDER, rect2.bottom-rect2.top, clrBtnHilite);
! FillSolidRect(hDC, 0, rectWindow.bottom, rectWindow.right, -CY_BORDER, clrBtnHilite);
!
! rectWindow.left += CX_BORDER*2;
! rectWindow.top += CY_BORDER*2;
! rectWindow.right -= CX_BORDER*2;
! rectWindow.bottom -= CY_BORDER*2;
!
! IntersectClipRect(hDC, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom);
!
! // erase parts not drawn
! SendMessage(hWnd, WM_ERASEBKGND, (WPARAM)hDC, 0);
!
! // draw the gripper in the border
! if (lStyle & HORZ)
! Draw3dRect(hDC,rectWindow.left+CX_BORDER_GRIPPER,
! rectWindow.top,
! CX_GRIPPER, rectWindow.bottom-rectWindow.top,
! clrBtnHilite, clrBtnShadow);
! else
! if (lStyle & VERT)
! Draw3dRect(hDC,rectWindow.left,
! rectWindow.top+CY_BORDER_GRIPPER,
! rectWindow.right-rectWindow.left, CY_GRIPPER,
! clrBtnHilite, clrBtnShadow);
!
! // release context
! ReleaseDC(hWnd, hDC);
! }
! break;
! case WM_NCLBUTTONDOWN:
! if (wParam == HTCAPTION)
! {
! POINT pos;
!
! pos.x = GET_X_LPARAM(lParam);
! pos.y = GET_Y_LPARAM(lParam);
! ScreenToClient(hWnd, &pos);
! StartDrag(hWnd, pos);
! }
! break;
! }
!
! lResult = CallWindowProc(DefToolBarProc, hWnd, uMsg, wParam, lParam);
!
! if (uMsg == WM_CREATE)
! {
! SendMessage (hWnd, TB_AUTOSIZE, (WPARAM)0, (LPARAM)0);
! SendMessage (hWnd, TB_BUTTONSTRUCTSIZE, (WPARAM) sizeof(TBBUTTON), (LPARAM) 0);
! }
!
! return lResult;
! };
!
! WindowHandle osCreateToolBar(char *name, DockPlace place, int band_num, int band_position, int offset)
{
HWND hControlBar, hWnd;
FrameData *pFrameData = (FrameData *) GetWindowLong(ghWndFrame,GWL_USERDATA);
+ LONG lStyle;
switch (place)
{
! case DockLeft:
! hControlBar = pFrameData->hLeftBar;
! lStyle = VERT;
! break;
! case DockTop:
! hControlBar = pFrameData->hTopBar;
! lStyle = HORZ;
! break;
! case DockRight:
! hControlBar = pFrameData->hRightBar;
! lStyle = VERT;
! break;
! case DockBottom:
! hControlBar = pFrameData->hBottomBar;
! lStyle = HORZ;
! break;
! default:
! return NULL;
}
! hWnd = CreateWindow ("HTOOLBAR",
! name,
! WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS
! | CCS_NOPARENTALIGN | CCS_NOMOVEY
! | CCS_NODIVIDER | CCS_NORESIZE | TBSTYLE_WRAPABLE
! | TBSTYLE_TOOLTIPS | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT
! | lStyle,
0,0,0,0,
hControlBar,
(HMENU) NULL,
(HANDLE) ghModule,
! NULL
);
! SetWindowText(hWnd, name);
! DockToolBar(hControlBar, hWnd, band_num, band_position, offset);
return hWnd;
}
***************
*** 66,72 ****
else
SendMessage(toolBar, TB_ADDBUTTONS, 1, (LPARAM)&tbb);
!
RelayoutFrameBars();
-
return btn;
}
--- 804,809 ----
else
SendMessage(toolBar, TB_ADDBUTTONS, 1, (LPARAM)&tbb);
!
RelayoutFrameBars();
return btn;
}
***************
*** 81,84 ****
--- 818,822 ----
TBBUTTON tbb;
ToolHandle btn;
+ SIZE sz;
btn = malloc(sizeof(struct ToolHandle));
***************
*** 101,104 ****
--- 839,846 ----
SendMessage(toolBar, TB_ADDBUTTONS, 1, (LPARAM)&tbb);
+ SendMessage(toolBar, TB_GETMAXSIZE, 0, (LPARAM) &sz);
+ sz.cx += CX_BORDER*4;
+ sz.cy += CY_BORDER*4;
+ SetWindowPos(toolBar, NULL, 0, 0, sz.cx, sz.cy, SWP_NOMOVE | SWP_NOZORDER);
RelayoutFrameBars();
Index: Util.c
===================================================================
RCS file: /cvsroot/htoolkit/port/src/cbits/Win32/Util.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** Util.c 12 Jul 2003 13:49:41 -0000 1.15
--- Util.c 10 Aug 2003 18:36:04 -0000 1.16
***************
*** 33,50 ****
extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
! static ATOM classDialog = 0;
! static ATOM classWindow = 0;
!
! /*
! BOOL isDialogHandle( HWND hWnd )
! {
! WINDOWINFO info;
! memset(&info,0,sizeof(info));
! info.cbSize = sizeof(info);
! GetWindowInfo( hWnd, &info );
! return (info.atomWindowType == classDialog);
! }
! */
void osInit(char *appName, char *appVersion, int DocumentInterface)
--- 33,40 ----
extern LRESULT CALLBACK HMDIWindowFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
extern LRESULT CALLBACK HDialogFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ extern LRESULT CALLBACK HControlBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+ extern LRESULT CALLBACK HToolBarFunction(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
! extern WNDPROC DefToolBarProc;
void osInit(char *appName, char *appVersion, int DocumentInterface)
***************
*** 57,61 ****
ghModule = GetModuleHandle(NULL);
! // Window class for SDIFrame
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HSDIFrameFunction;
--- 47,51 ----
ghModule = GetModuleHandle(NULL);
! // SDIFrame class
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HSDIFrameFunction;
***************
*** 70,73 ****
--- 60,64 ----
RegisterClass(&wc);
+ // SDIWindow class
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HSDIWindowFunction;
***************
*** 80,86 ****
wc.lpszMenuName = NULL;
wc.lpszClassName = "HSDIWINDOW";
! classWindow = RegisterClass(&wc);
! // Window class for Dialogs
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HDialogFunction;
--- 71,77 ----
wc.lpszMenuName = NULL;
wc.lpszClassName = "HSDIWINDOW";
! RegisterClass(&wc);
! // Dialog class
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HDialogFunction;
***************
*** 93,99 ****
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDIALOG";
! classDialog = RegisterClass(&wc);
! // Window class for MDIFrame
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HMDIFrameFunction;
--- 84,90 ----
wc.lpszMenuName = NULL;
wc.lpszClassName = "HDIALOG";
! RegisterClass(&wc);
! // MDIFrame class
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HMDIFrameFunction;
***************
*** 108,112 ****
RegisterClass(&wc);
! // Window class for MDIWindow
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HMDIWindowFunction;
--- 99,103 ----
RegisterClass(&wc);
! // MDIWindow class
wc.style = CS_DBLCLKS;
wc.lpfnWndProc = HMDIWindowFunction;
***************
*** 119,122 ****
--- 110,134 ----
wc.lpszMenuName = NULL;
wc.lpszClassName = "HMDIWINDOW";
+ RegisterClass(&wc);
+
+ // ControlBar class
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = HControlBarFunction;
+ wc.cbClsExtra = 0;
+ wc.cbWndExtra = 0;
+ wc.hInstance = ghModule;
+ wc.hIcon = NULL;
+ wc.hCursor = NULL;
+ wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1);
+ wc.lpszMenuName = NULL;
+ wc.lpszClassName = "HCONTROLBAR";
+ RegisterClass(&wc);
+
+ // ToolBar class (subclass of the standard ToolBar class)
+ GetClassInfo(ghModule, TOOLBARCLASSNAME, &wc);
+ DefToolBarProc = wc.lpfnWndProc;
+ wc.style = CS_DBLCLKS;
+ wc.lpfnWndProc = HToolBarFunction;
+ wc.lpszClassName = "HTOOLBAR";
RegisterClass(&wc);
|