Many changes for wxInputHandler creation mainly related to:
1. Allow the theme to create only the input handlers it customizes instead of forcing it to always create a handler even if the standard one is used: wxTheme::GetInputHandler() now takes wxInputConsumer to make this possible 2. Prefer delegation to inheritance when creating customized input handlers, almost all (except for wxStdScrollbarInputHandler) standard handler classes are now private, use wxClassName::GetStdInputHandler() to retrieve the standard handler for any class or polymorphic DoGetStdInputHandler() git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41227 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -47,7 +47,7 @@ public:
|
||||
|
||||
Create(parent, id, bitmap, label, pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
|
||||
wxButton(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxString& label = wxEmptyString,
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
return Create(parent, id, wxNullBitmap, label,
|
||||
pos, size, style, validator, name);
|
||||
}
|
||||
|
||||
|
||||
bool Create(wxWindow *parent,
|
||||
wxWindowID id,
|
||||
const wxBitmap& bitmap,
|
||||
@@ -106,9 +106,16 @@ public:
|
||||
|
||||
virtual bool CanBeHighlighted() const { return true; }
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
|
||||
|
||||
virtual bool DoDrawBackground(wxDC& dc);
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
||||
@@ -128,31 +135,5 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxButton)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdButtonInputHandler: translates SPACE and ENTER keys and the left mouse
|
||||
// click into button press/release actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdButtonInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdButtonInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
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
|
||||
// the mouse is inside the button which captured it or not
|
||||
wxWindow *m_winCapture;
|
||||
bool m_winHasMouse;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_BUTTON_H_
|
||||
|
||||
|
@@ -28,11 +28,6 @@
|
||||
// wxCheckBox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
// X11 headers may define this
|
||||
#ifdef Status
|
||||
#undef Status
|
||||
#endif
|
||||
|
||||
class WXDLLEXPORT wxCheckBox : public wxCheckBoxBase
|
||||
{
|
||||
public:
|
||||
@@ -102,6 +97,11 @@ public:
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
virtual bool CanBeHighlighted() const { return true; }
|
||||
virtual wxInputHandler *CreateStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return CreateStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual void DoSet3StateValue(wxCheckBoxState WXUNUSED(state));
|
||||
@@ -147,20 +147,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckBox)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdCheckboxInputHandler: handles the mouse events for the check and radio
|
||||
// boxes (handling the keyboard input is simple, but its handling differs a
|
||||
// lot between GTK and MSW, so a new class should be derived for this)
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdCheckboxInputHandler : public wxStdButtonInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdCheckboxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
// we have to override this one as wxStdButtonInputHandler version works
|
||||
// only with the buttons
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKBOX_H_
|
||||
|
@@ -78,6 +78,12 @@ public:
|
||||
long numArg = -1l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// override all methods which add/delete items to update m_checks array as
|
||||
// well
|
||||
virtual void Delete(unsigned int n);
|
||||
@@ -105,20 +111,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxCheckListBox)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdCheckListBoxInputHandler
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdCheckListboxInputHandler : public wxStdListboxInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdCheckListboxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_CHECKLST_H_
|
||||
|
@@ -136,6 +136,12 @@ public:
|
||||
const wxString& strArg = wxEmptyString);
|
||||
*/
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual int DoAppend(const wxString& item);
|
||||
virtual int DoInsert(const wxString& item, unsigned int pos);
|
||||
@@ -158,20 +164,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxComboBox)
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdComboBoxInputHandler: allows the user to open/close the combo from kbd
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdComboBoxInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdComboBoxInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
};
|
||||
|
||||
|
||||
#endif // _WX_UNIV_COMBOBOX_H_
|
||||
|
@@ -39,7 +39,7 @@ class WXDLLEXPORT wxInputConsumer
|
||||
{
|
||||
public:
|
||||
wxInputConsumer() { m_inputHandler = NULL; }
|
||||
virtual ~wxInputConsumer() {}
|
||||
virtual ~wxInputConsumer() { }
|
||||
|
||||
// get the input handler
|
||||
wxInputHandler *GetInputHandler() const { return m_inputHandler; }
|
||||
@@ -60,6 +60,19 @@ public:
|
||||
// get the window to work with (usually the class wxInputConsumer was mixed into)
|
||||
virtual wxWindow *GetInputWindow() const = 0;
|
||||
|
||||
// this function must be implemented in any classes process input (i.e. not
|
||||
// static controls) to create the standard input handler for the concrete
|
||||
// class deriving from this mix-in
|
||||
//
|
||||
// the parameter is the default input handler which should receive all
|
||||
// unprocessed input (i.e. typically handlerDef is passed to
|
||||
// wxStdInputHandler ctor) or it may be NULL
|
||||
//
|
||||
// the returned pointer will not be deleted by caller so it must either
|
||||
// point to a static object or be deleted on program termination
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef);
|
||||
|
||||
|
||||
protected:
|
||||
// event handlers
|
||||
void OnMouse(wxMouseEvent& event);
|
||||
@@ -68,10 +81,12 @@ protected:
|
||||
void OnFocus(wxFocusEvent& event);
|
||||
void OnActivate(wxActivateEvent& event);
|
||||
|
||||
// create input handler by name
|
||||
// create input handler by name, fall back to GetStdInputHandler() if
|
||||
// the current theme doesn't define any specific handler of this type
|
||||
void CreateInputHandler(const wxString& inphandler);
|
||||
|
||||
// input processor (never deleted, the theme deletes it itself)
|
||||
private:
|
||||
// the input processor (we never delete it)
|
||||
wxInputHandler *m_inputHandler;
|
||||
};
|
||||
|
||||
|
@@ -183,6 +183,12 @@ public:
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// idle processing
|
||||
virtual void OnInternalIdle();
|
||||
|
||||
@@ -291,60 +297,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxListBox)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdListboxInputHandler: handles mouse and kbd in a single or multi
|
||||
// selection listbox
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdListboxInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
// if pressing the mouse button in a multiselection listbox should toggle
|
||||
// the item under mouse immediately, then specify true as the second
|
||||
// parameter (this is the standard behaviour, under GTK the item is toggled
|
||||
// only when the mouse is released in the multi selection listbox)
|
||||
wxStdListboxInputHandler(wxInputHandler *inphand,
|
||||
bool toggleOnPressAlways = true);
|
||||
|
||||
// base class methods
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
protected:
|
||||
// return the item under mouse, 0 if the mouse is above the listbox or
|
||||
// GetCount() if it is below it
|
||||
int HitTest(const wxListBox *listbox, const wxMouseEvent& event);
|
||||
|
||||
// parts of HitTest(): first finds the pseudo (because not in range) index
|
||||
// of the item and the second one adjusts it if necessary - that is if the
|
||||
// third one returns false
|
||||
int HitTestUnsafe(const wxListBox *listbox, const wxMouseEvent& event);
|
||||
int FixItemIndex(const wxListBox *listbox, int item);
|
||||
bool IsValidIndex(const wxListBox *listbox, int item);
|
||||
|
||||
// init m_btnCapture and m_actionMouse
|
||||
wxControlAction SetupCapture(wxListBox *lbox,
|
||||
const wxMouseEvent& event,
|
||||
int item);
|
||||
|
||||
wxRenderer *m_renderer;
|
||||
|
||||
// the button which initiated the mouse capture (currently 0 or 1)
|
||||
int m_btnCapture;
|
||||
|
||||
// the action to perform when the mouse moves while we capture it
|
||||
wxControlAction m_actionMouse;
|
||||
|
||||
// the ctor parameter toggleOnPressAlways (see comments near it)
|
||||
bool m_toggleOnPressAlways;
|
||||
|
||||
// do we track the mouse outside the window when it is captured?
|
||||
bool m_trackMouseOutside;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_LISTBOX_H_
|
||||
|
@@ -111,6 +111,12 @@ public:
|
||||
long numArg = 0l,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// refresh the currently selected tab
|
||||
void RefreshCurrent();
|
||||
|
||||
@@ -242,28 +248,5 @@ protected:
|
||||
DECLARE_DYNAMIC_CLASS(wxNotebook)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdNotebookInputHandler: translates SPACE and ENTER keys and the left mouse
|
||||
// click into button press/release actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdNotebookInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdNotebookInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
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(wxInputConsumer *consumer);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_NOTEBOOK_H_
|
||||
|
||||
|
@@ -96,8 +96,13 @@ public:
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
// The scrollbars around a normal window should not
|
||||
// receive the focus.
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// scrollbars around a normal window should not receive the focus
|
||||
virtual bool AcceptsFocus() const;
|
||||
|
||||
// wxScrollBar sub elements state (combination of wxCONTROL_XXX)
|
||||
@@ -165,8 +170,7 @@ private:
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// common scrollbar input handler: it manages clicks on the standard scrollbar
|
||||
// elements (line arrows, bar, thumb)
|
||||
// Standard scrollbar input handler which can be used as a base class
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdScrollBarInputHandler : public wxStdInputHandler
|
||||
@@ -193,12 +197,10 @@ public:
|
||||
const wxControlAction& action);
|
||||
|
||||
protected:
|
||||
// the methods which must be overridden in the derived class
|
||||
|
||||
// return true if the mouse button can be used to activate scrollbar, false
|
||||
// if not (only left mouse button can do it under Windows, any button under
|
||||
// GTK+)
|
||||
virtual bool IsAllowedButton(int button) = 0;
|
||||
// if not (any button under GTK+ unlike left button only which is default)
|
||||
virtual bool IsAllowedButton(int button) const
|
||||
{ return button == wxMOUSE_BTN_LEFT; }
|
||||
|
||||
// set or clear the specified flag on the scrollbar element corresponding
|
||||
// to m_htLast
|
||||
@@ -222,6 +224,7 @@ protected:
|
||||
// generate a "thumb move" action for this mouse event
|
||||
void HandleThumbMove(wxScrollBar *scrollbar, const wxMouseEvent& event);
|
||||
|
||||
|
||||
// the window (scrollbar) which has capture or NULL and the flag telling if
|
||||
// the mouse is inside the element which captured it or not
|
||||
wxWindow *m_winCapture;
|
||||
|
@@ -118,13 +118,19 @@ public:
|
||||
virtual void OnPageScrollStart();
|
||||
virtual bool OnPageScroll(int pageInc);
|
||||
|
||||
// for wxStdSliderButtonInputHandler
|
||||
// for wxStdSliderInputHandler
|
||||
wxScrollThumb& GetThumb() { return m_thumb; }
|
||||
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
@@ -217,29 +223,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdSliderButtonInputHandler: default slider input handling
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdSliderButtonInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
// default ctor
|
||||
wxStdSliderButtonInputHandler(wxInputHandler *inphand)
|
||||
: wxStdInputHandler(inphand)
|
||||
{
|
||||
}
|
||||
|
||||
// base class methods
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_SLIDER_H_
|
||||
|
@@ -62,6 +62,12 @@ public:
|
||||
long numArg = 0,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual wxSize DoGetBestClientSize() const;
|
||||
virtual void DoDraw(wxControlRenderer *renderer);
|
||||
|
@@ -224,6 +224,12 @@ public:
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// override these methods to handle the caret
|
||||
virtual bool SetFont(const wxFont &font);
|
||||
virtual bool Enable(bool enable = true);
|
||||
@@ -522,32 +528,5 @@ private:
|
||||
friend class wxWrappedLineData;
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdTextCtrlInputHandler: this control handles only the mouse/kbd actions
|
||||
// common to Win32 and GTK, platform-specific things are implemented elsewhere
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdTextCtrlInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdTextCtrlInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
|
||||
protected:
|
||||
// get the position of the mouse click
|
||||
static wxTextPos HitTest(const wxTextCtrl *text, const wxPoint& pos);
|
||||
|
||||
// capture data
|
||||
wxTextCtrl *m_winCapture;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TEXTCTRL_H_
|
||||
|
||||
|
@@ -18,10 +18,11 @@
|
||||
// wxTheme
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
class WXDLLEXPORT wxColourScheme;
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
class WXDLLEXPORT wxArtProvider;
|
||||
class WXDLLEXPORT wxColourScheme;
|
||||
class WXDLLEXPORT wxInputConsumer;
|
||||
class WXDLLEXPORT wxInputHandler;
|
||||
class WXDLLEXPORT wxRenderer;
|
||||
struct WXDLLEXPORT wxThemeInfo;
|
||||
|
||||
class WXDLLEXPORT wxTheme
|
||||
@@ -52,8 +53,9 @@ public:
|
||||
// get the art provider to be used together with this theme
|
||||
virtual wxArtProvider *GetArtProvider() = 0;
|
||||
|
||||
// get the input handler of the given type
|
||||
virtual wxInputHandler *GetInputHandler(const wxString& handlerType) = 0;
|
||||
// get the input handler of the given type, forward to the standard one
|
||||
virtual wxInputHandler *GetInputHandler(const wxString& handlerType,
|
||||
wxInputConsumer *consumer) = 0;
|
||||
|
||||
// get the colour scheme for the control with this name
|
||||
virtual wxColourScheme *GetColourScheme() = 0;
|
||||
|
@@ -32,7 +32,7 @@ class WXDLLEXPORT wxToolBarTool;
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxToolBar : public wxToolBarBase
|
||||
{
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
wxToolBar() { Init(); }
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = 0,
|
||||
const wxString& name = wxToolBarNameStr );
|
||||
|
||||
|
||||
virtual ~wxToolBar();
|
||||
|
||||
virtual bool Realize();
|
||||
@@ -72,6 +72,12 @@ public:
|
||||
virtual bool PerformAction(const wxControlAction& action,
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
protected:
|
||||
// common part of all ctors
|
||||
void Init();
|
||||
@@ -109,7 +115,7 @@ protected:
|
||||
// (re)calculate the tool positions, should only be called if it is
|
||||
// necessary to do it, i.e. m_needsLayout == true
|
||||
void DoLayout();
|
||||
|
||||
|
||||
// get the rect limits depending on the orientation: top/bottom for a
|
||||
// vertical toolbar, left/right for a horizontal one
|
||||
void GetRectLimits(const wxRect& rect, wxCoord *start, wxCoord *end) const;
|
||||
@@ -129,29 +135,4 @@ private:
|
||||
DECLARE_DYNAMIC_CLASS(wxToolBar)
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdToolbarInputHandler: translates SPACE and ENTER keys and the left mouse
|
||||
// click into button press/release actions
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdToolbarInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdToolbarInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleKey(wxInputConsumer *consumer,
|
||||
const wxKeyEvent& event,
|
||||
bool pressed);
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||
virtual bool HandleFocus(wxInputConsumer *consumer, const wxFocusEvent& event);
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
|
||||
private:
|
||||
wxWindow *m_winCapture;
|
||||
wxToolBarToolBase *m_toolCapture;
|
||||
wxToolBarToolBase *m_toolLast;
|
||||
};
|
||||
|
||||
#endif // _WX_UNIV_TOOLBAR_H_
|
||||
|
@@ -131,6 +131,12 @@ public:
|
||||
long numArg = -1,
|
||||
const wxString& strArg = wxEmptyString);
|
||||
|
||||
static wxInputHandler *GetStdInputHandler(wxInputHandler *handlerDef);
|
||||
virtual wxInputHandler *DoGetStdInputHandler(wxInputHandler *handlerDef)
|
||||
{
|
||||
return GetStdInputHandler(handlerDef);
|
||||
}
|
||||
|
||||
// move/resize the frame interactively, i.e. let the user do it
|
||||
virtual void InteractiveMove(int flags = wxINTERACTIVE_MOVE);
|
||||
|
||||
@@ -174,27 +180,4 @@ protected:
|
||||
WX_DECLARE_INPUT_CONSUMER()
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// wxStdFrameInputHandler: handles focus, resizing and titlebar buttons clicks
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
class WXDLLEXPORT wxStdFrameInputHandler : public wxStdInputHandler
|
||||
{
|
||||
public:
|
||||
wxStdFrameInputHandler(wxInputHandler *inphand);
|
||||
|
||||
virtual bool HandleMouse(wxInputConsumer *consumer,
|
||||
const wxMouseEvent& event);
|
||||
virtual bool HandleMouseMove(wxInputConsumer *consumer, const wxMouseEvent& event);
|
||||
virtual bool HandleActivation(wxInputConsumer *consumer, bool activated);
|
||||
|
||||
private:
|
||||
// the window (button) which has capture or NULL and the last hittest result
|
||||
wxTopLevelWindow *m_winCapture;
|
||||
long m_winHitTest;
|
||||
long m_winPressed;
|
||||
bool m_borderCursorOn;
|
||||
wxCursor m_origCursor;
|
||||
};
|
||||
|
||||
#endif // __WX_UNIV_TOPLEVEL_H__
|
||||
|
Reference in New Issue
Block a user