X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e702ff0f08a54622a6b0f1e2ec39537b082c3a8e..61f0d452ea7e47fea18d0ab748095dc42d7dd66d:/src/common/tbarbase.cpp diff --git a/src/common/tbarbase.cpp b/src/common/tbarbase.cpp index 77034f80a4..98eed8bbd5 100644 --- a/src/common/tbarbase.cpp +++ b/src/common/tbarbase.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -55,7 +55,7 @@ wxToolBarTool::wxToolBarTool(wxToolBar *owner, int theIndex, const wxBitmap& theBitmap1, const wxBitmap& theBitmap2, bool toggle, wxObject *clientData, const wxString& helpS1, const wxString& helpS2, - GtkWidget *item ) + GtkWidget *pixmap ) #else wxToolBarTool::wxToolBarTool(int theIndex, const wxBitmap& theBitmap1, const wxBitmap& theBitmap2, bool toggle, @@ -65,7 +65,8 @@ wxToolBarTool::wxToolBarTool(int theIndex, m_toolStyle = wxTOOL_STYLE_BUTTON; #ifdef __WXGTK__ m_owner = owner; - m_item = item; + m_pixmap = pixmap; + m_item = (GtkWidget*) NULL; m_clientData = clientData; m_x = 0; m_y = 0; @@ -91,6 +92,13 @@ wxToolBarTool::wxToolBarTool(int theIndex, m_longHelpString = helpS2; } +wxToolBarTool::wxToolBarTool(wxControl *control) +{ + m_toolStyle = wxTOOL_STYLE_CONTROL; + m_control = control; + m_index = control->GetId(); +} + wxToolBarTool::~wxToolBarTool() { /* @@ -149,28 +157,6 @@ bool wxToolBarBase::OnLeftClick(int toolIndex, bool toggleDown) event.SetEventObject(this); event.SetExtraLong((long) toggleDown); - // First try sending the command to a window that has the focus, within a frame that - // also contains this toolbar. - wxFrame* frame = (wxFrame*) NULL; - wxWindow* win = this; - wxWindow* focusWin = (wxWindow*) NULL; - - while (win) - { - if (win->IsKindOf(CLASSINFO(wxFrame))) - { - frame = (wxFrame*) win; - break; - } - else - win = win->GetParent(); - } - if (frame) - focusWin = wxFindFocusDescendant(frame); - - if (focusWin && focusWin->GetEventHandler()->ProcessEvent(event)) - return TRUE; - // Send events to this toolbar instead (and thence up the window hierarchy) GetEventHandler()->ProcessEvent(event); @@ -207,7 +193,7 @@ void wxToolBarBase::OnMouseEnter ( int toolIndex ) // created and used as the pushed/toggled image. // If toggle is TRUE, the button toggles between the two states. wxToolBarTool *wxToolBarBase::AddTool(int index, const wxBitmap& bitmap, const wxBitmap& pushedBitmap, - bool toggle, long xPos, long yPos, wxObject *clientData, + bool toggle, wxCoord xPos, wxCoord yPos, wxObject *clientData, const wxString& helpString1, const wxString& helpString2) { #ifdef __WXGTK__ @@ -242,6 +228,7 @@ wxToolBarTool *wxToolBarBase::AddTool(int index, const wxBitmap& bitmap, const w void wxToolBarBase::AddSeparator () { wxToolBarTool *tool = new wxToolBarTool; + tool->m_index = -1; tool->m_toolStyle = wxTOOL_STYLE_SEPARATOR; m_tools.Append(-1, tool); } @@ -419,7 +406,7 @@ void wxToolBarBase::Command(wxCommandEvent& WXUNUSED(event)) { } -void wxToolBarBase::Layout() +void wxToolBarBase::LayoutTools() { } @@ -745,7 +732,13 @@ void wxToolBarBase::ViewStart (int *x, int *y) const *y = m_yScrollPosition; } -void wxToolBarBase::OnIdle(wxIdleEvent& event) +void wxToolBarBase::OnIdle(wxIdleEvent& +#ifdef __WXGTK__ + WXUNUSED(event) +#else + event +#endif + ) { #ifndef __WXGTK__ wxWindow::OnIdle(event); @@ -757,27 +750,7 @@ void wxToolBarBase::OnIdle(wxIdleEvent& event) // Do the toolbar button updates (check for EVT_UPDATE_UI handlers) void wxToolBarBase::DoToolbarUpdates() { - // First try sending the command to a window that has the focus, within a frame that - // also contains this toolbar. - wxFrame* frame = (wxFrame*) NULL; - wxWindow* win = this; - wxWindow* focusWin = (wxWindow*) NULL; - - while (win) - { - if (win->IsKindOf(CLASSINFO(wxFrame))) - { - frame = (wxFrame*) win; - break; - } - else - win = win->GetParent(); - } - if (frame) - focusWin = wxFindFocusDescendant(frame); - - - wxEvtHandler* evtHandler = focusWin ? focusWin->GetEventHandler() : GetEventHandler() ; + wxEvtHandler* evtHandler = GetEventHandler() ; wxNode* node = GetTools().First(); while (node) @@ -803,12 +776,4 @@ void wxToolBarBase::DoToolbarUpdates() } } -#ifdef __WXMSW__ -// Circumvent wxControl::MSWOnMouseMove which doesn't set the cursor. -void wxToolBarBase::MSWOnMouseMove(int x, int y, WXUINT flags) -{ - wxWindow::MSWOnMouseMove(x, y, flags); -} -#endif - #endif