Fixes for WinCE toolbar

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32932 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2005-03-20 12:02:55 +00:00
parent 86231bdca2
commit 4012b958f2
2 changed files with 25 additions and 9 deletions

View File

@@ -520,6 +520,11 @@ bool wxToolBar::Realize()
const bool isVertical = HasFlag(wxTB_VERTICAL); const bool isVertical = HasFlag(wxTB_VERTICAL);
bool doRemap, doRemapBg, doTransparent; bool doRemap, doRemapBg, doTransparent;
#ifdef __WXWINCE__
doRemapBg = false;
doRemap = false;
doTransparent = false;
#else
if (wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 2) if (wxSystemOptions::GetOptionInt(wxT("msw.remap")) == 2)
{ {
doRemapBg = doRemap = false; doRemapBg = doRemap = false;
@@ -531,6 +536,7 @@ bool wxToolBar::Realize()
doRemapBg = !doRemap; doRemapBg = !doRemap;
doTransparent = false; doTransparent = false;
} }
#endif
// delete all old buttons, if any // delete all old buttons, if any
for ( size_t pos = 0; pos < m_nButtons; pos++ ) for ( size_t pos = 0; pos < m_nButtons; pos++ )
@@ -570,15 +576,20 @@ bool wxToolBar::Realize()
wxMemoryDC dcAllButtons; wxMemoryDC dcAllButtons;
wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight); wxBitmap bitmap(totalBitmapWidth, totalBitmapHeight);
dcAllButtons.SelectObject(bitmap); dcAllButtons.SelectObject(bitmap);
#ifdef __WXWINCE__
dcAllButtons.SetBackground(wxBrush(wxColour(192,192,192)));
#else
if (doTransparent) if (doTransparent)
dcAllButtons.SetBackground(*wxTRANSPARENT_BRUSH); dcAllButtons.SetBackground(*wxTRANSPARENT_BRUSH);
else else
dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH); dcAllButtons.SetBackground(*wxLIGHT_GREY_BRUSH);
#endif
dcAllButtons.Clear(); dcAllButtons.Clear();
m_hBitmap = bitmap.GetHBITMAP(); m_hBitmap = bitmap.GetHBITMAP();
HBITMAP hBitmap = (HBITMAP)m_hBitmap; HBITMAP hBitmap = (HBITMAP)m_hBitmap;
#ifndef __WXWINCE__
if (doRemapBg) if (doRemapBg)
{ {
dcAllButtons.SelectObject(wxNullBitmap); dcAllButtons.SelectObject(wxNullBitmap);
@@ -590,6 +601,7 @@ bool wxToolBar::Realize()
dcAllButtons.SelectObject(bitmap); dcAllButtons.SelectObject(bitmap);
} }
#endif
// the button position // the button position
wxCoord x = 0; wxCoord x = 0;
@@ -1434,20 +1446,22 @@ WXLRESULT wxToolBar::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam
{ {
switch ( nMsg ) switch ( nMsg )
{ {
case WM_MOUSEMOVE:
// we don't handle mouse moves, so always pass the message to
// wxControl::MSWWindowProc (HandleMouseMove just calls OnMouseEnter)
HandleMouseMove(wParam, lParam);
break;
case WM_SIZE: case WM_SIZE:
if ( HandleSize(wParam, lParam) ) if ( HandleSize(wParam, lParam) )
return 0; return 0;
break; break;
case WM_MOUSEMOVE: #ifndef __WXWINCE__
// we don't handle mouse moves, so always pass the message to
// wxControl::MSWWindowProc
HandleMouseMove(wParam, lParam);
break;
case WM_PAINT: case WM_PAINT:
if ( HandlePaint(wParam, lParam) ) if ( HandlePaint(wParam, lParam) )
return 0; return 0;
#endif
} }
return wxControl::MSWWindowProc(nMsg, wParam, lParam); return wxControl::MSWWindowProc(nMsg, wParam, lParam);

View File

@@ -355,7 +355,7 @@ bool wxToolMenuBar::DoDeleteTool(size_t pos, wxToolBarToolBase *tool)
return true; return true;
} }
bool wxToolMenuBar:Realize() bool wxToolMenuBar::Realize()
{ {
const size_t nTools = GetToolsCount(); const size_t nTools = GetToolsCount();
if ( nTools == 0 ) if ( nTools == 0 )
@@ -393,6 +393,7 @@ bool wxToolMenuBar:Realize()
case wxTOOL_STYLE_CONTROL: case wxTOOL_STYLE_CONTROL:
button.idCommand = tool->GetId(); button.idCommand = tool->GetId();
// fall through: create just a separator too // fall through: create just a separator too
// TODO: controls are not yet supported on wxToolMenuBar.
case wxTOOL_STYLE_SEPARATOR: case wxTOOL_STYLE_SEPARATOR:
button.fsState = TBSTATE_ENABLED; button.fsState = TBSTATE_ENABLED;
@@ -419,7 +420,8 @@ bool wxToolMenuBar:Realize()
wxMemoryDC memDC; wxMemoryDC memDC;
wxBitmap b(16,16); wxBitmap b(16,16);
memDC.SelectObject(b); memDC.SelectObject(b);
memDC.SetBackground(wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE))); wxColour col = wxColour(192,192,192);
memDC.SetBackground(wxBrush(col));
memDC.Clear(); memDC.Clear();
int x = (16 - bmp.GetWidth())/2; int x = (16 - bmp.GetWidth())/2;
int y = (16 - bmp.GetHeight())/2; int y = (16 - bmp.GetHeight())/2;