📄 controlbar.h
字号:
// event types handled by plugins
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DOWN;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_UP;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_DOWN;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RIGHT_UP;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_MOTION;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LEFT_DCLICK;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROW;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_ROW;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_LAYOUT_ROWS;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_INSERT_BAR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_RESIZE_BAR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_REMOVE_BAR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_SIZE_BAR_WND;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_DECOR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_DECOR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_DECOR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_BAR_HANDLES;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_HANDLES;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_ROW_BKGROUND;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_PANE_BKGROUND;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_BAR_DRAGGING;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_DRAW_HINT_RECT;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_START_DRAW_IN_AREA;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_FINISH_DRAW_IN_AREA;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_BAR;
extern WXDLLIMPEXP_FL wxEventType cbEVT_PL_CUSTOMIZE_LAYOUT;
extern WXDLLIMPEXP_FL wxEventType wxCUSTOM_CB_PLUGIN_EVENTS_START_AT;
// Forward declarations, separated by categories.
class cbLeftDownEvent;
class cbLeftUpEvent;
class cbRightDownEvent;
class cbRightUpEvent;
class cbMotionEvent;
class cbLeftDClickEvent;
class cbLayoutRowEvent;
class cbResizeRowEvent;
class cbLayoutRowsEvent;
class cbInsertBarEvent;
class cbResizeBarEvent;
class cbRemoveBarEvent;
class cbSizeBarWndEvent;
class cbDrawBarDecorEvent;
class cbDrawRowDecorEvent;
class cbDrawPaneDecorEvent;
class cbDrawBarHandlesEvent;
class cbDrawRowHandlesEvent;
class cbDrawRowBkGroundEvent;
class cbDrawPaneBkGroundEvent;
class cbStartBarDraggingEvent;
class cbDrawHintRectEvent;
class cbStartDrawInAreaEvent;
class cbFinishDrawInAreaEvent;
class cbCustomizeBarEvent;
class cbCustomizeLayoutEvent;
// Definitions for for handler-methods.
typedef void (wxEvtHandler::*cbLeftDownHandler )(cbLeftDownEvent&);
typedef void (wxEvtHandler::*cbLeftUpHandler )(cbLeftUpEvent&);
typedef void (wxEvtHandler::*cbRightDownHandler )(cbRightDownEvent&);
typedef void (wxEvtHandler::*cbRightUpHandler )(cbRightUpEvent&);
typedef void (wxEvtHandler::*cbMotionHandler )(cbMotionEvent&);
typedef void (wxEvtHandler::*cbLeftDClickHandler )(cbLeftDClickEvent&);
typedef void (wxEvtHandler::*cbLayoutRowHandler )(cbLayoutRowEvent&);
typedef void (wxEvtHandler::*cbResizeRowHandler )(cbResizeRowEvent&);
typedef void (wxEvtHandler::*cbLayoutRowsHandler )(cbLayoutRowsEvent&);
typedef void (wxEvtHandler::*cbInsertBarHandler )(cbInsertBarEvent&);
typedef void (wxEvtHandler::*cbResizeBarHandler )(cbResizeBarEvent&);
typedef void (wxEvtHandler::*cbRemoveBarHandler )(cbRemoveBarEvent&);
typedef void (wxEvtHandler::*cbSizeBarWndHandler )(cbSizeBarWndEvent&);
typedef void (wxEvtHandler::*cbDrawBarDecorHandler )(cbDrawBarDecorEvent&);
typedef void (wxEvtHandler::*cbDrawRowDecorHandler )(cbDrawRowDecorEvent&);
typedef void (wxEvtHandler::*cbDrawPaneDecorHandler )(cbDrawPaneDecorEvent&);
typedef void (wxEvtHandler::*cbDrawBarHandlesHandler )(cbDrawBarHandlesEvent&);
typedef void (wxEvtHandler::*cbDrawRowHandlesHandler )(cbDrawRowHandlesEvent&);
typedef void (wxEvtHandler::*cbDrawRowBkGroundHandler )(cbDrawRowBkGroundEvent&);
typedef void (wxEvtHandler::*cbDrawPaneBkGroundHandler)(cbDrawPaneBkGroundEvent&);
typedef void (wxEvtHandler::*cbStartBarDraggingHandler )(cbStartBarDraggingEvent&);
typedef void (wxEvtHandler::*cbDrawHintRectHandler )(cbDrawHintRectEvent&);
typedef void (wxEvtHandler::*cbStartDrawInAreaHandler )(cbStartDrawInAreaEvent&);
typedef void (wxEvtHandler::*cbFinishDrawInAreaHandler)(cbFinishDrawInAreaEvent&);
typedef void (wxEvtHandler::*cbCustomizeBarHandler )(cbCustomizeBarEvent&);
typedef void (wxEvtHandler::*cbCustomizeLayoutHandler )(cbCustomizeLayoutEvent&);
// Macros for creating event table entries for plugin-events.
#define EVT_PL_LEFT_DOWN(func) wxEventTableEntry( cbEVT_PL_LEFT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDownHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_LEFT_UP(func) wxEventTableEntry( cbEVT_PL_LEFT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftUpHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_RIGHT_DOWN(func) wxEventTableEntry( cbEVT_PL_RIGHT_DOWN, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightDownHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_RIGHT_UP(func) wxEventTableEntry( cbEVT_PL_RIGHT_UP, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRightUpHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_MOTION(func) wxEventTableEntry( cbEVT_PL_MOTION, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbMotionHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_LEFT_DCLICK(func) wxEventTableEntry( cbEVT_PL_LEFT_DCLICK, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLeftDClickHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_LAYOUT_ROW(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_RESIZE_ROW(func) wxEventTableEntry( cbEVT_PL_RESIZE_ROW, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeRowHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_LAYOUT_ROWS(func) wxEventTableEntry( cbEVT_PL_LAYOUT_ROWS, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbLayoutRowsHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_INSERT_BAR(func) wxEventTableEntry( cbEVT_PL_INSERT_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbInsertBarHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_RESIZE_BAR(func) wxEventTableEntry( cbEVT_PL_RESIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbResizeBarHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_REMOVE_BAR(func) wxEventTableEntry( cbEVT_PL_REMOVE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbRemoveBarHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_SIZE_BAR_WND(func) wxEventTableEntry( cbEVT_PL_SIZE_BAR_WND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbSizeBarWndHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_BAR_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarDecorHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_ROW_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowDecorHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_PANE_DECOR(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_DECOR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneDecorHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_BAR_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_BAR_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawBarHandlesHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_ROW_HANDLES(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_HANDLES, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowHandlesHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_ROW_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_ROW_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawRowBkGroundHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_PANE_BKGROUND(func) wxEventTableEntry( cbEVT_PL_DRAW_PANE_BKGROUND, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawPaneBkGroundHandler) & func, (wxObject *) NULL ),
#define EVT_PL_START_BAR_DRAGGING(func) wxEventTableEntry( cbEVT_PL_START_BAR_DRAGGING, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartBarDraggingHandler) & func, (wxObject *) NULL ),
#define EVT_PL_DRAW_HINT_RECT(func) wxEventTableEntry( cbEVT_PL_DRAW_HINT_RECT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbDrawHintRectHandler ) & func, (wxObject *) NULL ),
#define EVT_PL_START_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_START_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbStartDrawInAreaHandler) & func, (wxObject *) NULL ),
#define EVT_PL_FINISH_DRAW_IN_AREA(func) wxEventTableEntry( cbEVT_PL_FINISH_DRAW_IN_AREA, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbFinishDrawInAreaHandler) & func, (wxObject *) NULL ),
#define EVT_PL_CUSTOMIZE_BAR(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_BAR, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeBarHandler) & func, (wxObject *) NULL ),
#define EVT_PL_CUSTOMIZE_LAYOUT(func) wxEventTableEntry( cbEVT_PL_CUSTOMIZE_LAYOUT, -1, -1, (wxObjectEventFunction) (wxEventFunction) (cbCustomizeLayoutHandler) & func, (wxObject *) NULL ),
/*
Abstract base class for all control-bar related plugins.
Note: pointer positions of mouse events sent to plugins
are always in the pane's coordinates (the pane to which
this plugin is hooked).
*/
class cbPluginBase : public wxEvtHandler
{
DECLARE_ABSTRACT_CLASS( cbPluginBase )
public:
// Back-reference to the frame layout.
wxFrameLayout* mpLayout;
// Specifies panes for which this plugin receives events
// (see pane masks definitions).
int mPaneMask;
// Is true when plugin is ready to handle events.
bool mIsReady;
public:
// Default constructor.
cbPluginBase()
: mpLayout ( 0 ),
mPaneMask( wxALL_PANES ),
mIsReady ( false )
{}
// Constructor taking layout panel and a mask.
cbPluginBase( wxFrameLayout* pPanel, int paneMask = wxALL_PANES )
: mpLayout ( pPanel ),
mPaneMask( paneMask ),
mIsReady ( false )
{}
// Returns the pane mask.
inline int GetPaneMask() { return mPaneMask; }
// Destructor. Destroys the whole plugin chain of connected plugins.
virtual ~cbPluginBase();
// Override this method to do plugin-specific initialization.
// At this point plugin is already attached to the frame layout,
// and pane masks are set.
virtual void OnInitPlugin() { mIsReady = true; }
// Returns true if the plugin is ready to receive events.
bool IsReady() { return mIsReady; }
// Overridden to determine whether the target pane specified in the
// event matches the pane mask of this plugin (specific plugins
// do not override this method).
virtual bool ProcessEvent(wxEvent& event);
};
/*
Class for mouse left down events.
*/
class cbLeftDownEvent : public cbPluginEvent
{
public:
wxPoint mPos;
// Constructor, taking mouse position and pane.
cbLeftDownEvent( const wxPoint& pos, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_LEFT_DOWN, pPane ),
mPos( pos )
{}
};
/*
Class for mouse left up events.
*/
class cbLeftUpEvent : public cbPluginEvent
{
public:
wxPoint mPos;
// Constructor, taking mouse position and pane.
cbLeftUpEvent( const wxPoint& pos, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_LEFT_UP, pPane ),
mPos( pos )
{}
};
/*
Class for mouse right down events.
*/
class cbRightDownEvent : public cbPluginEvent
{
public:
wxPoint mPos;
// Constructor, taking mouse position and pane.
cbRightDownEvent( const wxPoint& pos, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_RIGHT_DOWN, pPane ),
mPos( pos )
{}
};
/*
Class for mouse right up events.
*/
class cbRightUpEvent : public cbPluginEvent
{
public:
wxPoint mPos;
// Constructor, taking mouse position and pane.
cbRightUpEvent( const wxPoint& pos, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_RIGHT_UP, pPane ),
mPos( pos )
{}
};
/*
Class for mouse motion events.
*/
class cbMotionEvent : public cbPluginEvent
{
public:
wxPoint mPos;
// Constructor, taking mouse position and pane.
cbMotionEvent( const wxPoint& pos, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_MOTION, pPane ),
mPos( pos )
{}
};
/*
Class for mouse left double click events.
*/
class cbLeftDClickEvent : public cbPluginEvent
{
public:
wxPoint mPos;
// Constructor, taking mouse position and pane.
cbLeftDClickEvent( const wxPoint& pos, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_LEFT_DCLICK, pPane ),
mPos( pos )
{}
};
/*
Class for single row layout events.
*/
class cbLayoutRowEvent : public cbPluginEvent
{
public:
cbRowInfo* mpRow;
// Constructor, taking row information and pane.
cbLayoutRowEvent( cbRowInfo* pRow, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_LAYOUT_ROW, pPane ),
mpRow( pRow )
{}
};
/*
Class for row resize events.
*/
class cbResizeRowEvent : public cbPluginEvent
{
public:
cbRowInfo* mpRow;
int mHandleOfs;
bool mForUpperHandle;
// Constructor, taking row information, two parameters of currently unknown use, and pane.
cbResizeRowEvent( cbRowInfo* pRow, int handleOfs, bool forUpperHandle, cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_RESIZE_ROW, pPane ),
mpRow( pRow ),
mHandleOfs( handleOfs ),
mForUpperHandle( forUpperHandle )
{}
};
/*
Class for multiple rows layout events.
*/
class cbLayoutRowsEvent : public cbPluginEvent
{
public:
// Constructor, taking pane.
cbLayoutRowsEvent( cbDockPane* pPane )
: cbPluginEvent( cbEVT_PL_LAYOUT_ROWS, pPane )
{}
};
/*
Class for bar insertion events.
*/
class cbInsertBarEvent : public cbPluginEvent
{
public:
cbBarInfo* mpBar;
cbRowInfo* mpRow;
// Constructor, taking bar information, row information, and pane.
cbInsertBarEvent( cbBarInfo* pB
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -