wxInputConsumer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11664 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -139,14 +139,14 @@ class WXDLLEXPORT wxStdButtonInputHandler : public wxStdInputHandler
|
||||
public:
|
||||
wxStdButtonInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
|
||||
private:
|
||||
// the window (button) which has capture or NULL and the flag telling if
|
||||
|
@@ -155,7 +155,7 @@ public:
|
||||
|
||||
// we have to override this one as wxStdButtonInputHandler version works
|
||||
// only with the buttons
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKBOX_H_
|
||||
|
@@ -102,10 +102,10 @@ class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandle
|
||||
public:
|
||||
wxStdCheckListboxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
};
|
||||
|
||||
|
@@ -303,7 +303,7 @@ class WXDLLEXPORT wxStdComboBoxInputHandler : public wxStdInputHandler
|
||||
public:
|
||||
wxStdComboBoxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
};
|
||||
|
@@ -24,6 +24,8 @@ class WXDLLEXPORT wxRenderer;
|
||||
// it
|
||||
#include "wx/univ/inphand.h"
|
||||
|
||||
#include "wx/univ/inpcons.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlAction: the action is currently just a string which identifies it,
|
||||
// later it might become an atom (i.e. an opaque handler to string).
|
||||
@@ -40,7 +42,7 @@ typedef wxString wxControlAction;
|
||||
// wxControl: the base class for all GUI controls
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxControl : public wxControlBase
|
||||
class WXDLLEXPORT wxControl : public wxControlBase, public wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxControl() { Init(); }
|
||||
@@ -85,39 +87,12 @@ public:
|
||||
return m_indexAccel == -1 ? _T('\0') : m_label[m_indexAccel];
|
||||
}
|
||||
|
||||
// get the input handler of this control
|
||||
wxInputHandler *GetInputHandler() const { return m_handler; }
|
||||
|
||||
// perform a control-dependent action: an action may have an optional
|
||||
// numeric and another (also optional) string argument whose interpretation
|
||||
// depends on the action
|
||||
//
|
||||
// NB: we might use ellipsis in PerformAction() declaration but this
|
||||
// wouldn't be more efficient than always passing 2 unused parameters
|
||||
// but would be more difficult. Another solution would be to have
|
||||
// several overloaded versions but this will expose the problem of
|
||||
// virtual function hiding we don't have here.
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
virtual wxWindow *GetInputWindow() const { return (wxWindow*)this; }
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnMouse(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
|
||||
// create input handler by name
|
||||
void CreateInputHandler(const wxString& inphandler);
|
||||
|
||||
// input processor (never deleted, the theme deletes it itself)
|
||||
wxInputHandler *m_handler;
|
||||
|
||||
private:
|
||||
// label and accel info
|
||||
wxString m_label;
|
||||
@@ -125,6 +100,7 @@ private:
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxControl)
|
||||
DECLARE_EVENT_TABLE()
|
||||
WX_DECLARE_INPUT_CONSUMER()
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CONTROL_H_
|
||||
|
140
include/wx/univ/inpcons.h
Normal file
140
include/wx/univ/inpcons.h
Normal file
@@ -0,0 +1,140 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: wx/univ/inpcons.h
|
||||
// Purpose: wxInputConsumer: mix-in class for input handling
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_UNIV_INPCONS_H_
|
||||
#define _WX_UNIV_INPCONS_H_
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma interface "inpcons.h"
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
class WXDLLEXPORT wxWindow;
|
||||
|
||||
#include "wx/object.h"
|
||||
#include "wx/event.h"
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxControlAction: the action is currently just a string which identifies it,
|
||||
// later it might become an atom (i.e. an opaque handler to string).
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
typedef wxString wxControlAction;
|
||||
|
||||
// the list of actions which apply to all controls (other actions are defined
|
||||
// in the controls headers)
|
||||
|
||||
#define wxACTION_NONE _T("") // no action to perform
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxInputConsumer: mix-in class for handling wxControlActions (used by
|
||||
// wxControl and wxTopLevelWindow).
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxInputConsumer() { m_inputHandler = NULL; }
|
||||
|
||||
// get the input handler
|
||||
wxInputHandler *GetInputHandler() const { return m_inputHandler; }
|
||||
|
||||
// perform a control-dependent action: an action may have an optional
|
||||
// numeric and another (also optional) string argument whose interpretation
|
||||
// depends on the action
|
||||
//
|
||||
// NB: we might use ellipsis in PerformAction() declaration but this
|
||||
// wouldn't be more efficient than always passing 2 unused parameters
|
||||
// but would be more difficult. Another solution would be to have
|
||||
// several overloaded versions but this will expose the problem of
|
||||
// virtual function hiding we don't have here.
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// get the window to work with (usually the class wxInputConsumer was mixed into)
|
||||
virtual wxWindow *GetInputWindow() const = 0;
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnMouse(wxMouseEvent& event);
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// create input handler by name
|
||||
void CreateInputHandler(const wxString& inphandler);
|
||||
|
||||
// input processor (never deleted, the theme deletes it itself)
|
||||
wxInputHandler *m_inputHandler;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// macros which must be used by the classes derived from wxInputConsumer mix-in
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// declare the methods to be forwarded
|
||||
#define WX_DECLARE_INPUT_CONSUMER() \
|
||||
private: \
|
||||
void OnMouse(wxMouseEvent& event); \
|
||||
void OnKeyDown(wxKeyEvent& event); \
|
||||
void OnKeyUp(wxKeyEvent& event); \
|
||||
void OnFocus(wxFocusEvent& event); \
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// implement the event table entries for wxControlContainer
|
||||
#define WX_EVENT_TABLE_INPUT_CONSUMER(classname) \
|
||||
EVT_KEY_DOWN(classname::OnKeyDown) \
|
||||
EVT_KEY_UP(classname::OnKeyUp) \
|
||||
EVT_MOUSE_EVENTS(classname::OnMouse) \
|
||||
EVT_SET_FOCUS(classname::OnFocus) \
|
||||
EVT_KILL_FOCUS(classname::OnFocus) \
|
||||
EVT_ACTIVATE(classname::OnActivate)
|
||||
|
||||
// Forward event handlers to wxInputConsumer
|
||||
//
|
||||
// (We can't use them directly, because wxIC has virtual methods, which forces
|
||||
// the compiler to include (at least) two vtables into wxControl, one for the
|
||||
// wxWindow-wxControlBase-wxControl branch and one for the wxIC mix-in.
|
||||
// Consequently, the "this" pointer has different value when in wxControl's
|
||||
// and wxIC's method, even though the instance stays same. This doesn't matter
|
||||
// so far as member pointers aren't used, but that's not wxControl's case.
|
||||
// When we add an event table entry (= use a member pointer) pointing to
|
||||
// wxIC's OnXXX method, GCC compiles code that executes wxIC::OnXXX with the
|
||||
// version of "this" that belongs to wxControl, not wxIC! In our particular
|
||||
// case, the effect is that m_handler is NULL (probably same memory
|
||||
// area as the_other_vtable's_this->m_refObj) and input handling doesn't work.)
|
||||
#define WX_FORWARD_TO_INPUT_CONSUMER(classname) \
|
||||
void classname::OnMouse(wxMouseEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnMouse(event); \
|
||||
} \
|
||||
void classname::OnKeyDown(wxKeyEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnKeyDown(event); \
|
||||
} \
|
||||
void classname::OnKeyUp(wxKeyEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnKeyUp(event); \
|
||||
} \
|
||||
void classname::OnFocus(wxFocusEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnFocus(event); \
|
||||
} \
|
||||
void classname::OnActivate(wxActivateEvent& event) \
|
||||
{ \
|
||||
wxInputConsumer::OnActivate(event); \
|
||||
}
|
||||
|
||||
|
||||
#endif // _WX_UNIV_INPCONS_H_
|
@@ -17,7 +17,7 @@
|
||||
#pragma interface "inphand.h"
|
||||
#endif
|
||||
|
||||
#include "wx/control.h" // for wxControlAction(s)
|
||||
#include "wx/univ/inpcons.h" // for wxControlAction(s)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// types of the standard input handlers which can be passed to
|
||||
@@ -41,23 +41,23 @@
|
||||
// wxInputHandler: maps the events to the actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxInputHandler
|
||||
class WXDLLEXPORT wxInputHandler : public wxObject
|
||||
{
|
||||
public:
|
||||
// map a keyboard event to one or more actions (pressed == TRUE if the key
|
||||
// was pressed, FALSE if released), returns TRUE if something was done
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed) = 0;
|
||||
|
||||
// map a mouse (click) event to one or more actions
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event) = 0;
|
||||
|
||||
// handle mouse movement (or enter/leave) event: it is separated from
|
||||
// HandleMouse() for convenience as many controls don't care about mouse
|
||||
// movements at all
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
// do something with focus set/kill event: this is different from
|
||||
@@ -65,12 +65,12 @@ public:
|
||||
// focus
|
||||
//
|
||||
// return TRUE to refresh the control, FALSE otherwise
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
|
||||
// react to the app getting/losing activation
|
||||
//
|
||||
// return TRUE to refresh the control, FALSE otherwise
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
|
||||
// virtual dtor for any base class
|
||||
virtual ~wxInputHandler();
|
||||
@@ -86,28 +86,28 @@ class WXDLLEXPORT wxStdInputHandler : public wxInputHandler
|
||||
public:
|
||||
wxStdInputHandler(wxInputHandler *handler) : m_handler(handler) { }
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
return m_handler ? m_handler->HandleKey(control, event, pressed)
|
||||
return m_handler ? m_handler->HandleKey(consumer, event, pressed)
|
||||
: FALSE;
|
||||
}
|
||||
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleMouse(control, event) : FALSE;
|
||||
return m_handler ? m_handler->HandleMouse(consumer, event) : FALSE;
|
||||
}
|
||||
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event)
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleMouseMove(control, event) : FALSE;
|
||||
return m_handler ? m_handler->HandleMouseMove(consumer, event) : FALSE;
|
||||
}
|
||||
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event)
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event)
|
||||
{
|
||||
return m_handler ? m_handler->HandleFocus(control, event) : FALSE;
|
||||
return m_handler ? m_handler->HandleFocus(consumer, event) : FALSE;
|
||||
}
|
||||
|
||||
private:
|
||||
|
@@ -290,12 +290,12 @@ public:
|
||||
bool toggleOnPressAlways = TRUE);
|
||||
|
||||
// base class methods
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
protected:
|
||||
|
@@ -259,17 +259,17 @@ class WXDLLEXPORT wxStdNotebookInputHandler : public wxStdInputHandler
|
||||
public:
|
||||
wxStdNotebookInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxControl *control, bool activated);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
|
||||
protected:
|
||||
void HandleFocusChange(wxControl *control);
|
||||
void HandleFocusChange(wxInputConsumer *consumer);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_NOTEBOOK_H_
|
||||
|
@@ -170,12 +170,12 @@ public:
|
||||
wxStdScrollBarInputHandler(wxRenderer *renderer,
|
||||
wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control, const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||
|
||||
virtual ~wxStdScrollBarInputHandler();
|
||||
|
||||
|
@@ -231,15 +231,15 @@ public:
|
||||
}
|
||||
|
||||
// base class methods
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SLIDER_H_
|
||||
|
@@ -107,12 +107,12 @@ class WXDLLEXPORT wxStdSpinButtonInputHandler : public wxStdInputHandler
|
||||
public:
|
||||
wxStdSpinButtonInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
};
|
||||
|
||||
|
@@ -562,14 +562,14 @@ class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
|
||||
public:
|
||||
wxStdTextCtrlInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxControl *control,
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxControl *control,
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxControl *control,
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxControl *control, const wxFocusEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
|
||||
protected:
|
||||
// get the position of the mouse click
|
||||
|
@@ -258,22 +258,22 @@ wxStdButtonInputHandler::wxStdButtonInputHandler(wxInputHandler *handler)
|
||||
m_winHasMouse = FALSE;
|
||||
}
|
||||
|
||||
bool wxStdButtonInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdButtonInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
int keycode = event.GetKeyCode();
|
||||
if ( keycode == WXK_SPACE || keycode == WXK_RETURN )
|
||||
{
|
||||
control->PerformAction(wxACTION_BUTTON_TOGGLE);
|
||||
consumer->PerformAction(wxACTION_BUTTON_TOGGLE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdButtonInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdButtonInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
// the button has 2 states: pressed and normal with the following
|
||||
@@ -288,11 +288,11 @@ bool wxStdButtonInputHandler::HandleMouse(wxControl *control,
|
||||
{
|
||||
if ( event.ButtonDown(1) )
|
||||
{
|
||||
m_winCapture = control;
|
||||
m_winCapture = consumer->GetInputWindow();
|
||||
m_winCapture->CaptureMouse();
|
||||
m_winHasMouse = TRUE;
|
||||
|
||||
control->PerformAction(wxACTION_BUTTON_PRESS);
|
||||
consumer->PerformAction(wxACTION_BUTTON_PRESS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ bool wxStdButtonInputHandler::HandleMouse(wxControl *control,
|
||||
if ( m_winHasMouse )
|
||||
{
|
||||
// this will generate a click event
|
||||
control->PerformAction(wxACTION_BUTTON_TOGGLE);
|
||||
consumer->PerformAction(wxACTION_BUTTON_TOGGLE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -316,10 +316,10 @@ bool wxStdButtonInputHandler::HandleMouse(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
// we only have to do something when the mouse leaves/enters the pressed
|
||||
@@ -333,8 +333,8 @@ bool wxStdButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
m_winHasMouse = FALSE;
|
||||
|
||||
// we do have a pressed button, so release it
|
||||
control->SetCurrent(FALSE);
|
||||
control->PerformAction(wxACTION_BUTTON_RELEASE);
|
||||
consumer->GetInputWindow()->SetCurrent(FALSE);
|
||||
consumer->PerformAction(wxACTION_BUTTON_RELEASE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -347,17 +347,17 @@ bool wxStdButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
|
||||
// we did have a pressed button which we released when leaving the
|
||||
// window, press it again
|
||||
control->SetCurrent(TRUE);
|
||||
control->PerformAction(wxACTION_BUTTON_PRESS);
|
||||
consumer->GetInputWindow()->SetCurrent(TRUE);
|
||||
consumer->PerformAction(wxACTION_BUTTON_PRESS);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdButtonInputHandler::HandleFocus(wxControl *control,
|
||||
bool wxStdButtonInputHandler::HandleFocus(wxInputConsumer *consumer,
|
||||
const wxFocusEvent& event)
|
||||
{
|
||||
// buttons change appearance when they get/lose focus, so return TRUE to
|
||||
@@ -365,12 +365,12 @@ bool wxStdButtonInputHandler::HandleFocus(wxControl *control,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxStdButtonInputHandler::HandleActivation(wxControl *control,
|
||||
bool wxStdButtonInputHandler::HandleActivation(wxInputConsumer *consumer,
|
||||
bool activated)
|
||||
{
|
||||
// the default button changes appearance when the app is [de]activated, so
|
||||
// return TRUE to refresh
|
||||
return wxStaticCast(control, wxButton)->IsDefault();
|
||||
return wxStaticCast(consumer->GetInputWindow(), wxButton)->IsDefault();
|
||||
}
|
||||
|
||||
#endif // wxUSE_BUTTON
|
||||
|
@@ -276,12 +276,12 @@ wxStdCheckboxInputHandler::wxStdCheckboxInputHandler(wxInputHandler *inphand)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStdCheckboxInputHandler::HandleActivation(wxControl *control,
|
||||
bool wxStdCheckboxInputHandler::HandleActivation(wxInputConsumer *consumer,
|
||||
bool activated)
|
||||
{
|
||||
// only the focused checkbox appearance changes when the app gains/loses
|
||||
// activation
|
||||
return control->IsFocused();
|
||||
return consumer->GetInputWindow()->IsFocused();
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHECKBOX
|
||||
|
@@ -211,26 +211,26 @@ wxStdCheckListboxInputHandler(wxInputHandler *inphand)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStdCheckListboxInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdCheckListboxInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
if ( pressed && (event.GetKeyCode() == WXK_SPACE) )
|
||||
control->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE);
|
||||
consumer->PerformAction(wxACTION_CHECKLISTBOX_TOGGLE);
|
||||
|
||||
return wxStdListboxInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdListboxInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdCheckListboxInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdCheckListboxInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
if ( event.LeftDown() || event.LeftDClick() )
|
||||
{
|
||||
wxCheckListBox *lbox = wxStaticCast(control, wxCheckListBox);
|
||||
wxCheckListBox *lbox = wxStaticCast(consumer->GetInputWindow(), wxCheckListBox);
|
||||
int x, y;
|
||||
|
||||
wxPoint pt = event.GetPosition();
|
||||
pt -= control->GetClientAreaOrigin();
|
||||
pt -= consumer->GetInputWindow()->GetClientAreaOrigin();
|
||||
lbox->CalcUnscrolledPosition(pt.x, pt.y, &x, &y);
|
||||
|
||||
wxRenderer *renderer = lbox->GetRenderer();
|
||||
@@ -248,7 +248,7 @@ bool wxStdCheckListboxInputHandler::HandleMouse(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdListboxInputHandler::HandleMouse(control, event);
|
||||
return wxStdListboxInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
#endif // wxUSE_CHECKLISTBOX
|
||||
|
@@ -830,7 +830,7 @@ wxStdComboBoxInputHandler::wxStdComboBoxInputHandler(wxInputHandler *inphand)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStdComboBoxInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdComboBoxInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
@@ -850,13 +850,13 @@ bool wxStdComboBoxInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( !!action )
|
||||
{
|
||||
control->PerformAction(action);
|
||||
consumer->PerformAction(action);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
#endif // wxUSE_COMBOBOX
|
||||
|
@@ -46,17 +46,11 @@
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxControl, wxWindow)
|
||||
|
||||
BEGIN_EVENT_TABLE(wxControl, wxControlBase)
|
||||
EVT_KEY_DOWN(wxControl::OnKeyDown)
|
||||
EVT_KEY_UP(wxControl::OnKeyUp)
|
||||
|
||||
EVT_MOUSE_EVENTS(wxControl::OnMouse)
|
||||
|
||||
EVT_SET_FOCUS(wxControl::OnFocus)
|
||||
EVT_KILL_FOCUS(wxControl::OnFocus)
|
||||
|
||||
EVT_ACTIVATE(wxControl::OnActivate)
|
||||
WX_EVENT_TABLE_INPUT_CONSUMER(wxControl)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
WX_FORWARD_TO_INPUT_CONSUMER(wxControl)
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// creation
|
||||
// ----------------------------------------------------------------------------
|
||||
@@ -65,7 +59,7 @@ void wxControl::Init()
|
||||
{
|
||||
m_indexAccel = -1;
|
||||
|
||||
m_handler = (wxInputHandler *)NULL;
|
||||
m_inputHandler = (wxInputHandler *)NULL;
|
||||
}
|
||||
|
||||
bool wxControl::Create(wxWindow *parent,
|
||||
@@ -153,75 +147,4 @@ wxString wxControl::GetLabel() const
|
||||
return m_label;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// focus/activation handling
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxControl::OnFocus(wxFocusEvent& event)
|
||||
{
|
||||
if ( m_handler && m_handler->HandleFocus(this, event) )
|
||||
Refresh();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxControl::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
if ( m_handler && m_handler->HandleActivation(this, event.GetActive()) )
|
||||
Refresh();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// input processing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxControl::CreateInputHandler(const wxString& inphandler)
|
||||
{
|
||||
m_handler = wxTheme::Get()->GetInputHandler(inphandler);
|
||||
}
|
||||
|
||||
void wxControl::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if ( !m_handler || !m_handler->HandleKey(this, event, TRUE) )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxControl::OnKeyUp(wxKeyEvent& event)
|
||||
{
|
||||
if ( !m_handler || !m_handler->HandleKey(this, event, FALSE) )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxControl::OnMouse(wxMouseEvent& event)
|
||||
{
|
||||
if ( m_handler )
|
||||
{
|
||||
if ( event.Moving() || event.Entering() || event.Leaving() )
|
||||
{
|
||||
if ( m_handler->HandleMouseMove(this, event) )
|
||||
return;
|
||||
}
|
||||
else // a click action
|
||||
{
|
||||
if ( m_handler->HandleMouse(this, event) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxControl::PerformAction(const wxControlAction& action,
|
||||
long numArg,
|
||||
const wxString& strArg)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#endif // wxUSE_CONTROLS
|
||||
|
108
src/univ/inpcons.cpp
Normal file
108
src/univ/inpcons.cpp
Normal file
@@ -0,0 +1,108 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: src/univ/inpcons.cpp
|
||||
// Purpose: wxInputConsumer: mix-in class for input handling
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by:
|
||||
// Created: 14.08.00
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2000 SciTech Software, Inc. (www.scitechsoft.com)
|
||||
// Licence: wxWindows license
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// ============================================================================
|
||||
// declarations
|
||||
// ============================================================================
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "inpcons.h"
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// headers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
#include "wx/wxprec.h"
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
#pragma hdrstop
|
||||
#endif
|
||||
|
||||
#include "wx/univ/renderer.h"
|
||||
#include "wx/univ/inphand.h"
|
||||
#include "wx/univ/theme.h"
|
||||
|
||||
// ============================================================================
|
||||
// implementation
|
||||
// ============================================================================
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// focus/activation handling
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxInputConsumer::OnFocus(wxFocusEvent& event)
|
||||
{
|
||||
if ( m_inputHandler && m_inputHandler->HandleFocus(this, event) )
|
||||
GetInputWindow()->Refresh();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxInputConsumer::OnActivate(wxActivateEvent& event)
|
||||
{
|
||||
if ( m_inputHandler && m_inputHandler->HandleActivation(this, event.GetActive()) )
|
||||
GetInputWindow()->Refresh();
|
||||
else
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// input processing
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
void wxInputConsumer::CreateInputHandler(const wxString& inphandler)
|
||||
{
|
||||
m_inputHandler = wxTheme::Get()->GetInputHandler(inphandler);
|
||||
}
|
||||
|
||||
void wxInputConsumer::OnKeyDown(wxKeyEvent& event)
|
||||
{
|
||||
if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, TRUE) )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxInputConsumer::OnKeyUp(wxKeyEvent& event)
|
||||
{
|
||||
if ( !m_inputHandler || !m_inputHandler->HandleKey(this, event, FALSE) )
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxInputConsumer::OnMouse(wxMouseEvent& event)
|
||||
{
|
||||
if ( m_inputHandler )
|
||||
{
|
||||
if ( event.Moving() || event.Entering() || event.Leaving() )
|
||||
{
|
||||
if ( m_inputHandler->HandleMouseMove(this, event) )
|
||||
return;
|
||||
}
|
||||
else // a click action
|
||||
{
|
||||
if ( m_inputHandler->HandleMouse(this, event) )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// the actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxInputConsumer::PerformAction(const wxControlAction& action,
|
||||
long numArg,
|
||||
const wxString& strArg)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
@@ -41,19 +41,19 @@
|
||||
// wxInputHandler
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxInputHandler::HandleMouseMove(wxControl * WXUNUSED(control),
|
||||
bool wxInputHandler::HandleMouseMove(wxInputConsumer * WXUNUSED(consumer),
|
||||
const wxMouseEvent& WXUNUSED(event))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxInputHandler::HandleFocus(wxControl *WXUNUSED(control),
|
||||
bool wxInputHandler::HandleFocus(wxInputConsumer *WXUNUSED(consumer),
|
||||
const wxFocusEvent& WXUNUSED(event))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxInputHandler::HandleActivation(wxControl *WXUNUSED(control),
|
||||
bool wxInputHandler::HandleActivation(wxInputConsumer *WXUNUSED(consumer),
|
||||
bool WXUNUSED(activated))
|
||||
{
|
||||
return FALSE;
|
||||
|
@@ -1236,7 +1236,7 @@ wxStdListboxInputHandler::SetupCapture(wxListBox *lbox,
|
||||
return action;
|
||||
}
|
||||
|
||||
bool wxStdListboxInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdListboxInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
@@ -1244,7 +1244,7 @@ bool wxStdListboxInputHandler::HandleKey(wxControl *control,
|
||||
if ( pressed && !event.AltDown() )
|
||||
{
|
||||
bool isMoveCmd = TRUE;
|
||||
int style = control->GetWindowStyle();
|
||||
int style = consumer->GetInputWindow()->GetWindowStyle();
|
||||
|
||||
wxControlAction action;
|
||||
wxString strArg;
|
||||
@@ -1284,24 +1284,24 @@ bool wxStdListboxInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( !!action )
|
||||
{
|
||||
control->PerformAction(action, -1, strArg);
|
||||
consumer->PerformAction(action, -1, strArg);
|
||||
|
||||
if ( isMoveCmd )
|
||||
{
|
||||
if ( style & wxLB_SINGLE )
|
||||
{
|
||||
// the current item is always the one selected
|
||||
control->PerformAction(wxACTION_LISTBOX_SELECT);
|
||||
consumer->PerformAction(wxACTION_LISTBOX_SELECT);
|
||||
}
|
||||
else if ( style & wxLB_EXTENDED )
|
||||
{
|
||||
if ( event.ShiftDown() )
|
||||
control->PerformAction(wxACTION_LISTBOX_EXTENDSEL);
|
||||
consumer->PerformAction(wxACTION_LISTBOX_EXTENDSEL);
|
||||
else
|
||||
{
|
||||
// select the item and make it the new selection anchor
|
||||
control->PerformAction(wxACTION_LISTBOX_SELECT);
|
||||
control->PerformAction(wxACTION_LISTBOX_ANCHOR);
|
||||
consumer->PerformAction(wxACTION_LISTBOX_SELECT);
|
||||
consumer->PerformAction(wxACTION_LISTBOX_ANCHOR);
|
||||
}
|
||||
}
|
||||
//else: nothing to do for multiple selection listboxes
|
||||
@@ -1311,13 +1311,13 @@ bool wxStdListboxInputHandler::HandleKey(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdListboxInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdListboxInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxListBox *lbox = wxStaticCast(control, wxListBox);
|
||||
wxListBox *lbox = wxStaticCast(consumer->GetInputWindow(), wxListBox);
|
||||
int item = HitTest(lbox, event);
|
||||
wxControlAction action;
|
||||
|
||||
@@ -1357,16 +1357,16 @@ bool wxStdListboxInputHandler::HandleMouse(wxControl *control,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdListboxInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdListboxInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxWindow *winCapture = wxWindow::GetCapture();
|
||||
if ( winCapture && (event.GetEventObject() == winCapture) )
|
||||
{
|
||||
wxListBox *lbox = wxStaticCast(control, wxListBox);
|
||||
wxListBox *lbox = wxStaticCast(consumer->GetInputWindow(), wxListBox);
|
||||
|
||||
if ( !m_btnCapture || !m_trackMouseOutside )
|
||||
{
|
||||
@@ -1404,7 +1404,7 @@ bool wxStdListboxInputHandler::HandleMouseMove(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||
}
|
||||
|
||||
#endif // wxUSE_LISTBOX
|
||||
|
@@ -1281,14 +1281,14 @@ wxStdNotebookInputHandler::wxStdNotebookInputHandler(wxInputHandler *inphand)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStdNotebookInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdNotebookInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
// ignore the key releases
|
||||
if ( pressed )
|
||||
{
|
||||
wxNotebook *notebook = wxStaticCast(control, wxNotebook);
|
||||
wxNotebook *notebook = wxStaticCast(consumer->GetInputWindow(), wxNotebook);
|
||||
|
||||
int page = 0;
|
||||
wxControlAction action;
|
||||
@@ -1327,57 +1327,57 @@ bool wxStdNotebookInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( !!action )
|
||||
{
|
||||
return control->PerformAction(action, page);
|
||||
return consumer->PerformAction(action, page);
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdNotebookInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdNotebookInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
if ( event.ButtonDown(1) )
|
||||
{
|
||||
wxNotebook *notebook = wxStaticCast(control, wxNotebook);
|
||||
wxNotebook *notebook = wxStaticCast(consumer->GetInputWindow(), wxNotebook);
|
||||
int page = notebook->HitTest(event.GetPosition());
|
||||
if ( page != -1 )
|
||||
{
|
||||
control->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
|
||||
consumer->PerformAction(wxACTION_NOTEBOOK_GOTO, page);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdNotebookInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdNotebookInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdNotebookInputHandler::HandleFocus(wxControl *control,
|
||||
bool wxStdNotebookInputHandler::HandleFocus(wxInputConsumer *consumer,
|
||||
const wxFocusEvent& event)
|
||||
{
|
||||
HandleFocusChange(control);
|
||||
HandleFocusChange(consumer);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool wxStdNotebookInputHandler::HandleActivation(wxControl *control,
|
||||
bool wxStdNotebookInputHandler::HandleActivation(wxInputConsumer *consumer,
|
||||
bool WXUNUSED(activated))
|
||||
{
|
||||
// we react to the focus change in the same way as to the [de]activation
|
||||
HandleFocusChange(control);
|
||||
HandleFocusChange(consumer);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void wxStdNotebookInputHandler::HandleFocusChange(wxControl *control)
|
||||
void wxStdNotebookInputHandler::HandleFocusChange(wxInputConsumer *consumer)
|
||||
{
|
||||
wxNotebook *notebook = wxStaticCast(control, wxNotebook);
|
||||
wxNotebook *notebook = wxStaticCast(consumer->GetInputWindow(), wxNotebook);
|
||||
notebook->RefreshCurrent();
|
||||
}
|
||||
|
||||
|
@@ -655,7 +655,7 @@ void wxStdScrollBarInputHandler::HandleThumbMove(wxScrollBar *scrollbar,
|
||||
scrollbar->PerformAction(wxACTION_SCROLL_THUMB_MOVE, thumbPos);
|
||||
}
|
||||
|
||||
bool wxStdScrollBarInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdScrollBarInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
@@ -677,16 +677,16 @@ bool wxStdScrollBarInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( !!action )
|
||||
{
|
||||
control->PerformAction(action);
|
||||
consumer->PerformAction(action);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdScrollBarInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdScrollBarInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
// is this a click event from an acceptable button?
|
||||
@@ -694,7 +694,7 @@ bool wxStdScrollBarInputHandler::HandleMouse(wxControl *control,
|
||||
if ( (btn != -1) && IsAllowedButton(btn) )
|
||||
{
|
||||
// determine which part of the window mouse is in
|
||||
wxScrollBar *scrollbar = wxStaticCast(control, wxScrollBar);
|
||||
wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar);
|
||||
wxHitTest ht = m_renderer->HitTestScrollbar
|
||||
(
|
||||
scrollbar,
|
||||
@@ -708,7 +708,7 @@ bool wxStdScrollBarInputHandler::HandleMouse(wxControl *control,
|
||||
if ( !m_winCapture )
|
||||
{
|
||||
m_btnCapture = btn;
|
||||
m_winCapture = control;
|
||||
m_winCapture = consumer->GetInputWindow();
|
||||
m_winCapture->CaptureMouse();
|
||||
|
||||
// generate the command
|
||||
@@ -735,7 +735,7 @@ bool wxStdScrollBarInputHandler::HandleMouse(wxControl *control,
|
||||
break;
|
||||
|
||||
case wxHT_SCROLLBAR_THUMB:
|
||||
control->PerformAction(wxACTION_SCROLL_THUMB_DRAG);
|
||||
consumer->PerformAction(wxACTION_SCROLL_THUMB_DRAG);
|
||||
m_ofsMouse = GetMouseCoord(scrollbar, event) -
|
||||
m_renderer->ScrollbarToPixel(scrollbar);
|
||||
|
||||
@@ -793,13 +793,13 @@ bool wxStdScrollBarInputHandler::HandleMouse(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdScrollBarInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdScrollBarInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxScrollBar *scrollbar = wxStaticCast(control, wxScrollBar);
|
||||
wxScrollBar *scrollbar = wxStaticCast(consumer->GetInputWindow(), wxScrollBar);
|
||||
|
||||
if ( m_winCapture )
|
||||
{
|
||||
|
@@ -916,7 +916,7 @@ bool wxSlider::OnPageScroll(int pageInc)
|
||||
// wxStdSliderButtonInputHandler
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
bool wxStdSliderButtonInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdSliderButtonInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
@@ -956,19 +956,19 @@ bool wxStdSliderButtonInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( !!action )
|
||||
{
|
||||
control->PerformAction(action);
|
||||
consumer->PerformAction(action);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdSliderButtonInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdSliderButtonInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxSlider *slider = wxStaticCast(control, wxSlider);
|
||||
wxSlider *slider = wxStaticCast(consumer->GetInputWindow(), wxSlider);
|
||||
|
||||
if ( slider->GetThumb().HandleMouse(event) )
|
||||
{
|
||||
@@ -976,13 +976,13 @@ bool wxStdSliderButtonInputHandler::HandleMouse(wxControl *control,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdSliderButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdSliderButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxSlider *slider = wxStaticCast(control, wxSlider);
|
||||
wxSlider *slider = wxStaticCast(consumer->GetInputWindow(), wxSlider);
|
||||
|
||||
if ( slider->GetThumb().HandleMouseMove(event) )
|
||||
{
|
||||
@@ -990,10 +990,10 @@ bool wxStdSliderButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdSliderButtonInputHandler::HandleFocus(wxControl *control,
|
||||
bool wxStdSliderButtonInputHandler::HandleFocus(wxInputConsumer *consumer,
|
||||
const wxFocusEvent& event)
|
||||
{
|
||||
// slider's appearance changes when it gets/loses focus
|
||||
|
@@ -370,7 +370,7 @@ wxStdSpinButtonInputHandler(wxInputHandler *inphand)
|
||||
{
|
||||
}
|
||||
|
||||
bool wxStdSpinButtonInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdSpinButtonInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
@@ -392,19 +392,19 @@ bool wxStdSpinButtonInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( !!action )
|
||||
{
|
||||
control->PerformAction(action);
|
||||
consumer->PerformAction(action);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdSpinButtonInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdSpinButtonInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxSpinButton *spinbtn = wxStaticCast(control, wxSpinButton);
|
||||
wxSpinButton *spinbtn = wxStaticCast(consumer->GetInputWindow(), wxSpinButton);
|
||||
|
||||
if ( spinbtn->GetArrows().HandleMouse(event) )
|
||||
{
|
||||
@@ -412,13 +412,13 @@ bool wxStdSpinButtonInputHandler::HandleMouse(wxControl *control,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdSpinButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdSpinButtonInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
wxSpinButton *spinbtn = wxStaticCast(control, wxSpinButton);
|
||||
wxSpinButton *spinbtn = wxStaticCast(consumer->GetInputWindow(), wxSpinButton);
|
||||
|
||||
if ( spinbtn->GetArrows().HandleMouseMove(event) )
|
||||
{
|
||||
@@ -426,7 +426,7 @@ bool wxStdSpinButtonInputHandler::HandleMouseMove(wxControl *control,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||
}
|
||||
|
||||
|
||||
|
@@ -4709,7 +4709,7 @@ wxTextPos wxStdTextCtrlInputHandler::HitTest(const wxTextCtrl *text,
|
||||
return pos;
|
||||
}
|
||||
|
||||
bool wxStdTextCtrlInputHandler::HandleKey(wxControl *control,
|
||||
bool wxStdTextCtrlInputHandler::HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed)
|
||||
{
|
||||
@@ -4826,22 +4826,22 @@ bool wxStdTextCtrlInputHandler::HandleKey(wxControl *control,
|
||||
|
||||
if ( (action != wxACTION_NONE) && (action != wxACTION_TEXT_PREFIX_SEL) )
|
||||
{
|
||||
control->PerformAction(action, -1, str);
|
||||
consumer->PerformAction(action, -1, str);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleKey(control, event, pressed);
|
||||
return wxStdInputHandler::HandleKey(consumer, event, pressed);
|
||||
}
|
||||
|
||||
bool wxStdTextCtrlInputHandler::HandleMouse(wxControl *control,
|
||||
bool wxStdTextCtrlInputHandler::HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
if ( event.LeftDown() )
|
||||
{
|
||||
wxASSERT_MSG( !m_winCapture, _T("left button going down twice?") );
|
||||
|
||||
wxTextCtrl *text = wxStaticCast(control, wxTextCtrl);
|
||||
wxTextCtrl *text = wxStaticCast(consumer->GetInputWindow(), wxTextCtrl);
|
||||
|
||||
m_winCapture = text;
|
||||
m_winCapture->CaptureMouse();
|
||||
@@ -4857,7 +4857,7 @@ bool wxStdTextCtrlInputHandler::HandleMouse(wxControl *control,
|
||||
else if ( event.LeftDClick() )
|
||||
{
|
||||
// select the word the cursor is on
|
||||
control->PerformAction(wxACTION_TEXT_SEL_WORD);
|
||||
consumer->PerformAction(wxACTION_TEXT_SEL_WORD);
|
||||
}
|
||||
else if ( event.LeftUp() )
|
||||
{
|
||||
@@ -4870,10 +4870,10 @@ bool wxStdTextCtrlInputHandler::HandleMouse(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouse(control, event);
|
||||
return wxStdInputHandler::HandleMouse(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdTextCtrlInputHandler::HandleMouseMove(wxControl *control,
|
||||
bool wxStdTextCtrlInputHandler::HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event)
|
||||
{
|
||||
if ( m_winCapture )
|
||||
@@ -4887,13 +4887,13 @@ bool wxStdTextCtrlInputHandler::HandleMouseMove(wxControl *control,
|
||||
}
|
||||
}
|
||||
|
||||
return wxStdInputHandler::HandleMouseMove(control, event);
|
||||
return wxStdInputHandler::HandleMouseMove(consumer, event);
|
||||
}
|
||||
|
||||
bool wxStdTextCtrlInputHandler::HandleFocus(wxControl *control,
|
||||
bool wxStdTextCtrlInputHandler::HandleFocus(wxInputConsumer *consumer,
|
||||
const wxFocusEvent& event)
|
||||
{
|
||||
wxTextCtrl *text = wxStaticCast(control, wxTextCtrl);
|
||||
wxTextCtrl *text = wxStaticCast(consumer->GetInputWindow(), wxTextCtrl);
|
||||
|
||||
// the selection appearance changes depending on whether we have the focus
|
||||
text->RefreshSelection();
|
||||
|
Reference in New Issue
Block a user