📄 controlbar.h
字号:
virtual void ExpandBar( cbBarInfo* pBar );
// Contracts the bar.
// Internal function called by plugins.
virtual void ContractBar( cbBarInfo* pBar );
// Sets up links between bars.
// Internal function called by plugins.
void InitLinksForRow( cbRowInfo* pRow );
// Sets up links between bars.
// Internal function called by plugins.
void InitLinksForRows();
// Coordinate translation between parent's frame and this pane.
// Internal function called by plugins.
void FrameToPane( int* x, int* y );
// Coordinate translation between parent's frame and this pane.
// Internal function called by plugins.
void PaneToFrame( int* x, int* y );
// Coordinate translation between parent's frame and this pane.
// Internal function called by plugins.
void FrameToPane( wxRect* pRect );
// Coordinate translation between parent's frame and this pane.
// Internal function called by plugins.
void PaneToFrame( wxRect* pRect );
// Returns true if pos is within the given rectangle.
// Internal function called by plugins.
inline bool HasPoint( const wxPoint& pos, int x, int y, int width, int height );
// Returns the minimal row height for the given row.
// Internal function called by plugins.
int GetMinimalRowHeight( cbRowInfo* pRow );
// Sets the row height for the given height. newHeight includes the height of row handles, if present.
// Internal function called by plugins.
void SetRowHeight( cbRowInfo* pRow, int newHeight );
// Inserts the bar at the given row number.
// Internal function called by plugins.
void DoInsertBar( cbBarInfo* pBar, int rowNo );
public: /* protected really (accessed only by plugins) */
// Generates a cbDrawBarDecorEvent and sends it to the layout to paint the bar decorations.
// Internal function called by plugins.
virtual void PaintBarDecorations( cbBarInfo* pBar, wxDC& dc );
// Generates a cbDrawBarHandlesEvent and sends it to the layout to paint the bar handles.
// Internal function called by plugins.
virtual void PaintBarHandles( cbBarInfo* pBar, wxDC& dc );
// Calls PaintBarDecorations and PaintBarHandles.
// Internal function called by plugins.
virtual void PaintBar( cbBarInfo* pBar, wxDC& dc );
// Generates cbDrawRowHandlesEvent and cbDrawRowDecorEvent and sends them to the layout.
// Internal function called by plugins.
virtual void PaintRowHandles( cbRowInfo* pRow, wxDC& dc );
// Generates cbDrawRowBkGroundEvent and sends it to the layout.
// Internal function called by plugins.
virtual void PaintRowBackground ( cbRowInfo* pRow, wxDC& dc );
// Calls PaintBarDecorations for each row.
// Internal function called by plugins.
virtual void PaintRowDecorations( cbRowInfo* pRow, wxDC& dc );
// Calls PaintRowBackground, PaintRowDecorations, PaintRowHandles.
// Internal function called by plugins.
virtual void PaintRow( cbRowInfo* pRow, wxDC& dc );
// Generates cbDrawPaneBkGroundEvent and sends it to the layout.
// Internal function called by plugins.
virtual void PaintPaneBackground( wxDC& dc );
// Generates cbDrawPaneDecorEvent and sends it to the layout.
// Internal function called by plugins.
virtual void PaintPaneDecorations( wxDC& dc );
// Paints the pane background, the row background and decorations,
// and finally the pane decorations.
// Internal function called by plugins.
virtual void PaintPane( wxDC& dc );
// Generates a cbSizeBarWndEvent and sends it to the layout.
// Internal function called by plugins.
virtual void SizeBar( cbBarInfo* pBar );
// Calls SizeBar for each bar in the row.
// Internal function called by plugins.
virtual void SizeRowObjects( cbRowInfo* pRow );
// Calls SizeRowObjects for each row.
// Internal function called by plugins.
virtual void SizePaneObjects();
// Generates cbStartDrawInAreaEvent and sends it to the layout.
// Internal function called by plugins.
virtual wxDC* StartDrawInArea ( const wxRect& area );
// Generates cbFinishDrawInAreaEvent and sends it to the layout.
// Internal function called by plugins.
virtual void FinishDrawInArea( const wxRect& area );
public: /* public members */
// Default constructor.
cbDockPane(void);
// Constructor, taking alignment and layout panel.
cbDockPane( int alignment, wxFrameLayout* pPanel );
// Sets pane's margins in frame's coordinate orientations.
void SetMargins( int top, int bottom, int left, int right );
// Destructor.
virtual ~cbDockPane();
// Removes the bar from this pane. Does not destroy the bar.
virtual void RemoveBar( cbBarInfo* pBar );
// Inserts the bar into this pane. rect is given in the parent frame's coordinates.
virtual void InsertBar( cbBarInfo* pBar, const wxRect& rect );
// Inserts the bar into the given row, with dimensions and position
// stored in pBarInfo->mBounds. Returns the node of inserted bar.
virtual void InsertBar( cbBarInfo* pBar, cbRowInfo* pIntoRow );
// Inserts bar and sets its position according to the preferred settings
// given in pBarInfo.
virtual void InsertBar( cbBarInfo* pBarInfo );
// Removes the row from this pane. Does not destroy the row object.
virtual void RemoveRow( cbRowInfo* pRow );
// Inserts a row. Does not refresh the inserted row immediately.
// If pBeforeRowNode is NULL, the row is appended to the end of pane's row list.
virtual void InsertRow( cbRowInfo* pRow, cbRowInfo* pBeforeRow );
// Sets pane's width in the pane's coordinates (including margins).
void SetPaneWidth(int width);
// Set the position and dimensions of the pane in the parent frame's coordinates.
void SetBoundsInParent( const wxRect& rect );
// Returns the bounds of the pane, in parent coordinates.
inline wxRect& GetRealRect() { return mBoundsInParent; }
// Returns an array of rows. Used by updates-managers.
inline RowArrayT& GetRowList() { return mRows; }
// Returns the first row.
inline cbRowInfo* GetFirstRow()
{ return mRows.GetCount() ? mRows[0] : NULL; }
// Returns true if the given bar is present in this pane.
bool BarPresent( cbBarInfo* pBar );
// Returns the height in the pane's coordinates.
int GetPaneHeight();
// Returns the alignment for this pane. The value is one of
// FL_ALIGN_TOP, FL_ALIGN_BOTTOM, FL_ALIGN_LEFT, FL_ALIGN_RIGHT.
int GetAlignment();
// Returns true if the given mask matches the pane's mask.
bool MatchesMask( int paneMask );
// Returns true if the pane is aligned to the top or bottom.
inline bool IsHorizontal()
{
return (mAlignment == FL_ALIGN_TOP ||
mAlignment == FL_ALIGN_BOTTOM );
}
// Generates events to perform layout calculations.
virtual void RecalcLayout();
// Returns wxCBAR_DOCKED_HORIZONTALLY if the alignment is top or bottom,
// or wxCBAR_DOCKED_VERTICALLY otherwise.
virtual int GetDockingState();
// Returns the result of hit-testing items in the pane.
// See CB_HITTEST_RESULT enumerated type.
// pos is the position in this pane's coordinates.
virtual int HitTestPaneItems( const wxPoint& pos,
cbRowInfo** ppRow,
cbBarInfo** ppBar
);
// Returns the bar's resize range.
void GetBarResizeRange( cbBarInfo* pBar, int* from, int *till, bool forLeftHandle );
// Returns the row's resize range.
void GetRowResizeRange( cbRowInfo* pRow, int* from, int* till, bool forUpperHandle );
// Finds the bar information by corresponding window.
cbBarInfo* GetBarInfoByWindow( wxWindow* pBarWnd );
public: /* protected really (accessed only by plugins) */
// Row/bar resizing related helper-method.
void DrawVertHandle ( wxDC& dc, int x, int y, int height );
// Row/bar resizing related helper-method.
void DrawHorizHandle( wxDC& dc, int x, int y, int width );
// Row/bar resizing related helper-method.
void ResizeRow( cbRowInfo* pRow, int ofs, bool forUpperHandle );
// Row/bar resizing related helper-method.
void ResizeBar( cbBarInfo* pBar, int ofs, bool forLeftHandle );
// Returns row shape data.
// cbBarShapeData objects will be added to the given pLst.
// cbBarShapeData is used for storing the original bar's positions in the row,
// when the 'non-destructive-friction' option is turned on.
void GetRowShapeData( cbRowInfo* pRow, wxList* pLst );
// Sets the shape data for the given row, using the data provided in pLst.
// cbBarShapeData is used for storing the original bar's positions in the row,
// when the 'non-destructive-friction' option is turned on.
void SetRowShapeData( cbRowInfo* pRowNode, wxList* pLst );
};
/*
This class declares an abstract interface for optimized logic that should refresh
areas of frame layout that actually need to be updated. This should be extended in future
to implement a custom updating strategy.
*/
class WXDLLIMPEXP_FL cbUpdatesManagerBase : public wxObject
{
DECLARE_ABSTRACT_CLASS( cbUpdatesManagerBase )
public: /* protected really, accessed by serializer (if any) */
wxFrameLayout* mpLayout;
public:
// Default constructor
cbUpdatesManagerBase(void)
: mpLayout( 0 ) {}
// Constructor taking layout panel.
cbUpdatesManagerBase( wxFrameLayout* pPanel )
: mpLayout( pPanel ) {}
// Destructor.
virtual ~cbUpdatesManagerBase() {}
// Sets the associated layout.
void SetLayout( wxFrameLayout* pLayout ) { mpLayout = pLayout; }
// This function receives a notification from the frame layout (in the order in which
// they would usually be invoked). Custom updates-managers may utilize
// these notifications to implement a more fine-grained updating strategy.
virtual void OnStartChanges() = 0;
// This function receives a notification from the frame layout (in the order in which
// they would usually be invoked). Custom updates-managers may utilize
// these notifications to implement a more fine-grained updating strategy.
virtual void OnRowWillChange( cbRowInfo* WXUNUSED(pRow), cbDockPane* WXUNUSED(pInPane) ) {}
// This function receives a notification from the frame layout (in the order in which
// they would usually be invoked). Custom updates-managers may utilize
// these notifications to implement a more fine-grained updating strategy.
virtual void OnBarWillChange( cbBarInfo* WXUNUSED(pBar), cbRowInfo* WXUNUSED(pInRow), cbDockPane* WXUNUSED(pInPane) ) {}
// This function receives a notification from the frame layout (in the order in which
// they would usually be invoked). Custom updates-managers may utilize
// these notifications to implement a more fine-grained updating strategy.
virtual void OnPaneMarginsWillChange( cbDockPane* WXUNUSED(pPane) ) {}
// This function receives a notification from the frame layout (in the order in which
// they would usually be invoked). Custom updates-managers may utilize
// these notifications to implement a more fine-grained updating strategy.
virtual void OnPaneWillChange( cbDockPane* WXUNUSED(pPane) ) {}
// This function receives a notification from the frame layout (in the order in which
// they would usually be invoked). Custom updates-managers may utilize
// these notifications to implement a more fine-grained updating strategy.
virtual void OnFinishChanges() {}
// Refreshes parts of the frame layout that need an update.
virtual void UpdateNow() = 0;
};
/*
Base class for all control-bar plugin events.
This is not a dynamically-creatable class.
*/
class cbPluginEvent : public wxEvent
{
public:
// NULL if event is not addressed to any specific pane.
cbDockPane* mpPane;
// Not used, but required.
virtual wxEvent* Clone() const { return NULL; }
// Constructor, taking event type and pane.
cbPluginEvent( wxEventType eventType, cbDockPane* pPane )
: mpPane( pPane )
{ m_eventType = eventType; }
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -