don't allow clicking disabled buttons
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14435 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -152,6 +152,8 @@ public:
|
|||||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||||
const wxKeyEvent& event,
|
const wxKeyEvent& event,
|
||||||
bool pressed);
|
bool pressed);
|
||||||
|
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||||
|
const wxMouseEvent& event);
|
||||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||||
|
@@ -512,6 +512,10 @@ void wxToolBar::Press()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_toolCurrent, _T("no tool to press?") );
|
wxCHECK_RET( m_toolCurrent, _T("no tool to press?") );
|
||||||
|
|
||||||
|
wxLogTrace(_T("toolbar"),
|
||||||
|
_T("Button '%s' pressed."),
|
||||||
|
m_toolCurrent->GetShortHelp().c_str());
|
||||||
|
|
||||||
// this is the tool whose state is going to change
|
// this is the tool whose state is going to change
|
||||||
m_toolPressed = (wxToolBarTool *)m_toolCurrent;
|
m_toolPressed = (wxToolBarTool *)m_toolCurrent;
|
||||||
|
|
||||||
@@ -526,14 +530,15 @@ void wxToolBar::Release()
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_toolPressed, _T("no tool to release?") );
|
wxCHECK_RET( m_toolPressed, _T("no tool to release?") );
|
||||||
|
|
||||||
|
wxLogTrace(_T("toolbar"),
|
||||||
|
_T("Button '%s' released."),
|
||||||
|
m_toolCurrent->GetShortHelp().c_str());
|
||||||
|
|
||||||
wxASSERT_MSG( m_toolPressed->IsInverted(), _T("release unpressed button?") );
|
wxASSERT_MSG( m_toolPressed->IsInverted(), _T("release unpressed button?") );
|
||||||
|
|
||||||
m_toolPressed->Invert();
|
m_toolPressed->Invert();
|
||||||
|
|
||||||
RefreshTool(m_toolPressed);
|
RefreshTool(m_toolPressed);
|
||||||
|
|
||||||
// we're going to lose the mouse capture
|
|
||||||
m_toolPressed = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxToolBar::Toggle()
|
void wxToolBar::Toggle()
|
||||||
@@ -639,6 +644,20 @@ bool wxStdToolbarInputHandler::HandleKey(wxInputConsumer *consumer,
|
|||||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool wxStdToolbarInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||||
|
const wxMouseEvent& event)
|
||||||
|
{
|
||||||
|
// don't let the base class press the disabled buttons but simply ignore
|
||||||
|
// all events on them
|
||||||
|
wxToolBar *tbar = wxStaticCast(consumer->GetInputWindow(), wxToolBar);
|
||||||
|
wxToolBarToolBase *tool = tbar->FindToolForPosition(event.GetX(), event.GetY());
|
||||||
|
|
||||||
|
if ( tool && !tool->IsEnabled() )
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return wxStdButtonInputHandler::HandleMouse(consumer, event);
|
||||||
|
}
|
||||||
|
|
||||||
bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
bool wxStdToolbarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||||
const wxMouseEvent& event)
|
const wxMouseEvent& event)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user