Tidied/commented FL header files, regenerated docs and filled out Category section.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13738 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
// Created: 23/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __ANTIFLICKPL_G__
|
||||
@@ -20,50 +20,66 @@
|
||||
|
||||
/*
|
||||
Implements double-buffering to reduce flicker.
|
||||
Bitmap and memory DC buffers are shared "resources" among all instances of
|
||||
Bitmap and memory DC buffers are shared 'resources' among all instances of
|
||||
antiflicker plugins within the application.
|
||||
|
||||
Locking for multithreaded applications is not yet implemented.
|
||||
Locking for multithreaded applications is not yet implemented.
|
||||
*/
|
||||
|
||||
class cbAntiflickerPlugin : public cbPluginBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbAntiflickerPlugin )
|
||||
protected:
|
||||
|
||||
static wxBitmap* mpVertBuf;
|
||||
static wxBitmap* mpHorizBuf;
|
||||
static wxMemoryDC* mpVertBufDc;
|
||||
static wxMemoryDC* mpHorizBufDc;
|
||||
static wxBitmap* mpVertBuf;
|
||||
static wxBitmap* mpHorizBuf;
|
||||
static wxMemoryDC* mpVertBufDc;
|
||||
static wxMemoryDC* mpHorizBufDc;
|
||||
|
||||
static int mRefCount;
|
||||
static int mRefCount;
|
||||
|
||||
wxDC* mpLRUBufDc; // last-recently-used buffer
|
||||
wxRect mLRUArea; // last-recently-used area
|
||||
wxDC* mpLRUBufDc; // last-recently-used buffer
|
||||
wxRect mLRUArea; // last-recently-used area
|
||||
|
||||
protected:
|
||||
// Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
|
||||
wxDC* FindSuitableBuffer( const wxRect& forArea );
|
||||
// Allocates a suitable buffer.
|
||||
wxDC* AllocNewBuffer( const wxRect& forArea );
|
||||
// Finds a suitable buffer. Returns NULL if a suitable buffer is not present.
|
||||
|
||||
wxDC& GetWindowDC();
|
||||
wxDC& GetClientDC();
|
||||
wxDC* FindSuitableBuffer( const wxRect& forArea );
|
||||
|
||||
// Allocates a suitable buffer.
|
||||
|
||||
wxDC* AllocNewBuffer( const wxRect& forArea );
|
||||
|
||||
// Gets the window device context.
|
||||
|
||||
wxDC& GetWindowDC();
|
||||
|
||||
// Gets the client device context.
|
||||
|
||||
wxDC& GetClientDC();
|
||||
public:
|
||||
|
||||
cbAntiflickerPlugin(void);
|
||||
// Default constructor.
|
||||
|
||||
cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
cbAntiflickerPlugin(void);
|
||||
|
||||
virtual ~cbAntiflickerPlugin();
|
||||
// Constructor taking frame layout panel, and pane mask.
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
||||
cbAntiflickerPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event );
|
||||
// Destructor.
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
virtual ~cbAntiflickerPlugin();
|
||||
|
||||
// Handler for plugin event.
|
||||
|
||||
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
||||
|
||||
// Handler for plugin event.
|
||||
|
||||
void OnFinishDrawInArea( cbFinishDrawInAreaEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __ANTIFLICKPL_G__ */
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 23/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __BARDRAGPL_G__
|
||||
@@ -19,149 +19,154 @@
|
||||
#include "wx/fl/controlbar.h"
|
||||
#include "wx/fl/toolwnd.h"
|
||||
|
||||
/*
|
||||
Plugin class implementing bar dragging.
|
||||
*/
|
||||
|
||||
class cbBarDragPlugin : public cbPluginBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbBarDragPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbBarDragPlugin )
|
||||
protected:
|
||||
|
||||
// plugin is active only in bar-dragging state
|
||||
bool mBarDragStarted;
|
||||
bool mCanStick; // flag used to prevent "bouncing" of hint-rectangle
|
||||
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
||||
wxCursor* mpCurCursor;
|
||||
// plugin is active only in bar-dragging state
|
||||
bool mBarDragStarted;
|
||||
bool mCanStick; // flag used to prevent "bouncing" of hint-rectangle
|
||||
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
||||
wxCursor* mpCurCursor;
|
||||
|
||||
// rectangle shows the position/dimensions of the bar,
|
||||
// if it would be docked now
|
||||
// rectangle shows the position/dimensions of the bar,
|
||||
// if it would be docked now
|
||||
|
||||
wxRect mPrevHintRect;
|
||||
wxRect mHintRect;
|
||||
wxRect mPrevHintRect;
|
||||
wxRect mHintRect;
|
||||
|
||||
|
||||
int mMouseInRectX;
|
||||
int mMouseInRectY;
|
||||
int mMouseInRectX;
|
||||
int mMouseInRectY;
|
||||
|
||||
cbDockPane* mpSrcPane; // pane, from which the bar was originally taken
|
||||
int mBarWidthInSrcPane;
|
||||
cbDockPane* mpSrcPane; // pane, from which the bar was originally taken
|
||||
int mBarWidthInSrcPane;
|
||||
|
||||
cbDockPane* mpCurPane;
|
||||
cbDockPane* mpCurPane;
|
||||
|
||||
cbBarInfo* mpDraggedBar; // bar, which is being dragged
|
||||
bool mBarWasFloating;
|
||||
wxRect mFloatedBarBounds;
|
||||
cbBarInfo* mpDraggedBar; // bar, which is being dragged
|
||||
bool mBarWasFloating;
|
||||
wxRect mFloatedBarBounds;
|
||||
|
||||
public: /*** public properties ***/
|
||||
|
||||
int mInClientHintBorder; // when hint-rect moves within client window area,
|
||||
int mInClientHintBorder; // when hint-rect moves within client window area,
|
||||
// the thicker rectangle is drawn using hatched brush,
|
||||
// the default border width for this rectangle is 8 pix.
|
||||
// the default border width for this rectangle is 8 pix.
|
||||
|
||||
protected:
|
||||
|
||||
// Internal implementation function.
|
||||
void AdjustHintRect( wxPoint& mousePos );
|
||||
// Internal implementation function.
|
||||
void AdjustHintRect( wxPoint& mousePos );
|
||||
|
||||
// Internal implementation function.
|
||||
void ClipRectInFrame( wxRect& rect );
|
||||
// Internal implementation function.
|
||||
void ClipRectInFrame( wxRect& rect );
|
||||
|
||||
// Internal implementation function.
|
||||
void ClipPosInFrame( wxPoint& pos );
|
||||
// Internal implementation function.
|
||||
void ClipPosInFrame( wxPoint& pos );
|
||||
|
||||
// Internal implementation function. Finds the pane
|
||||
// under the specified rectangle.
|
||||
cbDockPane* HitTestPanes( wxRect& rect );
|
||||
// Internal implementation function. Finds the pane
|
||||
// under the specified rectangle.
|
||||
cbDockPane* HitTestPanes( wxRect& rect );
|
||||
|
||||
// Internal implementation function. Finds the pane
|
||||
// under the specified point.
|
||||
cbDockPane* HitTestPanes( wxPoint& pos );
|
||||
// Internal implementation function. Finds the pane
|
||||
// under the specified point.
|
||||
cbDockPane* HitTestPanes( wxPoint& pos );
|
||||
|
||||
// Internal implementation function.
|
||||
bool HitsPane( cbDockPane* pPane, wxRect& rect );
|
||||
// Internal implementation function.
|
||||
bool HitsPane( cbDockPane* pPane, wxRect& rect );
|
||||
|
||||
// Internal implementation function.
|
||||
void CalcOnScreenDims( wxRect& rect );
|
||||
// Internal implementation function.
|
||||
void CalcOnScreenDims( wxRect& rect );
|
||||
|
||||
// Internal implementation function.
|
||||
int GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||
// Internal implementation function.
|
||||
int GetDistanceToPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||
|
||||
// Internal implementation function.
|
||||
bool IsInOtherPane ( wxPoint& mousePos );
|
||||
// Internal implementation function.
|
||||
bool IsInOtherPane ( wxPoint& mousePos );
|
||||
|
||||
// Internal implementation function.
|
||||
bool IsInClientArea( wxPoint& mousePos );
|
||||
// Internal implementation function.
|
||||
bool IsInClientArea( wxPoint& mousePos );
|
||||
|
||||
// Internal implementation function.
|
||||
bool IsInClientArea( wxRect& rect );
|
||||
// Internal implementation function.
|
||||
bool IsInClientArea( wxRect& rect );
|
||||
|
||||
// Internal implementation function.
|
||||
void StickToPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||
// Internal implementation function.
|
||||
void StickToPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||
|
||||
// Internal implementation function.
|
||||
void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||
// Internal implementation function.
|
||||
void UnstickFromPane( cbDockPane* pPane, wxPoint& mousePos );
|
||||
|
||||
// Internal implementation function.
|
||||
int GetBarWidthInPane( cbDockPane* pPane );
|
||||
// Internal implementation function.
|
||||
int GetBarWidthInPane( cbDockPane* pPane );
|
||||
|
||||
// Internal implementation function.
|
||||
int GetBarHeightInPane( cbDockPane* pPane );
|
||||
// Internal implementation function.
|
||||
int GetBarHeightInPane( cbDockPane* pPane );
|
||||
|
||||
// on-screen hint-tracking related methods
|
||||
// on-screen hint-tracking related methods
|
||||
|
||||
// Internal implementation function.
|
||||
// Start showing a visual hint while dragging.
|
||||
void StartTracking();
|
||||
// Internal implementation function.
|
||||
// Start showing a visual hint while dragging.
|
||||
void StartTracking();
|
||||
|
||||
// Internal implementation function.
|
||||
// Draw the visual hint while dragging.
|
||||
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
||||
// Internal implementation function.
|
||||
// Erase the visual hint while dragging.
|
||||
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
||||
// Internal implementation function.
|
||||
// Draw the visual hint while dragging.
|
||||
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
||||
|
||||
// Internal implementation function.
|
||||
// Stop showing the visual hint while dragging.
|
||||
void FinishTracking();
|
||||
// Internal implementation function.
|
||||
// Erase the visual hint while dragging.
|
||||
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
||||
|
||||
// Internal implementation function.
|
||||
// Draw the hint rectangle.
|
||||
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
||||
// Internal implementation function.
|
||||
// Stop showing the visual hint while dragging.
|
||||
void FinishTracking();
|
||||
|
||||
// Internal implementation function.
|
||||
// Converts the given rectangle from window to screen coordinates.
|
||||
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
||||
// Internal implementation function.
|
||||
// Draw the hint rectangle.
|
||||
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
||||
|
||||
// Internal implementation function.
|
||||
// Show the hint; called within OnMouseMove.
|
||||
void ShowHint( bool prevWasInClient );
|
||||
// Internal implementation function.
|
||||
// Converts the given rectangle from window to screen coordinates.
|
||||
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
||||
|
||||
// Internal implementation function.
|
||||
// Show the hint; called within OnMouseMove.
|
||||
void ShowHint( bool prevWasInClient );
|
||||
|
||||
public:
|
||||
// Default constructor.
|
||||
cbBarDragPlugin(void);
|
||||
// Default constructor.
|
||||
cbBarDragPlugin(void);
|
||||
|
||||
// Constructor taking a parent frame, and flag. See cbPluginBase.
|
||||
cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
// Constructor taking a parent frame, and flag. See cbPluginBase.
|
||||
cbBarDragPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
|
||||
// Destructor.
|
||||
virtual ~cbBarDragPlugin();
|
||||
// Destructor.
|
||||
virtual ~cbBarDragPlugin();
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnMouseMove( cbMotionEvent& event );
|
||||
// Handler for plugin event.
|
||||
void OnMouseMove( cbMotionEvent& event );
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnLButtonUp( cbLeftUpEvent& event );
|
||||
// Handler for plugin event.
|
||||
void OnLButtonUp( cbLeftUpEvent& event );
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnLButtonDown( cbLeftDownEvent& event );
|
||||
// Handler for plugin event.
|
||||
void OnLButtonDown( cbLeftDownEvent& event );
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnLDblClick( cbLeftDClickEvent& event );
|
||||
// Handler for plugin event.
|
||||
void OnLDblClick( cbLeftDClickEvent& event );
|
||||
|
||||
// Handles event, which originates from itself.
|
||||
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
||||
// Handles event, which originates from itself.
|
||||
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
||||
|
||||
// Handler for plugin event.
|
||||
void OnStartBarDragging( cbStartBarDraggingEvent& event );
|
||||
// Handler for plugin event.
|
||||
void OnStartBarDragging( cbStartBarDraggingEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __BARDRAGPL_G__ */
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 30/11/98 (my 22th birthday :-)
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DRAGHINTSPL_G__
|
||||
@@ -26,89 +26,89 @@ around fixed and flexible bars, similar to those in Microsoft DevStudio 6.x
|
||||
|
||||
class cbBarHintsPlugin : public cbPluginBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbBarHintsPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbBarHintsPlugin )
|
||||
|
||||
protected:
|
||||
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||
|
||||
cbMiniButton* mBoxes[2];
|
||||
cbMiniButton* mBoxes[2];
|
||||
|
||||
bool mBtnPressed;
|
||||
bool mClosePressed;
|
||||
cbBarInfo* mpClickedBar;
|
||||
bool mDepressed;
|
||||
bool mBtnPressed;
|
||||
bool mClosePressed;
|
||||
cbBarInfo* mpClickedBar;
|
||||
bool mDepressed;
|
||||
|
||||
protected:
|
||||
// Helper function: draws a 3D box.
|
||||
void Draw3DBox ( wxDC& dc, const wxPoint& pos, bool pressed );
|
||||
// Helper function: draws a 3D box.
|
||||
void Draw3DBox ( wxDC& dc, const wxPoint& pos, bool pressed );
|
||||
|
||||
// Helper function: draws a close box.
|
||||
void DrawCloseBox ( wxDC& dc, const wxPoint& pos, bool pressed );
|
||||
// Helper function: draws a close box.
|
||||
void DrawCloseBox ( wxDC& dc, const wxPoint& pos, bool pressed );
|
||||
|
||||
// Helper function: draws a collapse box.
|
||||
void DrawCollapseBox( wxDC& dc, const wxPoint& pos,
|
||||
bool atLeft, bool disabled, bool pressed );
|
||||
// Helper function: draws a collapse box.
|
||||
void DrawCollapseBox( wxDC& dc, const wxPoint& pos,
|
||||
bool atLeft, bool disabled, bool pressed );
|
||||
|
||||
// Helper function: draws grooves.
|
||||
void DrawGrooves ( wxDC& dc, const wxPoint& pos, int length );
|
||||
// Helper function: draws grooves.
|
||||
void DrawGrooves ( wxDC& dc, const wxPoint& pos, int length );
|
||||
|
||||
// Helper function: draws a hint.
|
||||
void DoDrawHint( wxDC& dc, wxRect& rect, int pos, int boxOfs, int grooveOfs, bool isFixed );
|
||||
|
||||
// Helper function: gets the layout of a hint.
|
||||
void GetHintsLayout( wxRect& rect, cbBarInfo& info,
|
||||
int& boxOfs, int& grooveOfs, int& pos );
|
||||
// Helper function: draws a hint.
|
||||
void DoDrawHint( wxDC& dc, wxRect& rect, int pos, int boxOfs, int grooveOfs, bool isFixed );
|
||||
|
||||
// Helper function: returns information about the hint under the given position.
|
||||
int HitTestHints( cbBarInfo& info, const wxPoint& pos );
|
||||
// Helper function: gets the layout of a hint.
|
||||
void GetHintsLayout( wxRect& rect, cbBarInfo& info,
|
||||
int& boxOfs, int& grooveOfs, int& pos );
|
||||
|
||||
// Helper function.
|
||||
void ExcludeHints( wxRect& rect, cbBarInfo& info );
|
||||
// Helper function: returns information about the hint under the given position.
|
||||
int HitTestHints( cbBarInfo& info, const wxPoint& pos );
|
||||
|
||||
// Helper function: creates close and collapse boxes.
|
||||
void CreateBoxes();
|
||||
// Helper function.
|
||||
void ExcludeHints( wxRect& rect, cbBarInfo& info );
|
||||
|
||||
// Helper function: creates close and collapse boxes.
|
||||
void CreateBoxes();
|
||||
|
||||
public:
|
||||
/* public properties */
|
||||
/* public properties */
|
||||
|
||||
bool mCloseBoxOn; // default: ON
|
||||
bool mCollapseBoxOn; // default: ON
|
||||
int mGrooveCount; // default: 2 (two shaded bars)
|
||||
int mHintGap; // default: 5 (pixels from above, below, right and left)
|
||||
int mXWeight; // default: 2 (width in pixels of lines which used for drawing cross)
|
||||
bool mCloseBoxOn; // default: ON
|
||||
bool mCollapseBoxOn; // default: ON
|
||||
int mGrooveCount; // default: 2 (two shaded bars)
|
||||
int mHintGap; // default: 5 (pixels from above, below, right and left)
|
||||
int mXWeight; // default: 2 (width in pixels of lines which used for drawing cross)
|
||||
|
||||
public:
|
||||
// Default constructor.
|
||||
cbBarHintsPlugin(void);
|
||||
// Default constructor.
|
||||
cbBarHintsPlugin(void);
|
||||
|
||||
// Constructor, taking parent frame and pane mask flag.
|
||||
cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
||||
// Constructor, taking parent frame and pane mask flag.
|
||||
cbBarHintsPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
||||
|
||||
// Destructor.
|
||||
// Destructor.
|
||||
~cbBarHintsPlugin();
|
||||
|
||||
// Set the number of grooves to be shown in the pane.
|
||||
void SetGrooveCount( int nGrooves );
|
||||
// Set the number of grooves to be shown in the pane.
|
||||
void SetGrooveCount( int nGrooves );
|
||||
|
||||
// Called to initialize this plugin.
|
||||
void OnInitPlugin();
|
||||
// Called to initialize this plugin.
|
||||
void OnInitPlugin();
|
||||
|
||||
// Handles a plugin event.
|
||||
void OnSizeBarWindow( cbSizeBarWndEvent& event );
|
||||
// Handles a plugin event.
|
||||
void OnSizeBarWindow( cbSizeBarWndEvent& event );
|
||||
|
||||
// Handles a plugin event.
|
||||
void OnDrawBarDecorations( cbDrawBarDecorEvent& event );
|
||||
// Handles a plugin event.
|
||||
void OnDrawBarDecorations( cbDrawBarDecorEvent& event );
|
||||
|
||||
// Handles a plugin event.
|
||||
void OnLeftDown( cbLeftDownEvent& event );
|
||||
// Handles a plugin event.
|
||||
void OnLeftDown( cbLeftDownEvent& event );
|
||||
|
||||
// Handles a plugin event.
|
||||
void OnLeftUp ( cbLeftUpEvent& event );
|
||||
// Handles a plugin event.
|
||||
void OnLeftUp ( cbLeftUpEvent& event );
|
||||
|
||||
// Handles a plugin event.
|
||||
void OnMotion ( cbMotionEvent& event );
|
||||
// Handles a plugin event.
|
||||
void OnMotion ( cbMotionEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __DRAGHINTSPL_G__ */
|
||||
|
@@ -6,7 +6,7 @@
|
||||
// Created: 28/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __CBCUSTOM_G__
|
||||
@@ -27,27 +27,27 @@ and horizontal/vertical alignment of the bar.
|
||||
class cbSimpleCustomizationPlugin : public cbPluginBase
|
||||
{
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS( cbSimpleCustomizationPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbSimpleCustomizationPlugin )
|
||||
|
||||
int mCustMenuItemId;
|
||||
int mCustMenuItemId;
|
||||
public:
|
||||
|
||||
// Default constructor.
|
||||
cbSimpleCustomizationPlugin(void);
|
||||
// Default constructor.
|
||||
cbSimpleCustomizationPlugin(void);
|
||||
|
||||
// Constructor, taking parent pane and a pane mask flag.
|
||||
cbSimpleCustomizationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
// Constructor, taking parent pane and a pane mask flag.
|
||||
cbSimpleCustomizationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
|
||||
// Plugin event handler for cbCustomizeBarEvent.
|
||||
void OnCustomizeBar( cbCustomizeBarEvent& event );
|
||||
// Plugin event handler for cbCustomizeBarEvent.
|
||||
void OnCustomizeBar( cbCustomizeBarEvent& event );
|
||||
|
||||
// Plugin event handler for cbCustomizeLayoutEvent.
|
||||
void OnCustomizeLayout( cbCustomizeLayoutEvent& event );
|
||||
// Plugin event handler for cbCustomizeLayoutEvent.
|
||||
void OnCustomizeLayout( cbCustomizeLayoutEvent& event );
|
||||
|
||||
// Menu event handler.
|
||||
void OnMenuItemSelected( wxCommandEvent& event );
|
||||
// Menu event handler.
|
||||
void OnMenuItemSelected( wxCommandEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __CBCUSTOM_G__ */
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: dynbarhnd.h
|
||||
// Purpose: This header simply includes controlbar.h.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 23/01/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DYNBARHND_G__
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: dyntbar.h
|
||||
// Purpose: wxDynamicToolBar header
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: ??/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DYNTBAR_G__
|
||||
@@ -19,13 +19,15 @@
|
||||
#include "wx/tbarbase.h"
|
||||
#include "wx/dynarray.h"
|
||||
|
||||
// layout item
|
||||
/*
|
||||
Tool layout item.
|
||||
*/
|
||||
|
||||
class wxToolLayoutItem : public wxObject
|
||||
{
|
||||
public:
|
||||
wxRect mRect;
|
||||
bool mIsSeparator;
|
||||
wxRect mRect;
|
||||
bool mIsSeparator;
|
||||
};
|
||||
|
||||
class wxDynToolInfo;
|
||||
@@ -33,160 +35,215 @@ class wxDynToolInfo;
|
||||
typedef wxToolLayoutItem* wxToolLayoutItemPtrT;
|
||||
typedef wxDynToolInfo* wxDynToolInfoPtrT;
|
||||
|
||||
|
||||
WX_DEFINE_ARRAY( wxToolLayoutItemPtrT, wxLayoutItemArrayT );
|
||||
WX_DEFINE_ARRAY( wxDynToolInfoPtrT, wxDynToolInfoArrayT );
|
||||
|
||||
// base class for layouting algorithm implementations
|
||||
/*
|
||||
This is a base class for layout algorithm implementations.
|
||||
*/
|
||||
|
||||
class LayoutManagerBase
|
||||
{
|
||||
public:
|
||||
virtual void Layout( const wxSize& parentDim,
|
||||
wxSize& resultingDim,
|
||||
wxLayoutItemArrayT& items,
|
||||
int horizGap,
|
||||
int vertGap ) = 0;
|
||||
// Constructor.
|
||||
virtual void Layout( const wxSize& parentDim,
|
||||
wxSize& resultingDim,
|
||||
wxLayoutItemArrayT& items,
|
||||
int horizGap,
|
||||
int vertGap ) = 0;
|
||||
|
||||
virtual ~LayoutManagerBase() {}
|
||||
// Destructor.
|
||||
virtual ~LayoutManagerBase() {}
|
||||
};
|
||||
|
||||
// layouts items in left-to-right order from
|
||||
// top towards bottom
|
||||
/*
|
||||
BagLayout lays out items in left-to-right order from
|
||||
top to bottom.
|
||||
*/
|
||||
|
||||
class BagLayout : public LayoutManagerBase
|
||||
{
|
||||
public:
|
||||
virtual void Layout( const wxSize& parentDim,
|
||||
wxSize& resultingDim,
|
||||
wxLayoutItemArrayT& items,
|
||||
int horizGap,
|
||||
int vertGap );
|
||||
// Constructor.
|
||||
virtual void Layout( const wxSize& parentDim,
|
||||
wxSize& resultingDim,
|
||||
wxLayoutItemArrayT& items,
|
||||
int horizGap,
|
||||
int vertGap );
|
||||
};
|
||||
|
||||
/*
|
||||
This class holds dynamic toolbar item information.
|
||||
*/
|
||||
|
||||
class wxDynToolInfo : public wxToolLayoutItem
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDynToolInfo)
|
||||
DECLARE_DYNAMIC_CLASS(wxDynToolInfo)
|
||||
|
||||
public:
|
||||
wxWindow* mpToolWnd;
|
||||
int mIndex;
|
||||
wxSize mRealSize;
|
||||
wxWindow* mpToolWnd;
|
||||
int mIndex;
|
||||
wxSize mRealSize;
|
||||
};
|
||||
|
||||
// layouting orientations for tools
|
||||
// Layout orientations for tools
|
||||
|
||||
#define LO_HORIZONTAL 0
|
||||
#define LO_VERTICAL 1
|
||||
#define LO_FIT_TO_WINDOW 2
|
||||
|
||||
// class manages containment and layouting of tool-windows
|
||||
/*
|
||||
wxDynamicToolBar manages containment and layout of tool windows.
|
||||
*/
|
||||
|
||||
class wxDynamicToolBar : public wxToolBarBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxDynamicToolBar)
|
||||
DECLARE_DYNAMIC_CLASS(wxDynamicToolBar)
|
||||
protected:
|
||||
|
||||
friend class wxDynamicToolBarSerializer;
|
||||
friend class wxDynamicToolBarSerializer;
|
||||
|
||||
wxDynToolInfoArrayT mTools;
|
||||
LayoutManagerBase* mpLayoutMan;
|
||||
wxDynToolInfoArrayT mTools;
|
||||
LayoutManagerBase* mpLayoutMan;
|
||||
|
||||
protected:
|
||||
virtual void SizeToolWindows();
|
||||
// Internal function for sizing tool windows.
|
||||
virtual void SizeToolWindows();
|
||||
|
||||
public: /* public properties */
|
||||
|
||||
int mSepartorSize; // default: 8
|
||||
int mVertGap; // default: 0
|
||||
int mHorizGap; // default: 0
|
||||
|
||||
int mSepartorSize; // default: 8
|
||||
int mVertGap; // default: 0
|
||||
int mHorizGap; // default: 0
|
||||
|
||||
public:
|
||||
wxDynamicToolBar();
|
||||
// Default constructor.
|
||||
|
||||
wxDynamicToolBar(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
const long style = wxNO_BORDER, const int orientation = wxVERTICAL,
|
||||
const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
wxDynamicToolBar();
|
||||
|
||||
~wxDynamicToolBar(void);
|
||||
// Constructor: see the documentation for wxToolBar for details.
|
||||
|
||||
bool Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
const long style = wxNO_BORDER, const int orientation = wxVERTICAL, const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
wxDynamicToolBar(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
const long style = wxNO_BORDER, const int orientation = wxVERTICAL,
|
||||
const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
|
||||
// overridables
|
||||
// Destructor.
|
||||
|
||||
virtual void AddTool( int toolIndex,
|
||||
wxWindow* pToolWindow,
|
||||
~wxDynamicToolBar(void);
|
||||
|
||||
// Creation function: see the documentation for wxToolBar for details.
|
||||
|
||||
bool Create(wxWindow *parent, const wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
|
||||
const long style = wxNO_BORDER, const int orientation = wxVERTICAL, const int RowsOrColumns = 1, const wxString& name = wxToolBarNameStr);
|
||||
|
||||
// Adds a tool. See the documentation for wxToolBar for details.
|
||||
|
||||
virtual void AddTool( int toolIndex,
|
||||
wxWindow* pToolWindow,
|
||||
const wxSize& size = wxDefaultSize );
|
||||
|
||||
virtual void AddTool( int toolIndex,
|
||||
// Adds a tool. See the documentation for wxToolBar for details.
|
||||
|
||||
virtual void AddTool( int toolIndex,
|
||||
const wxString& imageFileName,
|
||||
wxBitmapType imageFileType = wxBITMAP_TYPE_BMP,
|
||||
const wxString& labelText = "", bool alignTextRight = FALSE,
|
||||
bool isFlat = TRUE );
|
||||
virtual void AddTool( int toolIndex, wxBitmap labelBmp,
|
||||
// Adds a tool. See the documentation for wxToolBar for details.
|
||||
|
||||
virtual void AddTool( int toolIndex, wxBitmap labelBmp,
|
||||
const wxString& labelText = "", bool alignTextRight = FALSE,
|
||||
bool isFlat = TRUE );
|
||||
|
||||
// method from wxToolBarBase (for compatibility), only
|
||||
// first two arguments are valid
|
||||
// Method from wxToolBarBase (for compatibility), only
|
||||
// the first two arguments are valid.
|
||||
// See the documentation for wxToolBar for details.
|
||||
|
||||
virtual wxToolBarToolBase *AddTool(const int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap,
|
||||
virtual wxToolBarToolBase *AddTool(const int toolIndex, const wxBitmap& bitmap, const wxBitmap& pushedBitmap = wxNullBitmap,
|
||||
const bool toggle = FALSE, const long xPos = -1, const long yPos = -1, wxObject *clientData = NULL,
|
||||
const wxString& helpString1 = "", const wxString& helpString2 = "");
|
||||
|
||||
virtual void AddSeparator( wxWindow* pSepartorWnd = NULL );
|
||||
// Adds a separator. See the documentation for wxToolBar for details.
|
||||
|
||||
wxDynToolInfo* GetToolInfo( int toolIndex );
|
||||
virtual void AddSeparator( wxWindow* pSepartorWnd = NULL );
|
||||
|
||||
void RemveTool( int toolIndex );
|
||||
// Returns tool information for the given tool index.
|
||||
|
||||
// the default implementation draws shaded line
|
||||
virtual void DrawSeparator( wxDynToolInfo& info, wxDC& dc );
|
||||
wxDynToolInfo* GetToolInfo( int toolIndex );
|
||||
|
||||
// see definitions of orientation types
|
||||
virtual bool Layout();
|
||||
// Removes the given tool. Misspelt in order not to clash with a similar function
|
||||
// in the base class.
|
||||
|
||||
virtual void GetPreferredDim( const wxSize& givenDim, wxSize& prefDim );
|
||||
void RemveTool( int toolIndex );
|
||||
|
||||
virtual LayoutManagerBase* CreateDefaulLayout() { return new BagLayout(); }
|
||||
// Draws a separator. The default implementation draws a shaded line.
|
||||
|
||||
virtual void SetLayout( LayoutManagerBase* pLayout );
|
||||
virtual void DrawSeparator( wxDynToolInfo& info, wxDC& dc );
|
||||
|
||||
virtual void EnableTool(const int toolIndex, const bool enable = TRUE);
|
||||
// Performs layout. See definitions of orientation types.
|
||||
|
||||
// event handlers
|
||||
virtual bool Layout();
|
||||
|
||||
void OnSize( wxSizeEvent& event );
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
// Returns the preferred dimension, taking the given dimension and a reference to the result.
|
||||
|
||||
// overriden from wxToolBarBase
|
||||
virtual void GetPreferredDim( const wxSize& givenDim, wxSize& prefDim );
|
||||
|
||||
virtual bool Realize(void);
|
||||
// Creates the default layout (BagLayout).
|
||||
|
||||
// stuff from the 2.1.15
|
||||
virtual LayoutManagerBase* CreateDefaultLayout() { return new BagLayout(); }
|
||||
|
||||
// Sets the layout for this toolbar.
|
||||
|
||||
virtual void SetLayout( LayoutManagerBase* pLayout );
|
||||
|
||||
// Enables or disables the given tool.
|
||||
|
||||
virtual void EnableTool(const int toolIndex, const bool enable = TRUE);
|
||||
|
||||
// Responds to size events, calling Layout.
|
||||
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
// Responds to paint events, drawing separators.
|
||||
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
|
||||
// Responds to background erase events. Currently does nothing.
|
||||
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
|
||||
// Overriden from wxToolBarBase; does nothing.
|
||||
|
||||
virtual bool Realize(void);
|
||||
|
||||
// Finds a tool for the given position.
|
||||
|
||||
virtual wxToolBarToolBase *FindToolForPosition(wxCoord x,
|
||||
wxCoord y) const;
|
||||
|
||||
// Inserts a tool at the given position.
|
||||
|
||||
virtual bool DoInsertTool(size_t pos, wxToolBarToolBase *tool);
|
||||
|
||||
// the tool is still in m_tools list when this function is called, it will
|
||||
// only be deleted from it if it succeeds
|
||||
// Deletes a tool. The tool is still in m_tools list when this function is called, and it will
|
||||
// only be deleted from it if it succeeds.
|
||||
|
||||
virtual bool DoDeleteTool(size_t pos, wxToolBarToolBase *tool);
|
||||
|
||||
// called when the tools enabled flag changes
|
||||
// Called when the tools enabled flag changes.
|
||||
|
||||
virtual void DoEnableTool(wxToolBarToolBase *tool, bool enable);
|
||||
|
||||
// called when the tool is toggled
|
||||
// Called when the tool is toggled.
|
||||
|
||||
virtual void DoToggleTool(wxToolBarToolBase *tool, bool toggle);
|
||||
|
||||
// called when the tools "can be toggled" flag changes
|
||||
// Called when the tools 'can be toggled' flag changes.
|
||||
|
||||
virtual void DoSetToggle(wxToolBarToolBase *tool, bool toggle);
|
||||
|
||||
// the functions to create toolbar tools
|
||||
// Creates a toolbar tool.
|
||||
|
||||
virtual wxToolBarToolBase *CreateTool(int id,
|
||||
const wxBitmap& bitmap1,
|
||||
const wxBitmap& bitmap2,
|
||||
@@ -194,10 +251,12 @@ public:
|
||||
wxObject *clientData,
|
||||
const wxString& shortHelpString,
|
||||
const wxString& longHelpString);
|
||||
|
||||
// Creates a toolbar tool.
|
||||
|
||||
virtual wxToolBarToolBase *CreateTool(wxControl *control);
|
||||
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __DYNTBAR_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Name: dyntbarhnd.h
|
||||
// Purpose: Contrib. demo
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 23/01/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DYNTBARHND_G__
|
||||
@@ -19,12 +19,22 @@
|
||||
#include "wx/fl/controlbar.h"
|
||||
#include "wx/fl/dyntbar.h"
|
||||
|
||||
/*
|
||||
Dynamic toolbar dimension handler.
|
||||
*/
|
||||
|
||||
class cbDynToolBarDimHandler : public cbBarDimHandlerBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbDynToolBarDimHandler )
|
||||
DECLARE_DYNAMIC_CLASS( cbDynToolBarDimHandler )
|
||||
public:
|
||||
void OnChangeBarState(cbBarInfo* pBar, int newState );
|
||||
void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred );
|
||||
|
||||
// Called when the bar changes state.
|
||||
|
||||
void OnChangeBarState(cbBarInfo* pBar, int newState );
|
||||
|
||||
// Called when a bar is resized.
|
||||
|
||||
void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred );
|
||||
};
|
||||
|
||||
#endif /* __DYNTBARHND_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: frmview.h
|
||||
// Purpose: wxFrameView and wxFrameManager classes.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 02/01/99
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __FRMVIEW_G__
|
||||
@@ -28,112 +28,120 @@ class wxObjectStorage;
|
||||
|
||||
class wxFrameManager;
|
||||
|
||||
/*
|
||||
It is not clear what this class does. It is not used elsewhere in FL.
|
||||
*/
|
||||
|
||||
class wxFrameView : public wxEvtHandler
|
||||
{
|
||||
protected:
|
||||
wxStringList mTopMenus;
|
||||
wxFrameLayout* mpLayout;
|
||||
wxFrameManager* mpFrameMgr;
|
||||
bool mDoToolUpdates;
|
||||
wxStringList mTopMenus;
|
||||
wxFrameLayout* mpLayout;
|
||||
wxFrameManager* mpFrameMgr;
|
||||
bool mDoToolUpdates;
|
||||
|
||||
friend class wxFrameManager;
|
||||
friend class wxFrameViewSerializer;
|
||||
friend class wxFrameManager;
|
||||
friend class wxFrameViewSerializer;
|
||||
|
||||
protected:
|
||||
void OnIdle( wxIdleEvent& event);
|
||||
|
||||
void OnIdle( wxIdleEvent& event);
|
||||
|
||||
public:
|
||||
wxFrameView();
|
||||
~wxFrameView();
|
||||
wxFrameView();
|
||||
~wxFrameView();
|
||||
|
||||
virtual void Activate();
|
||||
virtual void Deactivate();
|
||||
virtual void Activate();
|
||||
virtual void Deactivate();
|
||||
|
||||
wxFrame* GetParentFrame();
|
||||
wxWindow* GetClientWindow();
|
||||
wxFrame* GetParentFrame();
|
||||
wxWindow* GetClientWindow();
|
||||
|
||||
wxFrameManager& GetFrameManager();
|
||||
wxFrameManager& GetFrameManager();
|
||||
|
||||
void RegisterMenu( const wxString& topMenuName );
|
||||
void RegisterMenu( const wxString& topMenuName );
|
||||
|
||||
void CreateLayout();
|
||||
wxFrameLayout* GetLayout();
|
||||
void SetLayout( wxFrameLayout* pLayout );
|
||||
void SetToolUpdates( bool doToolUpdates = TRUE );
|
||||
void CreateLayout();
|
||||
wxFrameLayout* GetLayout();
|
||||
void SetLayout( wxFrameLayout* pLayout );
|
||||
void SetToolUpdates( bool doToolUpdates = TRUE );
|
||||
|
||||
|
||||
// hooks for specific frame-views
|
||||
// hooks for specific frame-views
|
||||
|
||||
virtual void OnInit() {}
|
||||
virtual void OnInit() {}
|
||||
|
||||
virtual void OnSerialize( wxObjectStorage& store ) {}
|
||||
virtual void OnActiveate() {}
|
||||
virtual void OnDeactivate() {}
|
||||
virtual void OnSerialize( wxObjectStorage& store ) {}
|
||||
virtual void OnActiveate() {}
|
||||
virtual void OnDeactivate() {}
|
||||
|
||||
// imp. is mandatory
|
||||
virtual void OnRecreate() {}
|
||||
virtual void OnInitMenus() {}
|
||||
// imp. is mandatory
|
||||
virtual void OnRecreate() {}
|
||||
virtual void OnInitMenus() {}
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
class wxFrame;
|
||||
|
||||
/*
|
||||
It is not clear what this class does. It is not used elsewhere in FL.
|
||||
*/
|
||||
|
||||
class wxFrameManager : wxObject
|
||||
{
|
||||
protected:
|
||||
wxList mViews;
|
||||
wxWindow* mpFrameWnd;
|
||||
int mActiveViewNo;
|
||||
wxWindow* mpClientWnd;
|
||||
wxList mViews;
|
||||
wxWindow* mpFrameWnd;
|
||||
int mActiveViewNo;
|
||||
wxWindow* mpClientWnd;
|
||||
|
||||
#if 0
|
||||
wxObjectStorage mStore;
|
||||
wxObjectStorage mStore;
|
||||
#endif
|
||||
|
||||
wxString mSettingsFile;
|
||||
wxString mSettingsFile;
|
||||
|
||||
protected:
|
||||
void DoSerialize( wxObjectStorage& store );
|
||||
void DestroyViews();
|
||||
int GetViewNo( wxFrameView* pView );
|
||||
void EnableMenusForView( wxFrameView* pView, bool enable );
|
||||
void SyncAllMenus();
|
||||
void DoSerialize( wxObjectStorage& store );
|
||||
void DestroyViews();
|
||||
int GetViewNo( wxFrameView* pView );
|
||||
void EnableMenusForView( wxFrameView* pView, bool enable );
|
||||
void SyncAllMenus();
|
||||
|
||||
public:
|
||||
wxFrameManager();
|
||||
~wxFrameManager();
|
||||
wxFrameManager();
|
||||
~wxFrameManager();
|
||||
|
||||
// if file name is empty, views are are not saved/loaded
|
||||
// if file name is empty, views are are not saved/loaded
|
||||
|
||||
virtual void Init( wxWindow* pMainFrame, const wxString& settingsFile = "" );
|
||||
virtual void Init( wxWindow* pMainFrame, const wxString& settingsFile = "" );
|
||||
|
||||
// synonyms
|
||||
wxFrame* GetParentFrame();
|
||||
wxWindow* GetParentWindow();
|
||||
// synonyms
|
||||
wxFrame* GetParentFrame();
|
||||
wxWindow* GetParentWindow();
|
||||
|
||||
int GetActiveViewNo();
|
||||
wxFrameView* GetActiveView();
|
||||
wxNode* GetActiveViewNode();
|
||||
int GetActiveViewNo();
|
||||
wxFrameView* GetActiveView();
|
||||
wxNode* GetActiveViewNode();
|
||||
|
||||
wxFrameView* GetView( int viewNo );
|
||||
wxFrameView* GetView( int viewNo );
|
||||
|
||||
void SetClinetWindow( wxWindow* pFrameClient );
|
||||
wxWindow* GetClientWindow();
|
||||
void SetClinetWindow( wxWindow* pFrameClient );
|
||||
wxWindow* GetClientWindow();
|
||||
|
||||
void AddView( wxFrameView* pFrmView );
|
||||
void RemoveView( wxFrameView* pFrmView );
|
||||
void AddView( wxFrameView* pFrmView );
|
||||
void RemoveView( wxFrameView* pFrmView );
|
||||
|
||||
void ActivateView( int viewNo );
|
||||
void ActivateView( wxFrameView* pFrmView );
|
||||
void DeactivateCurrentView();
|
||||
void ActivateView( int viewNo );
|
||||
void ActivateView( wxFrameView* pFrmView );
|
||||
void DeactivateCurrentView();
|
||||
|
||||
wxObjectStorage& GetObjectStore();
|
||||
wxObjectStorage& GetObjectStore();
|
||||
|
||||
void SaveViewsNow();
|
||||
bool ReloadViews();
|
||||
void SaveViewsNow();
|
||||
bool ReloadViews();
|
||||
|
||||
bool ViewsAreLoaded();
|
||||
bool ViewsAreLoaded();
|
||||
};
|
||||
|
||||
#endif /* __FRMVIEW_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: garbagec.h
|
||||
// Purpose: GarbageCollector class.
|
||||
// Author: Aleksandras Gluchovas (@Lithuania)
|
||||
// Modified by:
|
||||
// Created: ??/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GARBAGEC_G__
|
||||
@@ -20,54 +20,72 @@
|
||||
|
||||
struct GCItem
|
||||
{
|
||||
void* mpObj;
|
||||
wxList mRefs; // references to other nodes
|
||||
void* mpObj;
|
||||
wxList mRefs; // references to other nodes
|
||||
};
|
||||
|
||||
inline void* gc_node_to_obj( wxNode* pGCNode )
|
||||
{
|
||||
return ( (GCItem*) (pGCNode->Data()) )->mpObj;
|
||||
return ( (GCItem*) (pGCNode->Data()) )->mpObj;
|
||||
}
|
||||
|
||||
// class implements extremely slow, but probably one of the most simple GC algorithms
|
||||
/*
|
||||
This class implements an extremely slow but simple garbage collection algorithm.
|
||||
*/
|
||||
|
||||
class GarbageCollector
|
||||
{
|
||||
protected:
|
||||
wxList mAllNodes;
|
||||
wxList mRegularLst;
|
||||
wxList mCycledLst;
|
||||
wxList mAllNodes;
|
||||
wxList mRegularLst;
|
||||
wxList mCycledLst;
|
||||
|
||||
wxNode* FindItemNode( void* pForObj );
|
||||
void ResolveReferences();
|
||||
// Internal method for finding a node.
|
||||
wxNode* FindItemNode( void* pForObj );
|
||||
|
||||
wxNode* FindReferenceFreeItemNode();
|
||||
void RemoveReferencesToNode( wxNode* pItemNode );
|
||||
void DestroyItemList( wxList& lst );
|
||||
// Internal method for resolving references.
|
||||
void ResolveReferences();
|
||||
|
||||
// Internal method for findind and freeing a node.
|
||||
wxNode* FindReferenceFreeItemNode();
|
||||
|
||||
// Remove references to this node.
|
||||
void RemoveReferencesToNode( wxNode* pItemNode );
|
||||
|
||||
// Destroys a list of items.
|
||||
void DestroyItemList( wxList& lst );
|
||||
|
||||
public:
|
||||
|
||||
GarbageCollector() {}
|
||||
// Default constructor.
|
||||
GarbageCollector() {}
|
||||
|
||||
virtual ~GarbageCollector();
|
||||
// Destructor.
|
||||
virtual ~GarbageCollector();
|
||||
|
||||
// prepare data for GC alg.
|
||||
// Prepare data for garbage collection.
|
||||
|
||||
virtual void AddObject( void* pObj, int refCnt = 1 );
|
||||
virtual void AddDependency( void* pObj, void* pDependsOnObj );
|
||||
virtual void AddObject( void* pObj, int refCnt = 1 );
|
||||
|
||||
// executes GC alg.
|
||||
// Prepare data for garbage collection.
|
||||
|
||||
virtual void ArrangeCollection();
|
||||
virtual void AddDependency( void* pObj, void* pDependsOnObj );
|
||||
|
||||
// access results of the alg.
|
||||
// Executes garbage collection algorithm.
|
||||
|
||||
wxList& GetRegularObjects();
|
||||
wxList& GetCycledObjects();
|
||||
virtual void ArrangeCollection();
|
||||
|
||||
// removes all data from GC
|
||||
// Accesses the results of the algorithm.
|
||||
|
||||
void Reset();
|
||||
wxList& GetRegularObjects();
|
||||
|
||||
// Get cycled objects.
|
||||
|
||||
wxList& GetCycledObjects();
|
||||
|
||||
// Removes all data from the garbage collector.
|
||||
|
||||
void Reset();
|
||||
};
|
||||
|
||||
#endif /* __GARBAGEC_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: gcupdatesmgr.h
|
||||
// Purpose: Header for cbGCUpdatesMgr class.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 19/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __GCUPDATESMGR_G__
|
||||
@@ -22,101 +22,107 @@
|
||||
#include "wx/fl/garbagec.h"
|
||||
|
||||
/*
|
||||
* class implements optimized logic for refreshing
|
||||
* areas of frame layout - which actually need to be updated.
|
||||
* Is used as default updates-manager by wxFrameLayout.
|
||||
*
|
||||
* it is called "Garbage Collecting" u.mgr for it's implementation
|
||||
* tries to find out dependencies between bars, and to order
|
||||
* them ito "hierarchy", this hierarchical sorting resembles
|
||||
* implemenation of heap-garbage collectors, which resolve
|
||||
* dependencies between references.
|
||||
*
|
||||
* Example: there are situations where the order of moving
|
||||
* the windows does matter:
|
||||
*
|
||||
* case 1)
|
||||
* ------ ---
|
||||
* | A | |B|
|
||||
* ------ ---> | |
|
||||
* --- --- ------
|
||||
* |B| | A |
|
||||
* | | ------
|
||||
* ---
|
||||
* (future)
|
||||
* (past)
|
||||
*
|
||||
* past/future positions of A and B windows completely overlapp, i.e.
|
||||
* depend on each other, and there is not solution for
|
||||
* moving the windows witout refreshing both of them,
|
||||
* -- we have cyclic dependency here. The gc. alg will
|
||||
* find this cyclic dependecy and will force "refresh"
|
||||
* after movement.
|
||||
*
|
||||
* case 2)
|
||||
*
|
||||
* ------
|
||||
* | A |
|
||||
* ------ --->
|
||||
* ---
|
||||
* |B| ------
|
||||
* | | | A |
|
||||
* --- ------
|
||||
* ---
|
||||
* |B|
|
||||
* | |
|
||||
* ---
|
||||
*
|
||||
* (future)
|
||||
* (past)
|
||||
*
|
||||
* in this case past/future positions do not overlapp, thus
|
||||
* it's enough only to move windows, without refreshing them.
|
||||
* GC will "notice" it.
|
||||
*
|
||||
* there is also third case, when overlapping is partial
|
||||
* in this case the refershing can be also avoided by
|
||||
* moving windows in the order of "most-dependant" towards the
|
||||
* "least-dependent". GC handles this automatically, by
|
||||
* sorting windows by their dependency-level (or "hierarchy")
|
||||
*
|
||||
* See garbagec.h for more details of this method, garbagec.h/cpp
|
||||
* implement sorting of generic-dependencies (does not deal
|
||||
* with graphical objects directly)
|
||||
*
|
||||
* Summary: improves performance when complex/large windows are
|
||||
* moved around, by reducing number of repaints. Also helps
|
||||
* to avoid dirty non-client areas of moved windows
|
||||
* in some special cases of "overlapping anomalies"
|
||||
*/
|
||||
This class implements optimized logic for refreshing
|
||||
the areas of frame layout that actually need to be updated.
|
||||
It is used as the default updates manager by wxFrameLayout.
|
||||
|
||||
It is called 'Garbage Collecting' updates manager because
|
||||
its implementation tries to find out dependencies between bars,
|
||||
and to order them into a 'hierarchy'. This hierarchical sorting resembles
|
||||
the implementation of heap-garbage collectors, which resolve
|
||||
dependencies between references.
|
||||
|
||||
Example: there are situations where the order in which the user
|
||||
moves windows does matter.
|
||||
|
||||
\begin{verbatim}
|
||||
case 1)
|
||||
------ ---
|
||||
| A | |B|
|
||||
------ ---> | |
|
||||
--- --- ------
|
||||
|B| | A |
|
||||
| | ------
|
||||
---
|
||||
(future)
|
||||
(past)
|
||||
\end{verbatim}
|
||||
|
||||
Past/future positions of A and B windows completely overlap, i.e.
|
||||
depend on each other, and there is no solution for
|
||||
moving the windows without refreshing both of them
|
||||
-- we have a cyclic dependency here. The garbage collection algorithm will
|
||||
find this cyclic dependecy and will force refresh after movement.
|
||||
|
||||
\begin{verbatim}
|
||||
case 2)
|
||||
|
||||
------
|
||||
| A |
|
||||
------ --->
|
||||
---
|
||||
|B| ------
|
||||
| | | A |
|
||||
--- ------
|
||||
---
|
||||
|B|
|
||||
| |
|
||||
---
|
||||
|
||||
(future)
|
||||
(past)
|
||||
\end{verbatim}
|
||||
|
||||
In this case past/future positions do not overlap, so
|
||||
it is enough only to move windows without refreshing them.
|
||||
Garbage collection will 'notice' this.
|
||||
|
||||
There is also a third case, when overlapping is partial.
|
||||
In this case the refreshing can also be avoided by
|
||||
moving windows in the order of 'most-dependant' towards the
|
||||
'least-dependent'. GC handles this automatically, by
|
||||
sorting windows by their dependency-level (or 'hierarchy').
|
||||
|
||||
See garbagec.h for more details of this method; garbagec.h/cpp
|
||||
implement sorting of generic dependencies and does not deal
|
||||
with graphical objects directly.
|
||||
|
||||
Summary: garbage collection improves performance when complex or large
|
||||
windows are moved around, by reducing the number of repaints. It also helps
|
||||
to avoid dirty non-client areas of moved windows
|
||||
in some special cases of 'overlapping anomalies'.
|
||||
*/
|
||||
|
||||
class cbGCUpdatesMgr : public cbSimpleUpdatesMgr
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr )
|
||||
DECLARE_DYNAMIC_CLASS( cbGCUpdatesMgr )
|
||||
protected:
|
||||
|
||||
GarbageCollector mGC;
|
||||
GarbageCollector mGC;
|
||||
|
||||
void DoRepositionItems( wxList& items );
|
||||
// Internal function for repositioning items.
|
||||
void DoRepositionItems( wxList& items );
|
||||
|
||||
void AddItem( wxList& itemList,
|
||||
cbBarInfo* pBar,
|
||||
cbDockPane* pPane,
|
||||
wxRect& curBounds,
|
||||
wxRect& prevBounds );
|
||||
// Internal function for repositioning items.
|
||||
void AddItem( wxList& itemList,
|
||||
cbBarInfo* pBar,
|
||||
cbDockPane* pPane,
|
||||
wxRect& curBounds,
|
||||
wxRect& prevBounds );
|
||||
|
||||
public:
|
||||
|
||||
cbGCUpdatesMgr(void) {}
|
||||
// Default constructor.
|
||||
cbGCUpdatesMgr(void) {}
|
||||
|
||||
cbGCUpdatesMgr( wxFrameLayout* pPanel );
|
||||
// Constructor, taking a frame layout.
|
||||
cbGCUpdatesMgr( wxFrameLayout* pPanel );
|
||||
|
||||
// notificiactions received from Frame Layout :
|
||||
// Receives notifications from the frame layout.
|
||||
virtual void OnStartChanges();
|
||||
|
||||
virtual void OnStartChanges();
|
||||
|
||||
// refreshes parts of the frame layout, which need an update
|
||||
virtual void UpdateNow();
|
||||
// Refreshes the parts of the frame layout which need an update.
|
||||
virtual void UpdateNow();
|
||||
};
|
||||
|
||||
#endif /* __GCUPDATESMGR_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: hintanimpl.h
|
||||
// Purpose: Header for cbHintAnimationPlugin class.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 9/11/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __HINTANIMPL_G__
|
||||
@@ -22,98 +22,120 @@
|
||||
|
||||
class cbHintAnimTimer;
|
||||
|
||||
/*
|
||||
A plugin to draw animated hints when the user drags a pane.
|
||||
*/
|
||||
|
||||
class cbHintAnimationPlugin : public cbPluginBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbHintAnimationPlugin )
|
||||
protected:
|
||||
friend class cbHintAnimTimer;
|
||||
friend class cbHintAnimTimer;
|
||||
|
||||
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
||||
cbHintAnimTimer* mpAnimTimer;
|
||||
wxScreenDC* mpScrDc; // created while tracking hint-rect
|
||||
cbHintAnimTimer* mpAnimTimer;
|
||||
|
||||
// FOR NOW:: try it without mutually exculisve locks
|
||||
volatile wxRect mCurRect;
|
||||
// FOR NOW:: try it without mutually exculisve locks
|
||||
volatile wxRect mCurRect;
|
||||
|
||||
// state variables
|
||||
// state variables
|
||||
|
||||
bool mAnimStarted;
|
||||
bool mStopPending;
|
||||
bool mAnimStarted;
|
||||
bool mStopPending;
|
||||
|
||||
bool mPrevInClient;
|
||||
bool mCurInClient;
|
||||
bool mPrevInClient;
|
||||
bool mCurInClient;
|
||||
|
||||
wxRect mPrevRect;
|
||||
wxRect mPrevRect;
|
||||
|
||||
public:
|
||||
int mMorphDelay; // delay between frames in miliseconds, default: 20
|
||||
int mMaxFrames; // number of iterations for hint morphing, default: 30
|
||||
// (morph duration = mMorphDelay * mMaxFrames msec)
|
||||
int mMorphDelay; // delay between frames in miliseconds, default: 20
|
||||
int mMaxFrames; // number of iterations for hint morphing, default: 30
|
||||
// (morph duration = mMorphDelay * mMaxFrames msec)
|
||||
|
||||
int mInClientHintBorder; // default: 4 pixels
|
||||
int mInClientHintBorder; // default: 4 pixels
|
||||
|
||||
bool mAccelerationOn; // TRUE, if morph accelerates, otherwise morph
|
||||
// speed is constant. Default: TRUE
|
||||
bool mAccelerationOn; // TRUE, if morph accelerates, otherwise morph
|
||||
// speed is constant. Default: TRUE
|
||||
|
||||
// TBD:: get/set methods for above members
|
||||
// TBD:: get/set methods for above members
|
||||
|
||||
protected:
|
||||
void StartTracking();
|
||||
|
||||
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
||||
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
||||
// Internal function for starting tracking.
|
||||
void StartTracking();
|
||||
|
||||
void FinishTracking();
|
||||
// Internal function for drawing a hint rectangle.
|
||||
void DrawHintRect ( wxRect& rect, bool isInClientRect);
|
||||
|
||||
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
||||
// Internal function for erasing a hint rectangle.
|
||||
void EraseHintRect( wxRect& rect, bool isInClientRect);
|
||||
|
||||
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
||||
// Internal function for finishing tracking.
|
||||
void FinishTracking();
|
||||
|
||||
// Internal function for drawing a hint rectangle.
|
||||
void DoDrawHintRect( wxRect& rect, bool isInClientRect);
|
||||
|
||||
// Internal function for translating coordinates.
|
||||
void RectToScr( wxRect& frameRect, wxRect& scrRect );
|
||||
|
||||
public:
|
||||
cbHintAnimationPlugin(void);
|
||||
// Default constructor.
|
||||
cbHintAnimationPlugin();
|
||||
|
||||
~cbHintAnimationPlugin();
|
||||
// Constructor, taking a layout panel and pane mask.
|
||||
cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
|
||||
cbHintAnimationPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
// Destructor.
|
||||
~cbHintAnimationPlugin();
|
||||
|
||||
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
||||
// Event handler respoding to hint draw events.
|
||||
void OnDrawHintRect( cbDrawHintRectEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
|
||||
// helper classes
|
||||
/*
|
||||
A private helper class.
|
||||
*/
|
||||
|
||||
struct MorphInfoT
|
||||
{
|
||||
wxPoint mFrom;
|
||||
wxPoint mTill;
|
||||
wxPoint mFrom;
|
||||
wxPoint mTill;
|
||||
};
|
||||
|
||||
/*
|
||||
A private helper class.
|
||||
*/
|
||||
|
||||
class cbHintAnimTimer : public wxTimer
|
||||
{
|
||||
protected:
|
||||
|
||||
friend class cbHintAnimationPlugin;
|
||||
friend class cbHintAnimationPlugin;
|
||||
|
||||
wxRect mPrevMorphed;
|
||||
wxRect mPrevMorphed;
|
||||
|
||||
MorphInfoT mUpperLeft;
|
||||
MorphInfoT mLowerRight;
|
||||
int mCurIter;
|
||||
MorphInfoT mUpperLeft;
|
||||
MorphInfoT mLowerRight;
|
||||
int mCurIter;
|
||||
|
||||
long mLock;
|
||||
long mLock;
|
||||
|
||||
cbHintAnimationPlugin* mpPl;
|
||||
cbHintAnimationPlugin* mpPl;
|
||||
|
||||
void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point );
|
||||
void MorphPoint( wxPoint& origin, MorphInfoT& info, wxPoint& point );
|
||||
|
||||
public:
|
||||
|
||||
cbHintAnimTimer(void);
|
||||
cbHintAnimTimer(void);
|
||||
|
||||
virtual void Notify(void);
|
||||
virtual void Notify(void);
|
||||
|
||||
virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit );
|
||||
virtual bool Init( cbHintAnimationPlugin* pAnimPl, bool reinit );
|
||||
};
|
||||
|
||||
#endif /* __HINTANIMPL_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: newbmpbtn.h
|
||||
// Purpose: wxNewBitmapButton header.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: ??/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __NEWBMPBTN_G__
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "wx/button.h"
|
||||
#include "wx/string.h"
|
||||
|
||||
// button lable-text alignment types
|
||||
// button label-text alignment types
|
||||
|
||||
#define NB_ALIGN_TEXT_RIGHT 0
|
||||
#define NB_ALIGN_TEXT_BOTTOM 1
|
||||
@@ -31,89 +31,96 @@
|
||||
class wxNewBitmapButton;
|
||||
class wxBorderLessBitmapButton;
|
||||
|
||||
// alternative class for wxBmpButton
|
||||
/*
|
||||
This is an alternative class to wxBitmapButton. It is used
|
||||
in the implementation of dynamic toolbars.
|
||||
*/
|
||||
|
||||
class wxNewBitmapButton: public wxPanel
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxNewBitmapButton)
|
||||
DECLARE_DYNAMIC_CLASS(wxNewBitmapButton)
|
||||
|
||||
protected:
|
||||
|
||||
friend class wxNewBitmapButtonSerializer;
|
||||
friend class wxNewBitmapButtonSerializer;
|
||||
|
||||
int mTextToLabelGap;
|
||||
int mMarginX;
|
||||
int mMarginY;
|
||||
int mTextAlignment;
|
||||
bool mIsSticky;
|
||||
bool mIsFlat;
|
||||
int mTextToLabelGap;
|
||||
int mMarginX;
|
||||
int mMarginY;
|
||||
int mTextAlignment;
|
||||
bool mIsSticky;
|
||||
bool mIsFlat;
|
||||
|
||||
wxString mLabelText;
|
||||
wxString mImageFileName;
|
||||
wxBitmapType mImageFileType;
|
||||
wxString mLabelText;
|
||||
wxString mImageFileName;
|
||||
wxBitmapType mImageFileType;
|
||||
|
||||
wxBitmap mDepressedBmp; // source image for rendering
|
||||
// labels for particular state
|
||||
wxBitmap mDepressedBmp; // source image for rendering
|
||||
// labels for particular state
|
||||
|
||||
wxBitmap mFocusedBmp; // may not be always present -
|
||||
// only if mHasFocusedBmp is TRUE
|
||||
wxBitmap mFocusedBmp; // may not be always present -
|
||||
// only if mHasFocusedBmp is TRUE
|
||||
|
||||
wxBitmap* mpDepressedImg;
|
||||
wxBitmap* mpPressedImg;
|
||||
wxBitmap* mpDisabledImg;
|
||||
wxBitmap* mpFocusedImg;
|
||||
wxBitmap* mpDepressedImg;
|
||||
wxBitmap* mpPressedImg;
|
||||
wxBitmap* mpDisabledImg;
|
||||
wxBitmap* mpFocusedImg;
|
||||
|
||||
// button state variables;
|
||||
bool mDragStarted;
|
||||
bool mIsPressed;
|
||||
bool mIsInFocus;
|
||||
bool mPrevPressedState;
|
||||
bool mPrevInFocusState;
|
||||
// button state variables;
|
||||
bool mDragStarted;
|
||||
bool mIsPressed;
|
||||
bool mIsInFocus;
|
||||
bool mPrevPressedState;
|
||||
bool mPrevInFocusState;
|
||||
|
||||
bool mHasFocusedBmp;
|
||||
bool mHasFocusedBmp;
|
||||
|
||||
// type of event which is fired upon depression of this button
|
||||
int mFiredEventType;
|
||||
// type of event which is fired upon depression of this button
|
||||
int mFiredEventType;
|
||||
|
||||
// pens for drawing decorations (borders)
|
||||
wxPen mBlackPen;
|
||||
wxPen mDarkPen;
|
||||
wxPen mGrayPen;
|
||||
wxPen mLightPen;
|
||||
// pens for drawing decorations (borders)
|
||||
wxPen mBlackPen;
|
||||
wxPen mDarkPen;
|
||||
wxPen mGrayPen;
|
||||
wxPen mLightPen;
|
||||
|
||||
bool mIsCreated;
|
||||
int mSizeIsSet;
|
||||
bool mIsCreated;
|
||||
int mSizeIsSet;
|
||||
|
||||
protected:
|
||||
void DestroyLabels();
|
||||
|
||||
// returns the label which match the current button state
|
||||
virtual wxBitmap* GetStateLabel();
|
||||
// Internal function for destroying labels.
|
||||
void DestroyLabels();
|
||||
|
||||
virtual void DrawShade( int outerLevel,
|
||||
wxDC& dc,
|
||||
wxPen& upperLeftSidePen,
|
||||
wxPen& lowerRightSidePen );
|
||||
// Returns the label that matches the current button state.
|
||||
virtual wxBitmap* GetStateLabel();
|
||||
|
||||
bool IsInWindow( int x,int y );
|
||||
// Draws shading on the button.
|
||||
virtual void DrawShade( int outerLevel,
|
||||
wxDC& dc,
|
||||
wxPen& upperLeftSidePen,
|
||||
wxPen& lowerRightSidePen );
|
||||
|
||||
// Returns TRUE if the given point is in the window.
|
||||
bool IsInWindow( int x, int y );
|
||||
|
||||
public:
|
||||
|
||||
wxNewBitmapButton( const wxBitmap& labelBitmap = wxNullBitmap,
|
||||
const wxString& labelText = "",
|
||||
int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||
bool isFlat = TRUE,
|
||||
// this is the default type of fired events
|
||||
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
|
||||
int marginX = 2,
|
||||
int marginY = 2,
|
||||
int textToLabelGap = 2,
|
||||
bool isSticky = FALSE
|
||||
);
|
||||
// Constructor.
|
||||
wxNewBitmapButton( const wxBitmap& labelBitmap = wxNullBitmap,
|
||||
const wxString& labelText = "",
|
||||
int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||
bool isFlat = TRUE,
|
||||
// this is the default type of fired events
|
||||
int firedEventType = wxEVT_COMMAND_MENU_SELECTED,
|
||||
int marginX = 2,
|
||||
int marginY = 2,
|
||||
int textToLabelGap = 2,
|
||||
bool isSticky = FALSE
|
||||
);
|
||||
|
||||
// use this constructor if buttons have to be persistant
|
||||
|
||||
wxNewBitmapButton( const wxString& bitmapFileName,
|
||||
// Use this constructor if buttons have to be persistant
|
||||
wxNewBitmapButton( const wxString& bitmapFileName,
|
||||
const wxBitmapType bitmapFileType = wxBITMAP_TYPE_BMP,
|
||||
const wxString& labelText = "",
|
||||
int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||
@@ -126,39 +133,61 @@ public:
|
||||
bool isSticky = FALSE
|
||||
);
|
||||
|
||||
~wxNewBitmapButton();
|
||||
// Destructor.
|
||||
~wxNewBitmapButton();
|
||||
|
||||
// should be called after Create();
|
||||
virtual void Reshape();
|
||||
// This function should be called after Create. It renders the labels, having
|
||||
// reloaded the button image if necessary.
|
||||
virtual void Reshape();
|
||||
|
||||
// overridables
|
||||
virtual void SetLabel(const wxBitmap& labelBitmap, const wxString& labelText = "" );
|
||||
|
||||
virtual void SetAlignments( int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||
int marginX = 2,
|
||||
int marginY = 2,
|
||||
int textToLabelGap = 2);
|
||||
// Sets the label and optionally label text.
|
||||
virtual void SetLabel(const wxBitmap& labelBitmap, const wxString& labelText = "" );
|
||||
|
||||
virtual void DrawDecorations( wxDC& dc );
|
||||
virtual void DrawLabel( wxDC& dc );
|
||||
// Sets the text alignment and margins.
|
||||
virtual void SetAlignments( int alignText = NB_ALIGN_TEXT_BOTTOM,
|
||||
int marginX = 2,
|
||||
int marginY = 2,
|
||||
int textToLabelGap = 2);
|
||||
|
||||
virtual void RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
||||
bool isEnabled = TRUE,
|
||||
bool isPressed = FALSE);
|
||||
// Draws the decorations.
|
||||
virtual void DrawDecorations( wxDC& dc );
|
||||
|
||||
virtual void RenderLabelImages();
|
||||
virtual void RenderAllLabelImages();
|
||||
// Draws the label.
|
||||
virtual void DrawLabel( wxDC& dc );
|
||||
|
||||
// event handlers
|
||||
void OnLButtonDown( wxMouseEvent& event );
|
||||
void OnLButtonUp( wxMouseEvent& event );
|
||||
void OnMouseMove( wxMouseEvent& event );
|
||||
void OnSize( wxSizeEvent& event );
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
void OnKillFocus( wxFocusEvent& event );
|
||||
// Renders the label image.
|
||||
virtual void RenderLabelImage( wxBitmap*& destBmp, wxBitmap* srcBmp,
|
||||
bool isEnabled = TRUE,
|
||||
bool isPressed = FALSE);
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// Renders label images.
|
||||
virtual void RenderLabelImages();
|
||||
|
||||
// Renders label images.
|
||||
virtual void RenderAllLabelImages();
|
||||
|
||||
// Responds to a left mouse button down event.
|
||||
void OnLButtonDown( wxMouseEvent& event );
|
||||
|
||||
// Responds to a left mouse button up event.
|
||||
void OnLButtonUp( wxMouseEvent& event );
|
||||
|
||||
// Responds to a mouse move event.
|
||||
void OnMouseMove( wxMouseEvent& event );
|
||||
|
||||
// Responds to a size event.
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
// Responds to a paint event.
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
|
||||
// Responds to an erase background event.
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
|
||||
// Responds to a kill focus event.
|
||||
void OnKillFocus( wxFocusEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __NEWBMPBTN_G__ */
|
||||
|
@@ -1,13 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Central header file for control-bar related classes
|
||||
//
|
||||
// Name: panedrawpl.h
|
||||
// Purpose: cbPaneDrawPlugin class header.
|
||||
// Author: Aleksandras Gluchovas <mailto:alex@soften.ktu.lt>
|
||||
// Modified by:
|
||||
// Created: 06/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __PANEDRAWPL_G__
|
||||
@@ -20,99 +19,142 @@
|
||||
#include "wx/fl/controlbar.h"
|
||||
|
||||
/*
|
||||
* Simple, but all-in-one plugin implementation. Resembles look & feel of
|
||||
* to MFC control-bars. Handles painting of pane and items in it.
|
||||
* Fires bar/layout customization event, when user right-clicks bar/pane.
|
||||
* Hooking an instance of this and row-layouting plugins per each pane,
|
||||
* would be enough for the frame layout to function properly.
|
||||
* (they are plugged in autimatically by wxFrameLayout class)
|
||||
*/
|
||||
Simple but all-in-one plugin implementation. Resembles the look and feel of
|
||||
MFC control-bars. The class handles painting of the pane and the items in it;
|
||||
it generates bar/layout customization events, when the user right-clicks the bar/pane.
|
||||
Hooking an instance of this and row-layout plugins for each pane
|
||||
would be enough for the frame layout to function properly
|
||||
(they are plugged in automatically by the wxFrameLayout class).
|
||||
*/
|
||||
|
||||
class cbPaneDrawPlugin : public cbPluginBase
|
||||
{
|
||||
public:
|
||||
DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbPaneDrawPlugin )
|
||||
protected:
|
||||
|
||||
// resizing bars/rows state variables
|
||||
bool mResizeStarted;
|
||||
bool mResizeCursorOn;
|
||||
wxPoint mDragOrigin;
|
||||
// resizing bars/rows state variables
|
||||
bool mResizeStarted;
|
||||
bool mResizeCursorOn;
|
||||
wxPoint mDragOrigin;
|
||||
|
||||
cbBarInfo* mpDraggedBar; // also used when in bar-drag action
|
||||
cbRowInfo* mpResizedRow;
|
||||
cbBarInfo* mpDraggedBar; // also used when in bar-drag action
|
||||
cbRowInfo* mpResizedRow;
|
||||
|
||||
bool mRowHandleHitted;
|
||||
bool mIsUpperHandle;
|
||||
bool mBarHandleHitted;
|
||||
bool mIsLeftHandle;
|
||||
bool mBarContentHitted;
|
||||
bool mRowHandleHitted;
|
||||
bool mIsUpperHandle;
|
||||
bool mBarHandleHitted;
|
||||
bool mIsLeftHandle;
|
||||
bool mBarContentHitted;
|
||||
|
||||
// contstraints for dragging the handle
|
||||
wxRect mHandleDragArea;
|
||||
bool mHandleIsVertical;
|
||||
int mHandleOfs;
|
||||
int mDraggedDelta;
|
||||
wxPoint mPrevPos;
|
||||
// contstraints for dragging the handle
|
||||
wxRect mHandleDragArea;
|
||||
bool mHandleIsVertical;
|
||||
int mHandleOfs;
|
||||
int mDraggedDelta;
|
||||
wxPoint mPrevPos;
|
||||
|
||||
// used for handling, start-draw-in-area events
|
||||
wxClientDC* mpClntDc;
|
||||
// used for handling, start-draw-in-area events
|
||||
wxClientDC* mpClntDc;
|
||||
|
||||
cbDockPane* mpPane; // is set up temorary short-cut, while handling event
|
||||
cbDockPane* mpPane; // is set up temorary short-cut, while handling event
|
||||
|
||||
protected:
|
||||
// helpers
|
||||
void DrawDraggedHandle( const wxPoint& pos, cbDockPane& pane );
|
||||
// Internal helper: draws the dragged handle.
|
||||
void DrawDraggedHandle( const wxPoint& pos, cbDockPane& pane );
|
||||
|
||||
virtual void DrawPaneShade( wxDC& dc, int alignment );
|
||||
virtual void DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc );
|
||||
// Internal helper: draws the pane shading.
|
||||
virtual void DrawPaneShade( wxDC& dc, int alignment );
|
||||
|
||||
virtual void DrawUpperRowHandle( cbRowInfo* pRow, wxDC& dc );
|
||||
virtual void DrawLowerRowHandle( cbRowInfo* pRow, wxDC& dc );
|
||||
// Internal helper: draws the pane shading for a row.
|
||||
virtual void DrawPaneShadeForRow( cbRowInfo* pRow, wxDC& dc );
|
||||
|
||||
virtual void DrawUpperRowShades( cbRowInfo* pRow, wxDC& dc, int level );
|
||||
virtual void DrawLowerRowShades( cbRowInfo* pRow, wxDC& dc, int level );
|
||||
// Internal helper: draws the upper row handle.
|
||||
virtual void DrawUpperRowHandle( cbRowInfo* pRow, wxDC& dc );
|
||||
|
||||
virtual void DrawBarInnerShadeRect( cbBarInfo* pBar, wxDC& dc );
|
||||
// Internal helper: draws the lower row handle.
|
||||
virtual void DrawLowerRowHandle( cbRowInfo* pRow, wxDC& dc );
|
||||
|
||||
virtual void DrawShade( int level, wxRect& rect, int alignment, wxDC& dc );
|
||||
virtual void DrawShade1( int level, wxRect& rect, int alignment, wxDC& dc );
|
||||
// Internal helper: draws the upper row shading.
|
||||
virtual void DrawUpperRowShades( cbRowInfo* pRow, wxDC& dc, int level );
|
||||
|
||||
inline void SetLightPixel( int x, int y, wxDC& dc );
|
||||
inline void SetDarkPixel ( int x, int y, wxDC& dc );
|
||||
// Internal helper: draws the lower row shading.
|
||||
virtual void DrawLowerRowShades( cbRowInfo* pRow, wxDC& dc, int level );
|
||||
|
||||
// Internal helper: draws the inner bar shading.
|
||||
virtual void DrawBarInnerShadeRect( cbBarInfo* pBar, wxDC& dc );
|
||||
|
||||
// Internal helper: draws shading.
|
||||
virtual void DrawShade( int level, wxRect& rect, int alignment, wxDC& dc );
|
||||
|
||||
// Internal helper: draws shading.
|
||||
virtual void DrawShade1( int level, wxRect& rect, int alignment, wxDC& dc );
|
||||
|
||||
// Internal helper: sets a light pixel at the given location.
|
||||
inline void SetLightPixel( int x, int y, wxDC& dc );
|
||||
|
||||
// Internal helper: sets a dark pixel at the given location.
|
||||
inline void SetDarkPixel ( int x, int y, wxDC& dc );
|
||||
|
||||
public:
|
||||
cbPaneDrawPlugin(void);
|
||||
// Default constructor.
|
||||
cbPaneDrawPlugin();
|
||||
|
||||
cbPaneDrawPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
// Constructor taking frame layout pane and a pane mask.
|
||||
cbPaneDrawPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
|
||||
virtual ~cbPaneDrawPlugin();
|
||||
// Destructor.
|
||||
virtual ~cbPaneDrawPlugin();
|
||||
|
||||
virtual cbPluginBase* Clone() { return new cbPaneDrawPlugin(0,0); }
|
||||
// Clone function, returning a new instance of this class.
|
||||
virtual cbPluginBase* Clone() { return new cbPaneDrawPlugin(0,0); }
|
||||
|
||||
// handlers for plugin-events
|
||||
// Handler for left mouse button down events.
|
||||
void OnLButtonDown( cbLeftDownEvent& event );
|
||||
|
||||
void OnLButtonDown( cbLeftDownEvent& event );
|
||||
void OnLDblClick ( cbLeftDClickEvent& event );
|
||||
void OnLButtonUp ( cbLeftUpEvent& event );
|
||||
void OnRButtonUp ( cbRightUpEvent& event );
|
||||
void OnMouseMove ( cbMotionEvent& event );
|
||||
// Handler for left double-click mouse button down events.
|
||||
void OnLDblClick ( cbLeftDClickEvent& event );
|
||||
|
||||
void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent& event );
|
||||
void OnDrawPaneDecorations( cbDrawPaneDecorEvent& event );
|
||||
// Handler for left mouse button up events.
|
||||
void OnLButtonUp ( cbLeftUpEvent& event );
|
||||
|
||||
void OnDrawRowDecorations ( cbDrawRowDecorEvent& event );
|
||||
void OnDrawRowHandles ( cbDrawRowHandlesEvent& event );
|
||||
void OnDrawRowBackground ( cbDrawRowBkGroundEvent& event );
|
||||
|
||||
void OnSizeBarWindow ( cbSizeBarWndEvent& event );
|
||||
void OnDrawBarDecorations ( cbDrawBarDecorEvent& event );
|
||||
void OnDrawBarHandles ( cbDrawBarHandlesEvent& event );
|
||||
// Handler for right mouse button up events.
|
||||
void OnRButtonUp ( cbRightUpEvent& event );
|
||||
|
||||
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
||||
void OnFinishDrawInArea ( cbFinishDrawInAreaEvent& event );
|
||||
// Handler for mouse move events.
|
||||
void OnMouseMove ( cbMotionEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// Handler for draw pane background events.
|
||||
void OnDrawPaneBackground ( cbDrawPaneBkGroundEvent& event );
|
||||
|
||||
// Handler for draw pane decoration events.
|
||||
void OnDrawPaneDecorations( cbDrawPaneDecorEvent& event );
|
||||
|
||||
// Handler for draw row decoration events.
|
||||
void OnDrawRowDecorations ( cbDrawRowDecorEvent& event );
|
||||
|
||||
// Handler for draw row handles events.
|
||||
void OnDrawRowHandles ( cbDrawRowHandlesEvent& event );
|
||||
|
||||
// Handler for draw row background events.
|
||||
void OnDrawRowBackground ( cbDrawRowBkGroundEvent& event );
|
||||
|
||||
// Handler for bar size events.
|
||||
void OnSizeBarWindow ( cbSizeBarWndEvent& event );
|
||||
|
||||
// Handler for draw bar decorations events.
|
||||
void OnDrawBarDecorations ( cbDrawBarDecorEvent& event );
|
||||
|
||||
// Handler for draw bar handles events.
|
||||
void OnDrawBarHandles ( cbDrawBarHandlesEvent& event );
|
||||
|
||||
// Handler for start draw in area events.
|
||||
void OnStartDrawInArea ( cbStartDrawInAreaEvent& event );
|
||||
|
||||
// Handler for finish draw in area events.
|
||||
void OnFinishDrawInArea ( cbFinishDrawInAreaEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __PANEDRAWPL_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: rowdragpl.h
|
||||
// Purpose: cbRowDragPlugin class header.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 06/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __ROWDRAGPL_G__
|
||||
@@ -19,145 +19,212 @@
|
||||
#include "wx/fl/controlbar.h"
|
||||
|
||||
/*
|
||||
* Plugin adds row-dragging fuctionality to the pane.
|
||||
* Handles mouse/movement and pane-background erasing plugin-events.
|
||||
* Behaviour and appearence resembles drag & drop posotioning
|
||||
* of the toolbar-rows int Netscape Comunicator 4.xx.
|
||||
*/
|
||||
This plugin adds row-dragging functionality to the pane.
|
||||
It handles mouse movement and pane background-erasing plugin events.
|
||||
The behaviour and appearance resembles drag and drop positioning
|
||||
of the toolbar rows in Netscape Communicator 4.xx.
|
||||
*/
|
||||
|
||||
class cbRowDragPlugin : public cbPluginBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbRowDragPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbRowDragPlugin )
|
||||
public:
|
||||
// background colours for the highlighted/unhighlighted icons
|
||||
// background colours for the highlighted/unhighlighted icons
|
||||
|
||||
wxColour mHightColor; // light-blue for NC-look
|
||||
wxColour mLowColor; // light-gray -/-
|
||||
wxColour mTrianInnerColor; // blue -/-
|
||||
wxPen mTrianInnerPen; // black -/-
|
||||
wxColour mHightColor; // light-blue for NC-look
|
||||
wxColour mLowColor; // light-gray -/-
|
||||
wxColour mTrianInnerColor; // blue -/-
|
||||
wxPen mTrianInnerPen; // black -/-
|
||||
|
||||
protected:
|
||||
friend class cbRowDragPluginSerializer;
|
||||
friend class cbRowDragPluginSerializer;
|
||||
|
||||
// drag & drop state variables
|
||||
bool mDragStarted;
|
||||
bool mDecisionMode;
|
||||
wxPoint mDragOrigin;
|
||||
int mCurDragOfs;
|
||||
bool mCaptureIsOn;
|
||||
// drag & drop state variables
|
||||
bool mDragStarted;
|
||||
bool mDecisionMode;
|
||||
wxPoint mDragOrigin;
|
||||
int mCurDragOfs;
|
||||
bool mCaptureIsOn;
|
||||
|
||||
// saved margins of the pane
|
||||
int mSvTopMargin;
|
||||
int mSvBottomMargin;
|
||||
int mSvLeftMargin;
|
||||
int mSvRightMargin;
|
||||
// saved margins of the pane
|
||||
int mSvTopMargin;
|
||||
int mSvBottomMargin;
|
||||
int mSvLeftMargin;
|
||||
int mSvRightMargin;
|
||||
|
||||
//on-screen drawing state variables
|
||||
wxBitmap* mpPaneImage;
|
||||
wxBitmap* mpRowImage;
|
||||
wxBitmap* mpCombinedImage;
|
||||
// on-screen drawing state variables
|
||||
wxBitmap* mpPaneImage;
|
||||
wxBitmap* mpRowImage;
|
||||
wxBitmap* mpCombinedImage;
|
||||
|
||||
wxScreenDC* mpScrDc;
|
||||
wxRect mCombRect;
|
||||
wxSize mRowImgDim;
|
||||
int mInitialRowOfs;
|
||||
wxScreenDC* mpScrDc;
|
||||
wxRect mCombRect;
|
||||
wxSize mRowImgDim;
|
||||
int mInitialRowOfs;
|
||||
|
||||
// NOTE:: if mpRowInFocus is not NULL, then mCollapsedIconInFocus is -1,
|
||||
// and v.v. (two different items cannot be in focus at the same time)
|
||||
// NOTE:: if mpRowInFocus is not NULL, then mCollapsedIconInFocus is -1,
|
||||
// and v.v. (two different items cannot be in focus at the same time)
|
||||
|
||||
cbRowInfo* mpRowInFocus;
|
||||
int mCollapsedIconInFocus;
|
||||
cbRowInfo* mpRowInFocus;
|
||||
int mCollapsedIconInFocus;
|
||||
|
||||
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||
|
||||
wxList mHiddenBars;
|
||||
wxList mHiddenBars;
|
||||
|
||||
wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area );
|
||||
// Helper for drag and drop.
|
||||
wxBitmap* CaptureDCArea( wxDC& dc, wxRect& area );
|
||||
|
||||
// helpers for drag&drop
|
||||
// Helper for drag and drop.
|
||||
int GetHRowsCountForPane( cbDockPane* pPane );
|
||||
|
||||
int GetHRowsCountForPane( cbDockPane* pPane );
|
||||
// Helper for drag and drop.
|
||||
void SetMouseCapture( bool captureOn );
|
||||
|
||||
void SetMouseCapture( bool captureOn );
|
||||
void PrepareForRowDrag();
|
||||
void ShowDraggedRow( int offset );
|
||||
void ShowPaneImage();
|
||||
void FinishOnScreenDraw();
|
||||
void CollapseRow( cbRowInfo* pRow );
|
||||
void ExpandRow( int collapsedIconIdx );
|
||||
void InsertDraggedRowBefore( cbRowInfo* pBeforeRow );
|
||||
bool ItemIsInFocus();
|
||||
void CheckPrevItemInFocus( cbRowInfo* pRow, int iconIdx );
|
||||
void UnhiglightItemInFocus();
|
||||
// Helper for drag and drop.
|
||||
void PrepareForRowDrag();
|
||||
|
||||
cbRowInfo* GetFirstRow();
|
||||
// Helper for drag and drop.
|
||||
void ShowDraggedRow( int offset );
|
||||
|
||||
// "hard-coded metafile" for NN-look
|
||||
// Helper for drag and drop.
|
||||
void ShowPaneImage();
|
||||
|
||||
virtual void DrawTrianUp( wxRect& inRect, wxDC& dc );
|
||||
virtual void DrawTrianDown( wxRect& inRect, wxDC& dc );
|
||||
virtual void DrawTrianRight( wxRect& inRect, wxDC& dc );
|
||||
virtual void Draw3DPattern( wxRect& inRect, wxDC& dc );
|
||||
virtual void DrawRombShades( wxPoint& p1, wxPoint& p2, wxPoint& p3, wxPoint& p4, wxDC& dc );
|
||||
virtual void DrawOrtoRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||
virtual void DrawRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||
virtual void Draw3DRect( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||
virtual void DrawRectShade( wxRect& inRect, wxDC& dc,
|
||||
int level, wxPen& upperPen, wxPen& lowerPen );
|
||||
// Helper for drag and drop.
|
||||
void FinishOnScreenDraw();
|
||||
|
||||
virtual void GetRowHintRect( cbRowInfo* pRow, wxRect& rect );
|
||||
virtual void GetCollapsedInconRect( int iconIdx, wxRect& rect );
|
||||
// Helper for drag and drop.
|
||||
void CollapseRow( cbRowInfo* pRow );
|
||||
|
||||
virtual int GetCollapsedIconsPos();
|
||||
// Helper for drag and drop.
|
||||
void ExpandRow( int collapsedIconIdx );
|
||||
|
||||
// Helper for drag and drop.
|
||||
void InsertDraggedRowBefore( cbRowInfo* pBeforeRow );
|
||||
|
||||
// Helper for drag and drop.
|
||||
bool ItemIsInFocus();
|
||||
|
||||
// Helper for drag and drop.
|
||||
void CheckPrevItemInFocus( cbRowInfo* pRow, int iconIdx );
|
||||
|
||||
// Helper for drag and drop.
|
||||
void UnhighlightItemInFocus();
|
||||
|
||||
// Helper for drag and drop.
|
||||
cbRowInfo* GetFirstRow();
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawTrianUp( wxRect& inRect, wxDC& dc );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawTrianDown( wxRect& inRect, wxDC& dc );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawTrianRight( wxRect& inRect, wxDC& dc );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void Draw3DPattern( wxRect& inRect, wxDC& dc );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawRombShades( wxPoint& p1, wxPoint& p2, wxPoint& p3, wxPoint& p4, wxDC& dc );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawOrtoRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawRomb( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void Draw3DRect( wxRect& inRect, wxDC& dc, wxBrush& bkBrush );
|
||||
|
||||
// Implements 'hard-coded metafile' for Netscape Navigator look.
|
||||
virtual void DrawRectShade( wxRect& inRect, wxDC& dc,
|
||||
int level, wxPen& upperPen, wxPen& lowerPen );
|
||||
|
||||
// Helper for drag and drop.
|
||||
virtual void GetRowHintRect( cbRowInfo* pRow, wxRect& rect );
|
||||
|
||||
// Helper for drag and drop.
|
||||
virtual void GetCollapsedInconRect( int iconIdx, wxRect& rect );
|
||||
|
||||
// Helper for drag and drop.
|
||||
virtual int GetCollapsedIconsPos();
|
||||
|
||||
public:
|
||||
|
||||
cbRowDragPlugin(void);
|
||||
// Default constructor.
|
||||
cbRowDragPlugin();
|
||||
|
||||
cbRowDragPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
||||
virtual ~cbRowDragPlugin();
|
||||
// Constructor, taking paren layout frame and pane mask.
|
||||
cbRowDragPlugin( wxFrameLayout* pLayout, int paneMask = wxALL_PANES );
|
||||
|
||||
virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); }
|
||||
// Destructor.
|
||||
virtual ~cbRowDragPlugin();
|
||||
|
||||
virtual void OnInitPlugin();
|
||||
// Clone function, returning a new instance of this class.
|
||||
virtual cbPluginBase* Clone() { return new cbRowDragPlugin(NULL,0); }
|
||||
|
||||
// handlers for plugin events (appearence-independent logic)
|
||||
// Called to initialize this plugin.
|
||||
virtual void OnInitPlugin();
|
||||
|
||||
void OnMouseMove ( cbMotionEvent& event );
|
||||
void OnLButtonDown( cbLeftDownEvent& event );
|
||||
void OnLButtonUp ( cbLeftUpEvent& event );
|
||||
void OnDrawPaneBackground( cbDrawPaneDecorEvent& event );
|
||||
// Handles mouse move plugin events (appearance-independent logic).
|
||||
void OnMouseMove ( cbMotionEvent& event );
|
||||
|
||||
// overridables (appearence-depedent)
|
||||
// Handles left button down plugin events (appearance-independent logic).
|
||||
void OnLButtonDown( cbLeftDownEvent& event );
|
||||
|
||||
virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted );
|
||||
virtual void DrawCollapsedRowsBorder( wxDC& dc );
|
||||
virtual void DrawRowsDragHintsBorder( wxDC& dc );
|
||||
virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted );
|
||||
virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds );
|
||||
// Handles left button up plugin events (appearance-independent logic).
|
||||
void OnLButtonUp ( cbLeftUpEvent& event );
|
||||
|
||||
virtual int GetCollapsedRowIconHeight();
|
||||
virtual int GetRowDragHintWidth();
|
||||
// Handles pane drawing plugin events (appearance-independent logic).
|
||||
void OnDrawPaneBackground( cbDrawPaneDecorEvent& event );
|
||||
|
||||
virtual void SetPaneMargins();
|
||||
// Draws collapsed row icon (appearance-dependent).
|
||||
virtual void DrawCollapsedRowIcon( int index, wxDC& dc, bool isHighlighted );
|
||||
|
||||
// Draws collapsed rows border (appearance-dependent).
|
||||
virtual void DrawCollapsedRowsBorder( wxDC& dc );
|
||||
|
||||
virtual bool HitTestCollapsedRowIcon( int iconIdx, const wxPoint& pos );
|
||||
virtual bool HitTestRowDragHint( cbRowInfo* pRow, const wxPoint& pos );
|
||||
// Draws rows drag hints border (appearance-dependent).
|
||||
virtual void DrawRowsDragHintsBorder( wxDC& dc );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// Draws row drag hint (appearance-dependent).
|
||||
virtual void DrawRowDragHint( cbRowInfo* pRow, wxDC& dc, bool isHighlighted );
|
||||
|
||||
// Draws empty row (appearance-dependent).
|
||||
virtual void DrawEmptyRow( wxDC& dc, wxRect& rowBounds );
|
||||
|
||||
// Gets the collapsed row icon height.
|
||||
virtual int GetCollapsedRowIconHeight();
|
||||
|
||||
// Gets the row drag hint width.
|
||||
virtual int GetRowDragHintWidth();
|
||||
|
||||
// Sets the pane margins.
|
||||
virtual void SetPaneMargins();
|
||||
|
||||
// Test for the collapsed row icon position.
|
||||
virtual bool HitTestCollapsedRowIcon( int iconIdx, const wxPoint& pos );
|
||||
|
||||
// Test for the row drag hint position.
|
||||
virtual bool HitTestRowDragHint( cbRowInfo* pRow, const wxPoint& pos );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// internal helper-class
|
||||
/*
|
||||
Internal helper class.
|
||||
*/
|
||||
|
||||
class cbHiddenBarInfo : public wxObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo )
|
||||
DECLARE_DYNAMIC_CLASS( cbHiddenBarInfo )
|
||||
public:
|
||||
cbBarInfo* mpBar;
|
||||
int mRowNo;
|
||||
int mIconNo;
|
||||
int mAlignment;
|
||||
cbBarInfo* mpBar;
|
||||
int mRowNo;
|
||||
int mIconNo;
|
||||
int mAlignment;
|
||||
};
|
||||
|
||||
#endif /* __ROWDRAGPL_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: rowlayoutpl.h
|
||||
// Purpose: cbRowLayoutPlugin header.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 02/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __ROWLAYOUTPL_G__
|
||||
@@ -19,68 +19,107 @@
|
||||
#include "wx/fl/controlbar.h"
|
||||
|
||||
/*
|
||||
* Simple implementation of plugin, which handles row-layouting
|
||||
* requests sent from Frame Layout
|
||||
*/
|
||||
Simple implementation of a plugin which handles row layout
|
||||
requests sent from a frame layout.
|
||||
*/
|
||||
|
||||
class cbRowLayoutPlugin : public cbPluginBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbRowLayoutPlugin )
|
||||
DECLARE_DYNAMIC_CLASS( cbRowLayoutPlugin )
|
||||
protected:
|
||||
cbDockPane* mpPane; // is set up temorarely, while handling event
|
||||
cbDockPane* mpPane; // is set up temporarily, while handling event
|
||||
protected:
|
||||
|
||||
// not-fixed-bars layouting related helpers
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void FitBarsToRange( int from, int till, cbBarInfo* pTheBar, cbRowInfo* pRow );
|
||||
|
||||
void FitBarsToRange( int from, int till, cbBarInfo* pTheBar, cbRowInfo* pRow );
|
||||
void RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInfo* pRow );
|
||||
void MinimzeNotFixedBars( cbRowInfo* pRow, cbBarInfo* pBarToPreserve );
|
||||
int GetRowFreeSpace( cbRowInfo* pRow );
|
||||
|
||||
void RecalcLengthRatios( cbRowInfo* pRow );
|
||||
void ApplyLengthRatios( cbRowInfo* pRow );
|
||||
void ExpandNotFixedBars( cbRowInfo* pRow );
|
||||
void AdjustLengthOfInserted( cbRowInfo* pRow, cbBarInfo* pTheBar );
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void RelayoutNotFixedBarsAround( cbBarInfo* pTheBar, cbRowInfo* pRow );
|
||||
|
||||
void DetectBarHandles( cbRowInfo* pRow );
|
||||
void CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& rowInfo );
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void MinimzeNotFixedBars( cbRowInfo* pRow, cbBarInfo* pBarToPreserve );
|
||||
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
int GetRowFreeSpace( cbRowInfo* pRow );
|
||||
|
||||
|
||||
// row-layouting helpers (simulate "bar-friction")
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void RecalcLengthRatios( cbRowInfo* pRow );
|
||||
|
||||
int CalcRowHeight( cbRowInfo& row );
|
||||
void LayoutItemsVertically( cbRowInfo& row );
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void ApplyLengthRatios( cbRowInfo* pRow );
|
||||
|
||||
void StickRightSideBars( cbBarInfo* pToBar );
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void ExpandNotFixedBars( cbRowInfo* pRow );
|
||||
|
||||
void SlideLeftSideBars ( cbBarInfo* pTheBar );
|
||||
void SlideRightSideBars( cbBarInfo* pTheBar );
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void AdjustLengthOfInserted( cbRowInfo* pRow, cbBarInfo* pTheBar );
|
||||
|
||||
void ShiftLeftTrashold ( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||
void ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||
|
||||
void InsertBefore( cbBarInfo* pBeforeBar,
|
||||
cbBarInfo* pTheBar,
|
||||
cbRowInfo& row
|
||||
);
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void DetectBarHandles( cbRowInfo* pRow );
|
||||
|
||||
void DoInsertBar( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||
// Internal helper relating to not-fixed-bars layout.
|
||||
void CheckIfAtTheBoundary( cbBarInfo* pTheBar, cbRowInfo& rowInfo );
|
||||
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
int CalcRowHeight( cbRowInfo& row );
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
void LayoutItemsVertically( cbRowInfo& row );
|
||||
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
void StickRightSideBars( cbBarInfo* pToBar );
|
||||
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
void SlideLeftSideBars ( cbBarInfo* pTheBar );
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
void SlideRightSideBars( cbBarInfo* pTheBar );
|
||||
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
void ShiftLeftTrashold ( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||
|
||||
// Row layout helper simulating bar 'friction'.
|
||||
void ShiftRightTrashold( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||
|
||||
|
||||
// Insert the bar before the given row.
|
||||
void InsertBefore( cbBarInfo* pBeforeBar,
|
||||
cbBarInfo* pTheBar,
|
||||
cbRowInfo& row
|
||||
);
|
||||
|
||||
// Insert the bar before the given row.
|
||||
void DoInsertBar( cbBarInfo* pTheBar, cbRowInfo& row );
|
||||
|
||||
public:
|
||||
// Default constructor.
|
||||
cbRowLayoutPlugin(void);
|
||||
|
||||
cbRowLayoutPlugin(void);
|
||||
// Constructor taking frame layout pane and pane mask.
|
||||
cbRowLayoutPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
|
||||
cbRowLayoutPlugin( wxFrameLayout* pPanel, int paneMask = wxALL_PANES );
|
||||
// Responds to row resize event.
|
||||
void OnResizeRow ( cbResizeRowEvent& event );
|
||||
|
||||
// event handlers
|
||||
// Responds to bar insertion event.
|
||||
void OnInsertBar ( cbInsertBarEvent& event );
|
||||
|
||||
void OnResizeRow ( cbResizeRowEvent& event );
|
||||
void OnInsertBar ( cbInsertBarEvent& event );
|
||||
void OnRemoveBar ( cbRemoveBarEvent& event );
|
||||
void OnLayoutRow ( cbLayoutRowEvent& event );
|
||||
void OnLayoutRows( cbLayoutRowsEvent& event );
|
||||
// Responds to bar removal event.
|
||||
void OnRemoveBar ( cbRemoveBarEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// Responds to row layout event.
|
||||
void OnLayoutRow ( cbLayoutRowEvent& event );
|
||||
|
||||
// Responds to rows layout event.
|
||||
void OnLayoutRows( cbLayoutRowsEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __ROWLAYOUTPL_G__ */
|
||||
|
@@ -1,12 +1,13 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: toolwnd.h
|
||||
// Purpose: wxToolWindow, cbMiniButton, cbCloseBox, cbCollapseBox,
|
||||
// cbDockBox, cbFloatedBarWindow class declarations.
|
||||
// Author: Aleksandras Gluchovas
|
||||
// Modified by:
|
||||
// Created: 06/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __TOOLWND_G__
|
||||
@@ -31,184 +32,272 @@ typedef cbMiniButton* cbMinitButtonPtrT;
|
||||
|
||||
WX_DEFINE_ARRAY( cbMinitButtonPtrT, cbMiniButtonArrayT );
|
||||
|
||||
/*
|
||||
A tool window is a special kind of frame that paints its own title, and
|
||||
can be used to implement small floating windows.
|
||||
*/
|
||||
|
||||
class wxToolWindow : public wxFrame
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( wxToolWindow )
|
||||
DECLARE_DYNAMIC_CLASS( wxToolWindow )
|
||||
|
||||
public: /** protected really, accessed only by serializers **/
|
||||
public: /** protected really, accessed only by serializers **/
|
||||
|
||||
cbMiniButtonArrayT mButtons;
|
||||
wxWindow* mpClientWnd;
|
||||
cbMiniButtonArrayT mButtons;
|
||||
wxWindow* mpClientWnd;
|
||||
|
||||
wxFont mTitleFont;
|
||||
wxFont mTitleFont;
|
||||
|
||||
int mTitleHeight;
|
||||
int mClntHorizGap;
|
||||
int mClntVertGap;
|
||||
int mWndVertGap;
|
||||
int mWndHorizGap;
|
||||
int mButtonGap;
|
||||
int mInTitleMargin;
|
||||
int mHintBorder;
|
||||
int mTitleHeight;
|
||||
int mClntHorizGap;
|
||||
int mClntVertGap;
|
||||
int mWndVertGap;
|
||||
int mWndHorizGap;
|
||||
int mButtonGap;
|
||||
int mInTitleMargin;
|
||||
int mHintBorder;
|
||||
|
||||
bool mResizeStarted;
|
||||
bool mRealTimeUpdatesOn;
|
||||
bool mResizeStarted;
|
||||
bool mRealTimeUpdatesOn;
|
||||
|
||||
int mMTolerance;
|
||||
int mMTolerance;
|
||||
|
||||
int mCursorType;
|
||||
bool mMouseCaptured;
|
||||
int mCursorType;
|
||||
bool mMouseCaptured;
|
||||
|
||||
// drag&drop state variables
|
||||
// drag&drop state variables
|
||||
|
||||
wxPoint mDragOrigin;
|
||||
wxRect mInitialRect;
|
||||
wxRect mPrevHintRect;
|
||||
wxScreenDC* mpScrDc;
|
||||
wxPoint mDragOrigin;
|
||||
wxRect mInitialRect;
|
||||
wxRect mPrevHintRect;
|
||||
wxScreenDC* mpScrDc;
|
||||
|
||||
protected:
|
||||
void GetScrWindowRect( wxRect& r );
|
||||
void GetScrMousePos ( wxMouseEvent& event, wxPoint& pos );
|
||||
void SetHintCursor ( int type );
|
||||
// Maps client coordinates to screen coordinates.
|
||||
void GetScrWindowRect( wxRect& r );
|
||||
|
||||
void CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim );
|
||||
void AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect );
|
||||
wxSize GetMinimalWndDim();
|
||||
// Gets the mouse position in screen coordinates.
|
||||
void GetScrMousePos ( wxMouseEvent& event, wxPoint& pos );
|
||||
|
||||
void DrawHintRect( const wxRect& r );
|
||||
// Sets the hint cursor.
|
||||
void SetHintCursor ( int type );
|
||||
|
||||
int HitTestWindow( wxMouseEvent& event );
|
||||
// Calculate resized rectangle.
|
||||
void CalcResizedRect( wxRect& rect, wxPoint& delta, const wxSize& minDim );
|
||||
|
||||
void LayoutMiniButtons();
|
||||
// Helper function.
|
||||
void AdjustRectPos( const wxRect& original, const wxSize& newDim, wxRect& newRect );
|
||||
|
||||
// Helper function.
|
||||
wxSize GetMinimalWndDim();
|
||||
|
||||
// Draws the hint rectangle.
|
||||
void DrawHintRect( const wxRect& r );
|
||||
|
||||
// Tests if the mouse position is in this window.
|
||||
int HitTestWindow( wxMouseEvent& event );
|
||||
|
||||
// Lays out the buttons.
|
||||
void LayoutMiniButtons();
|
||||
|
||||
public:
|
||||
|
||||
wxToolWindow();
|
||||
~wxToolWindow();
|
||||
|
||||
void SetClient( wxWindow* pWnd );
|
||||
wxWindow* GetClient();
|
||||
// Default constructor.
|
||||
wxToolWindow();
|
||||
|
||||
void SetTitleFont( wxFont& font );
|
||||
// Destructor.
|
||||
~wxToolWindow();
|
||||
|
||||
// buttons are added in right-to-left order
|
||||
void AddMiniButton( cbMiniButton* pBtn );
|
||||
// Sets the client for this tool window.
|
||||
void SetClient( wxWindow* pWnd );
|
||||
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
// Returns the client window.
|
||||
wxWindow* GetClient();
|
||||
|
||||
void OnMotion( wxMouseEvent& event );
|
||||
void OnLeftDown( wxMouseEvent& event );
|
||||
void OnLeftUp( wxMouseEvent& event );
|
||||
void OnSize( wxSizeEvent& event );
|
||||
// Sets the title font.
|
||||
void SetTitleFont( wxFont& font );
|
||||
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
// Adds a button. Buttons are added in right-to-left order.
|
||||
void AddMiniButton( cbMiniButton* pBtn );
|
||||
|
||||
// overridables:
|
||||
// Responds to a paint event.
|
||||
void OnPaint( wxPaintEvent& event );
|
||||
|
||||
virtual wxSize GetPreferredSize( const wxSize& given );
|
||||
virtual void OnMiniButtonClicked( int btnIdx ) {}
|
||||
virtual bool HandleTitleClick( wxMouseEvent& event ) { return FALSE; }
|
||||
// Responds to a mouse move event.
|
||||
void OnMotion( wxMouseEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// Responds to a mouse left down event.
|
||||
void OnLeftDown( wxMouseEvent& event );
|
||||
|
||||
// Responds to a mouse left up event.
|
||||
void OnLeftUp( wxMouseEvent& event );
|
||||
|
||||
// Responds to a size event.
|
||||
void OnSize( wxSizeEvent& event );
|
||||
|
||||
// Responds to an erase background event.
|
||||
void OnEraseBackground( wxEraseEvent& event );
|
||||
|
||||
// Returns the preferred size for the window.
|
||||
virtual wxSize GetPreferredSize( const wxSize& given );
|
||||
|
||||
// Called when a mini button is clicked.
|
||||
// By default, does nothing.
|
||||
virtual void OnMiniButtonClicked( int btnIdx ) {}
|
||||
|
||||
// Handles clicking on the title. By default, does nothing.
|
||||
virtual bool HandleTitleClick( wxMouseEvent& event ) { return FALSE; }
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
// FIXME:: the code below should be moved to a separate file
|
||||
|
||||
#include "wx/fl/controlbar.h"
|
||||
|
||||
/*
|
||||
cbMiniButton is the base class for a small button that can be placed in a wxToolWindow
|
||||
titlebar.
|
||||
*/
|
||||
|
||||
class cbMiniButton : public wxObject
|
||||
{
|
||||
public:
|
||||
wxPoint mPos;
|
||||
wxSize mDim;
|
||||
bool mVisible;
|
||||
bool mEnabled;
|
||||
wxPoint mPos;
|
||||
wxSize mDim;
|
||||
bool mVisible;
|
||||
bool mEnabled;
|
||||
|
||||
wxFrameLayout* mpLayout;
|
||||
cbDockPane* mpPane;
|
||||
cbPluginBase* mpPlugin;
|
||||
wxFrameLayout* mpLayout;
|
||||
cbDockPane* mpPane;
|
||||
cbPluginBase* mpPlugin;
|
||||
|
||||
wxWindow* mpWnd;
|
||||
wxWindow* mpWnd;
|
||||
|
||||
bool mWasClicked;
|
||||
bool mDragStarted;
|
||||
bool mWasClicked;
|
||||
bool mDragStarted;
|
||||
|
||||
bool mPressed;
|
||||
bool mPressed;
|
||||
public:
|
||||
cbMiniButton();
|
||||
// Default constructor.
|
||||
cbMiniButton();
|
||||
|
||||
void SetPos( const wxPoint& pos );
|
||||
bool HitTest( const wxPoint& pos );
|
||||
// Set the position of the button.
|
||||
void SetPos( const wxPoint& pos );
|
||||
|
||||
void OnLeftDown( const wxPoint& pos );
|
||||
void OnLeftUp( const wxPoint& pos );
|
||||
void OnMotion( const wxPoint& pos );
|
||||
// Returns TRUE if the given position was over the button.
|
||||
bool HitTest( const wxPoint& pos );
|
||||
|
||||
void Refresh();
|
||||
virtual void Draw( wxDC& dc );
|
||||
// Responds to a left down event.
|
||||
void OnLeftDown( const wxPoint& pos );
|
||||
|
||||
bool WasClicked();
|
||||
void Reset();
|
||||
// Responds to a left up event.
|
||||
void OnLeftUp( const wxPoint& pos );
|
||||
|
||||
void Enable( bool enable ) { mEnabled = enable; }
|
||||
// Responds to a mouse move event.
|
||||
void OnMotion( const wxPoint& pos );
|
||||
|
||||
bool IsPressed() { return mPressed; }
|
||||
// Refreshes the button.
|
||||
void Refresh();
|
||||
|
||||
// Draws the button. Override this to implement
|
||||
// the desired appearance.
|
||||
virtual void Draw( wxDC& dc );
|
||||
|
||||
// Returns TRUE if the button was clicked.
|
||||
bool WasClicked();
|
||||
|
||||
// Reset the button.
|
||||
void Reset();
|
||||
|
||||
// Enable or disable the button.
|
||||
void Enable( bool enable ) { mEnabled = enable; }
|
||||
|
||||
// Returns TRUE if this button is pressed.
|
||||
bool IsPressed() { return mPressed; }
|
||||
};
|
||||
|
||||
// classes specific to wxFrameLayout engine (FOR NOW in here...)
|
||||
/*
|
||||
cbCloseBox is a window close button, used in a wxToolWindow titlebar.
|
||||
*/
|
||||
|
||||
class cbCloseBox : public cbMiniButton
|
||||
{
|
||||
public:
|
||||
virtual void Draw( wxDC& dc );
|
||||
// Draws the close button appearance.
|
||||
virtual void Draw( wxDC& dc );
|
||||
};
|
||||
|
||||
/*
|
||||
cbCollapseBox is a window collapse button, used in a wxToolWindow titlebar.
|
||||
*/
|
||||
|
||||
class cbCollapseBox : public cbMiniButton
|
||||
{
|
||||
public:
|
||||
bool mIsAtLeft;
|
||||
bool mIsAtLeft;
|
||||
|
||||
virtual void Draw( wxDC& dc );
|
||||
// Draws the collapse button appearance.
|
||||
virtual void Draw( wxDC& dc );
|
||||
};
|
||||
|
||||
/*
|
||||
cbDockBox is a window dock button, used in a wxToolWindow titlebar.
|
||||
*/
|
||||
|
||||
class cbDockBox : public cbMiniButton
|
||||
{
|
||||
public:
|
||||
virtual void Draw( wxDC& dc );
|
||||
// Draws the dock button appearance.
|
||||
virtual void Draw( wxDC& dc );
|
||||
};
|
||||
|
||||
/*
|
||||
cbFloatedBarWindow is a kind of wxToolWindow,
|
||||
implementing floating toolbars.
|
||||
*/
|
||||
|
||||
class cbFloatedBarWindow : public wxToolWindow
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbFloatedBarWindow )
|
||||
DECLARE_DYNAMIC_CLASS( cbFloatedBarWindow )
|
||||
protected:
|
||||
cbBarInfo* mpBar;
|
||||
wxFrameLayout* mpLayout;
|
||||
cbBarInfo* mpBar;
|
||||
wxFrameLayout* mpLayout;
|
||||
|
||||
friend class cbFloatedBarWindowSerializer;
|
||||
friend class cbFloatedBarWindowSerializer;
|
||||
|
||||
public:
|
||||
cbFloatedBarWindow();
|
||||
// Default constructor.
|
||||
cbFloatedBarWindow();
|
||||
|
||||
void SetBar( cbBarInfo* pBar );
|
||||
void SetLayout( wxFrameLayout* pLayout );
|
||||
cbBarInfo* GetBar();
|
||||
// Sets the bar information for this window.
|
||||
void SetBar( cbBarInfo* pBar );
|
||||
|
||||
// given coordinates are those of the bar itself
|
||||
// floated container window's position and size
|
||||
// are ajusted accordingly
|
||||
// Sets the layout for this window.
|
||||
void SetLayout( wxFrameLayout* pLayout );
|
||||
|
||||
void PositionFloatedWnd( int scrX, int scrY,
|
||||
int width, int height );
|
||||
// Returns the bar information for this window.
|
||||
cbBarInfo* GetBar();
|
||||
|
||||
// overriden methods of wxToolWindow
|
||||
// Position the floating window. The given coordinates
|
||||
// are those of the bar itself; the floated container window's
|
||||
// position and size are ajusted accordingly.
|
||||
void PositionFloatedWnd( int scrX, int scrY,
|
||||
int width, int height );
|
||||
|
||||
virtual wxSize GetPreferredSize( const wxSize& given );
|
||||
virtual void OnMiniButtonClicked( int btnIdx );
|
||||
virtual bool HandleTitleClick( wxMouseEvent& event );
|
||||
// Overridden function returning the preferred size.
|
||||
virtual wxSize GetPreferredSize( const wxSize& given );
|
||||
|
||||
void OnDblClick( wxMouseEvent& event );
|
||||
// Overridden function responding to mouse clicks on mini-buttons.
|
||||
virtual void OnMiniButtonClicked( int btnIdx );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
// Overridden function responding to mouse button clicks on the titlebar.
|
||||
virtual bool HandleTitleClick( wxMouseEvent& event );
|
||||
|
||||
// Responds to double-click mouse events.
|
||||
void OnDblClick( wxMouseEvent& event );
|
||||
|
||||
DECLARE_EVENT_TABLE()
|
||||
};
|
||||
|
||||
#endif /* __TOOLWND_G__ */
|
||||
|
@@ -1,12 +1,12 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Name: No names yet.
|
||||
// Purpose: Contrib. demo
|
||||
// Name: updatesmgr.h
|
||||
// Purpose: cbSimpleUpdatesMgr class declaration
|
||||
// Author: Aleksandras Gluchovas (@Lithuania)
|
||||
// Modified by:
|
||||
// Created: 19/10/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Aleksandras Gluchovas
|
||||
// Licence: wxWindows license
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __UPDATESMGR_G__
|
||||
@@ -19,37 +19,51 @@
|
||||
#include "wx/fl/controlbar.h"
|
||||
|
||||
/*
|
||||
* class implements slightly optimized logic for refreshing
|
||||
* areas of frame layout - which actually need to be updated.
|
||||
*/
|
||||
This class implements slightly optimized logic for refreshing
|
||||
the areas of frame layout that actually need to be updated.
|
||||
*/
|
||||
|
||||
class cbSimpleUpdatesMgr : public cbUpdatesManagerBase
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS( cbSimpleUpdatesMgr )
|
||||
DECLARE_DYNAMIC_CLASS( cbSimpleUpdatesMgr )
|
||||
protected:
|
||||
|
||||
bool WasChanged( cbUpdateMgrData& data, wxRect& currentBounds );
|
||||
// Helper function.
|
||||
bool WasChanged( cbUpdateMgrData& data, wxRect& currentBounds );
|
||||
|
||||
public:
|
||||
// Default constructor.
|
||||
cbSimpleUpdatesMgr() {}
|
||||
|
||||
cbSimpleUpdatesMgr(void) {}
|
||||
// Constructor taking frame layout panel.
|
||||
cbSimpleUpdatesMgr( wxFrameLayout* pPanel );
|
||||
|
||||
cbSimpleUpdatesMgr( wxFrameLayout* pPanel );
|
||||
// Notification received from Frame Layout in the order in which
|
||||
// they would usually be invoked.
|
||||
virtual void OnStartChanges();
|
||||
|
||||
// notificiactions received from Frame Layout (in the order, in which
|
||||
// they usually would be invoked)
|
||||
// Notification received from Frame Layout in the order in which
|
||||
// they would usually be invoked.
|
||||
virtual void OnRowWillChange( cbRowInfo* pRow, cbDockPane* pInPane );
|
||||
|
||||
virtual void OnStartChanges();
|
||||
// Notification received from Frame Layout in the order in which
|
||||
// they would usually be invoked.
|
||||
virtual void OnBarWillChange( cbBarInfo* pBar, cbRowInfo* pInRow, cbDockPane* pInPane );
|
||||
|
||||
virtual void OnRowWillChange( cbRowInfo* pRow, cbDockPane* pInPane );
|
||||
virtual void OnBarWillChange( cbBarInfo* pBar, cbRowInfo* pInRow, cbDockPane* pInPane );
|
||||
virtual void OnPaneMarginsWillChange( cbDockPane* pPane );
|
||||
virtual void OnPaneWillChange( cbDockPane* pPane );
|
||||
// Notification received from Frame Layout in the order in which
|
||||
// they would usually be invoked.
|
||||
virtual void OnPaneMarginsWillChange( cbDockPane* pPane );
|
||||
|
||||
virtual void OnFinishChanges();
|
||||
// Notification received from Frame Layout in the order in which
|
||||
// they would usually be invoked.
|
||||
virtual void OnPaneWillChange( cbDockPane* pPane );
|
||||
|
||||
// refreshes parts of the frame layout, which need an update
|
||||
virtual void UpdateNow();
|
||||
// Notification received from Frame Layout in the order in which
|
||||
// they would usually be invoked.
|
||||
virtual void OnFinishChanges();
|
||||
|
||||
// Refreshes the parts of the frame layoutthat need an update.
|
||||
virtual void UpdateNow();
|
||||
};
|
||||
|
||||
#endif /* __UPDATESMGR_G__ */
|
||||
|
Reference in New Issue
Block a user