summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Zenker <kz@openoffice.org>2010-01-18 11:14:08 +0100
committerKurt Zenker <kz@openoffice.org>2010-01-18 11:14:08 +0100
commitbfb498d0c42d3d86129fd730f3fc34e2542736eb (patch)
tree9c6cbbe065f3e6ec088a432ebf426040071a6b63
parent8ad567a9f81ac92a5bf7592eab0179876c1dafab (diff)
parentd04edead2cc8bcb9f2bfef829f1a25ec75070fc3 (diff)
CWS-TOOLING: integrate CWS menuincustomtoolbar
-rw-r--r--vcl/inc/vcl/menu.hxx2
-rw-r--r--vcl/inc/vcl/toolbox.hxx3
-rw-r--r--vcl/source/window/toolbox.cxx26
3 files changed, 27 insertions, 4 deletions
diff --git a/vcl/inc/vcl/menu.hxx b/vcl/inc/vcl/menu.hxx
index 8d3ac4e8b505..66f35823b06a 100644
--- a/vcl/inc/vcl/menu.hxx
+++ b/vcl/inc/vcl/menu.hxx
@@ -93,6 +93,8 @@ typedef USHORT MenuItemBits;
#define MIB_POPUPSELECT ((MenuItemBits)0x0020)
// not in rsc/vclsrc.hxx because only a prelimitary solution
#define MIB_NOSELECT ((MenuItemBits)0x0040)
+#define MIB_ICON ((MenuItemBits)0x0080)
+#define MIB_TEXT ((MenuItemBits)0x0100)
#define MENU_FLAG_NOAUTOMNEMONICS 0x0001
#define MENU_FLAG_HIDEDISABLEDENTRIES 0x0002
diff --git a/vcl/inc/vcl/toolbox.hxx b/vcl/inc/vcl/toolbox.hxx
index 6e4c300ccc40..c2547e4b01ba 100644
--- a/vcl/inc/vcl/toolbox.hxx
+++ b/vcl/inc/vcl/toolbox.hxx
@@ -124,6 +124,9 @@ typedef USHORT ToolBoxItemBits;
#define TIB_DROPDOWN ((ToolBoxItemBits)0x0020)
#define TIB_REPEAT ((ToolBoxItemBits)0x0040)
#define TIB_DROPDOWNONLY ((ToolBoxItemBits)0x0080 | TIB_DROPDOWN) // this button has only drop down functionality
+#define TIB_TEXT_ONLY ((ToolBoxItemBits)0x0100)
+#define TIB_ICON_ONLY ((ToolBoxItemBits)0x0200)
+#define TIB_TEXTICON ((ToolBoxItemBits) TIB_TEXT_ONLY | TIB_ICON_ONLY )
// -----------------
// - ToolBox-Types -
diff --git a/vcl/source/window/toolbox.cxx b/vcl/source/window/toolbox.cxx
index 8aa4926f5e1a..ef58ea9e6bc6 100644
--- a/vcl/source/window/toolbox.cxx
+++ b/vcl/source/window/toolbox.cxx
@@ -229,6 +229,22 @@ int ToolBox::ImplGetDragWidth( ToolBox* pThis )
}
return width;
}
+
+ButtonType determineButtonType( ImplToolItem* pItem, ButtonType defaultType )
+{
+ ButtonType tmpButtonType = defaultType;
+ ToolBoxItemBits nBits( pItem->mnBits & 0x300 );
+ if ( nBits & TIB_TEXTICON ) // item has custom setting
+ {
+ tmpButtonType = BUTTON_SYMBOLTEXT;
+ if ( nBits == TIB_TEXT_ONLY )
+ tmpButtonType = BUTTON_TEXT;
+ else if ( nBits == TIB_ICON_ONLY )
+ tmpButtonType = BUTTON_SYMBOL;
+ }
+ return tmpButtonType;
+}
+
// -----------------------------------------------------------------------
void ToolBox::ImplUpdateDragArea( ToolBox *pThis )
@@ -1992,12 +2008,13 @@ BOOL ToolBox::ImplCalcItem()
bText = FALSE;
else
bText = TRUE;
-
+ ButtonType tmpButtonType = determineButtonType( &(*it), meButtonType ); // default to toolbox setting
if ( bImage || bText )
{
+
it->mbEmptyBtn = FALSE;
- if ( meButtonType == BUTTON_SYMBOL )
+ if ( tmpButtonType == BUTTON_SYMBOL )
{
// we're drawing images only
if ( bImage || !bText )
@@ -2011,7 +2028,7 @@ BOOL ToolBox::ImplCalcItem()
it->mbVisibleText = TRUE;
}
}
- else if ( meButtonType == BUTTON_TEXT )
+ else if ( tmpButtonType == BUTTON_TEXT )
{
// we're drawing text only
if ( bText || !bImage )
@@ -3625,7 +3642,8 @@ void ToolBox::ImplDrawItem( USHORT nPos, BOOL bHighlight, BOOL bPaint, BOOL bLay
// determine what has to be drawn on the button: image, text or both
BOOL bImage;
BOOL bText;
- pItem->DetermineButtonDrawStyle( meButtonType, bImage, bText );
+ ButtonType tmpButtonType = determineButtonType( pItem, meButtonType ); // default to toolbox setting
+ pItem->DetermineButtonDrawStyle( tmpButtonType, bImage, bText );
// compute output values
long nBtnWidth = aBtnSize.Width()-SMALLBUTTON_HSIZE;