X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/6a23cbcede2d878401c64df3be34bef6331e1dcd..520e470fdd0daef09c77938db642e4583933c90d:/src/msw/tbar95.cpp diff --git a/src/msw/tbar95.cpp b/src/msw/tbar95.cpp index 66a1aa5937..772e4cab64 100644 --- a/src/msw/tbar95.cpp +++ b/src/msw/tbar95.cpp @@ -24,7 +24,7 @@ #include "wx.h" #endif -#if USE_BUTTONBAR && USE_TOOLBAR && defined(__WIN95__) +#if wxUSE_BUTTONBAR && wxUSE_TOOLBAR && defined(__WIN95__) #ifndef __GNUWIN32__ #include "malloc.h" @@ -64,6 +64,12 @@ Set the TBSTYLE_CUSTOMERASE style, then handle the NM_CUSTOMDRAW message and do your custom drawing. */ +#define DEFAULTBITMAPX 16 +#define DEFAULTBITMAPY 15 +#define DEFAULTBUTTONX 24 +#define DEFAULTBUTTONY 24 +#define DEFAULTBARHEIGHT 27 + #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxToolBar95, wxToolBarBase) @@ -80,9 +86,6 @@ void wxMapBitmap(HBITMAP hBitmap, int width, int height); wxToolBar95::wxToolBar95(void) { - m_tilingDirection = wxVERTICAL ; - m_rowsOrColumns = 0; - m_currentRowsOrColumns = 0; m_maxWidth = -1; m_maxHeight = -1; m_hBitmap = 0; @@ -91,22 +94,14 @@ wxToolBar95::wxToolBar95(void) } bool wxToolBar95::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, int orientation, - int RowsOrColumns, const wxString& name) + long style, const wxString& name) { m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); m_foregroundColour = *wxBLACK ; - m_defaultForegroundColour = *wxBLACK ; - m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), - GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); - - m_tilingDirection = orientation; - if (m_tilingDirection == wxHORIZONTAL) - wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports vertical tiling.\nPass the number of rows.", "wxToolBar95 usage", wxOK); - m_rowsOrColumns = RowsOrColumns; - m_currentRowsOrColumns = 0; + if (style & wxTB_VERTICAL) + wxMessageBox("Sorry, wxToolBar95 under Windows 95 only supports horizontal orientation.", "wxToolBar95 usage", wxOK); m_maxWidth = -1; m_maxHeight = -1; @@ -305,7 +300,7 @@ bool wxToolBar95::CreateTools(void) ans = (int)::SendMessage((HWND) GetHWND(), TB_AUTOSIZE, (WPARAM)0, (LPARAM) 0); RECT rect; - ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_rowsOrColumns, TRUE), (LPARAM) & rect); + ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect); m_maxWidth = (rect.right - rect.left + 2); m_maxHeight = (rect.bottom - rect.top + 2); @@ -368,7 +363,7 @@ bool wxToolBar95::MSWNotify(WXWPARAM WXUNUSED(wParam), WXLPARAM lParam) return TRUE; } -void wxToolBar95::SetDefaultSize(const wxSize& size) +void wxToolBar95::SetToolBitmapSize(const wxSize& size) { m_defaultWidth = size.x; m_defaultHeight = size.y; ::SendMessage((HWND) GetHWND(), TB_SETBITMAPSIZE, 0, (LPARAM) MAKELONG ((int)size.x, (int)size.y)); @@ -384,10 +379,10 @@ void wxToolBar95::SetRows(int nRows) wxSize wxToolBar95::GetMaxSize(void) const { - if (m_maxWidth == -1 | m_maxHeight == -1) + if ((m_maxWidth == -1) || (m_maxHeight == -1)) { RECT rect; - ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_rowsOrColumns, TRUE), (LPARAM) & rect); + ::SendMessage((HWND) GetHWND(), TB_SETROWS, MAKEWPARAM(m_maxRows, TRUE), (LPARAM) & rect); ((wxToolBar95 *)this)->m_maxWidth = (rect.right - rect.left + 2); // ??? ((wxToolBar95 *)this)->m_maxHeight = (rect.bottom - rect.top + 2); // ??? } @@ -403,7 +398,7 @@ void wxToolBar95::GetSize(int *w, int *h) const } // The button size is bigger than the bitmap size -wxSize wxToolBar95::GetDefaultButtonSize(void) const +wxSize wxToolBar95::GetToolSize(void) const { return wxSize(m_defaultWidth + 8, m_defaultHeight + 7); } @@ -433,6 +428,11 @@ void wxToolBar95::ToggleTool(int toolIndex, bool toggle) } } +bool wxToolBar95::GetToolState(int toolIndex) const +{ + return (::SendMessage((HWND) GetHWND(), TB_ISBUTTONCHECKED, (WPARAM)toolIndex, (LPARAM)0) != 0); +} + void wxToolBar95::ClearTools(void) { // TODO: Don't know how to reset the toolbar bitmap, as yet. @@ -447,7 +447,7 @@ void wxToolBar95::ClearTools(void) wxToolBarTool *wxToolBar95::AddTool(int index, const wxBitmap& bitmap, const wxBitmap& pushedBitmap, bool toggle, long xPos, long yPos, wxObject *clientData, const wxString& helpString1, const wxString& helpString2) { - wxToolBarTool *tool = new wxToolBarTool(index, bitmap, (wxBitmap *)NULL, toggle, xPos, yPos, helpString1, helpString2); + wxToolBarTool *tool = new wxToolBarTool(index, bitmap, wxNullBitmap, toggle, xPos, yPos, helpString1, helpString2); tool->m_clientData = clientData; if (xPos > -1) @@ -471,8 +471,6 @@ void wxToolBar95::OnSysColourChanged(wxSysColourChangedEvent& event) { m_backgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); - m_defaultBackgroundColour = wxColour(GetRValue(GetSysColor(COLOR_BTNFACE)), - GetGValue(GetSysColor(COLOR_BTNFACE)), GetBValue(GetSysColor(COLOR_BTNFACE))); // Remap the buttons CreateTools();