⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 controlbar.h

📁 Wxpython Implemented on Windows CE, Source code
💻 H
📖 第 1 页 / 共 5 页
字号:
        //
        // dv_x, dv_y are the dimensions when docked vertically.
        //
        // f_x, f_y are the dimensions when floating.
        //
        // For information on isFixed, see comments above.
        //
        // horizGap is the left/right gap, separating decorations
        // from the bar's actual wndow, filled with the frame's background colour.
        // The dimension is given in the frame's coordinates.
        //
        // vertGap is the top/bottom gap, separating decorations
        // from the bar's actual wndow, filled with the frame's background colour.
        // The dimension is given in the frame's coordinates.

    cbDimInfo( int dh_x, int dh_y,
               int dv_x, int dv_y,
               int f_x,  int f_y,

               bool isFixed  = true,
               int  horizGap = 6,
               int  vertGap  = 6,

               cbBarDimHandlerBase* pDimHandler = NULL
             );

        // Constructor.

    cbDimInfo( int x, int y,
               bool isFixed  = true,
               int  gap = 6,
               cbBarDimHandlerBase* pDimHandler = NULL
             );

        // Destructor. Destroys handler automatically, if present.

    ~cbDimInfo();

         // Assignment operator.

    const cbDimInfo& operator=( const cbDimInfo& other );

         // Returns the handler, if any.

    inline cbBarDimHandlerBase* GetDimHandler() { return mpHandler; }
};

// FIXME: this array definition compiles but probably doesn't do what was intended (GD)
WXFL_DEFINE_ARRAY_LONG(float, cbArrayFloat);

/*
Helper class used internally by the wxFrameLayout class.
Holds and manages information about bar rows.
*/

class cbRowInfo : public wxObject
{
    DECLARE_DYNAMIC_CLASS( cbRowInfo )
public:

    BarArrayT  mBars;  // row content

    // row flags (set up according to row-relations)

    bool    mHasUpperHandle;
    bool    mHasLowerHandle;
    bool    mHasOnlyFixedBars;
    int     mNotFixedBarsCnt;

    int        mRowWidth;
    int        mRowHeight;
    int        mRowY;

    // stores precalculated row's bounds in parent frame's coordinates
    wxRect mBoundsInParent;

    // info stored for updates-manager
    cbUpdateMgrData mUMgrData;

    cbRowInfo*    mpNext;
    cbRowInfo*    mpPrev;

    cbBarInfo*    mpExpandedBar; // NULL, if non of the bars is currently expanded

    cbArrayFloat  mSavedRatios;  // length-ratios bofore some of the bars was expanded

public:
        // Constructor.

    cbRowInfo(void);

        // Destructor.

    ~cbRowInfo();

        // Returns the first bar.

    inline cbBarInfo* GetFirstBar()

        { return mBars.GetCount() ? mBars[0] : NULL; }
};

/*
Helper class used internally by the wxFrameLayout class.
Holds and manages bar information.
*/

class cbBarInfo : public wxObject
{
    DECLARE_DYNAMIC_CLASS( cbBarInfo )
public:
    // textual name, by which this bar is referred in layout-customization dialogs
    wxString      mName;

    // stores bar's bounds in pane's coordinates
    wxRect        mBounds;

    // stores precalculated bar's bounds in parent frame's coordinates
    wxRect        mBoundsInParent;

    // back-ref to the row, which contains this bar
    cbRowInfo*    mpRow;

    // are set up according to the types of the surrounding bars in the row
    bool          mHasLeftHandle;
    bool          mHasRightHandle;

    // determines if this bar can float. The layout's setting as priority. For
    // example, if the layout's mFloatingOn is false, this setting is irrelevant
    // since nothing will float at all. If the layout's floating is on, use this
    // setting to prevent specific bars from floating. In other words, all bars
    // float by default and floating can be turned off on individual bars.
    bool          mFloatingOn;    // default: ON (which is also the layout's mFloatingOn default setting)

    cbDimInfo     mDimInfo;       // preferred sizes for each, control bar state

    int           mState;         // (see definition of controlbar states)

    int           mAlignment;     // alignment of the pane to which this
                                  // bar is currently placed

    int           mRowNo;         // row, into which this bar would be placed,
                                  // when in the docking state

    wxWindow*     mpBarWnd;          // the actual window object, NULL if no window
                                  // is attached to the control bar (possible!)

    double        mLenRatio;      // length ratio among not-fixed-size bars

    wxPoint       mPosIfFloated;  // stored last position when bar was in "floated" state
                                  // poistion is stored in parent-window's coordinates

    cbUpdateMgrData mUMgrData;    // info stored for updates-manager

    cbBarInfo*    mpNext;         // next. bar in the row
    cbBarInfo*    mpPrev;         // prev. bar in the row

public:
        // Constructor.

    cbBarInfo(void);

        // Destructor.

    ~cbBarInfo();

        // Returns true if this bar is fixed.

    inline bool IsFixed() const { return mDimInfo.mIsFixed; }

        // Returns true if this bar is expanded.

    inline bool IsExpanded() const { return this == mpRow->mpExpandedBar; }
};

/*
Used for storing the original bar's positions in the row, when the 'non-destructive-friction'
option is turned on.
*/

class cbBarShapeData : public wxObject
{
public:
    wxRect mBounds;
    double mLenRatio;
};

/*
Used for traversing through all bars of all rows in the pane.
*/

class wxBarIterator
{
    RowArrayT*  mpRows;
    cbRowInfo*  mpRow;
    cbBarInfo*  mpBar;

public:
        // Constructor, taking row array.

    wxBarIterator( RowArrayT& rows );

        // Resets the iterator to the start of the first row.

    void Reset();

        // Advances the iterator and returns true if a bar is available.

    bool Next();

        // Gets the current bar information.

    cbBarInfo& BarInfo();

        // Returns a reference to the currently traversed row.

    cbRowInfo& RowInfo();
};

/*
A structure holding configuration options,
which are usually the same for all panes in
a frame layout.
*/

class WXDLLIMPEXP_FL cbCommonPaneProperties : public wxObject
{
    DECLARE_DYNAMIC_CLASS( cbCommonPaneProperties )

    // look-and-feel configuration

    bool mRealTimeUpdatesOn;     // default: ON
    bool mOutOfPaneDragOn;       // default: ON
    bool mExactDockPredictionOn; // default: OFF
    bool mNonDestructFrictionOn; // default: OFF

    bool mShow3DPaneBorderOn;    // default: ON

    // FOR NOW:: the below properties are reserved for the "future"

    bool mBarFloatingOn;         // default: OFF
    bool mRowProportionsOn;      // default: OFF
    bool mColProportionsOn;      // default: ON
    bool mBarCollapseIconsOn;    // default: OFF
    bool mBarDragHintsOn;        // default: OFF

    // minimal dimensions for not-fixed bars in this pane (16x16 default)

    wxSize mMinCBarDim;

    // width/height of resizing sash

    int    mResizeHandleSize;

        // Default constructor.

    cbCommonPaneProperties(void);

        // Copy constructor

    cbCommonPaneProperties(const cbCommonPaneProperties&);

        // Assignment operator

    cbCommonPaneProperties& operator=(const cbCommonPaneProperties&);
};

/*
This class manages containment and control of control bars
along one of the four edges of the parent frame.
*/

class cbDockPane : public wxObject
{
public:
    DECLARE_DYNAMIC_CLASS( cbDockPane )

    // look-and-feel configuration for this pane
    cbCommonPaneProperties mProps;

    // pane margins (in frame's coordinate-syst. orientation)

    int             mLeftMargin;     // default: 2 pixels
    int             mRightMargin;     // default: 2 pixels
    int             mTopMargin;         // default: 2 pixels
    int             mBottomMargin;   // default: 2 pixels

public:
    // position of the pane in frame's coordinates
    wxRect          mBoundsInParent;

    // pane width and height in pane's coordinates
    int             mPaneWidth;
    int             mPaneHeight;

    int                mAlignment;

    // info stored for updates-manager
    cbUpdateMgrData mUMgrData;

public: /* protected really */

    RowArrayT        mRows;
    wxFrameLayout*  mpLayout;         // back-ref

    // transient properties

    wxList          mRowShapeData;   // shapes of bars of recently modified row,
                                     // stored when in "non-destructive-friction" mode
    cbRowInfo*      mpStoredRow;     // row-info for which the shapes are stored

    friend class wxFrameLayout;

public: /* protected really (accessed only by plugins) */

        // Returns the row info for a row index. Internal function called by plugins.

    cbRowInfo* GetRow( int row );

        // Returns the row index for the given row info.  Internal function called by plugins.

    int GetRowIndex( cbRowInfo* pRow );

        // Returns the row at the given vertical position.
        // Returns -1 if the row is not present at given vertical position.
        // Internal function called by plugins.

    int     GetRowAt( int paneY );

        // Returns the row between the given vertical positions.
        // Returns -1 if the row is not present.
        // Internal function called by plugins.

    int     GetRowAt( int upperY, int lowerY );

        // Sets up flags in the row information structure, so that
        // they match the changed state of row items correctly.
        // Internal function called by plugins.

    void SyncRowFlags( cbRowInfo* pRow );

        // Returns true if the bar's dimension information indicates a fixed size.
        // Internal function called by plugins.

    bool IsFixedSize( cbBarInfo* pInfo );

        // Returns the number of bars whose size is not fixed.
        // Internal function called by plugins.

    int  GetNotFixedBarsCount( cbRowInfo* pRow );

        // Gets the vertical position at the given row.
        // Internal function called by plugins.

    int GetRowY( cbRowInfo* pRow );

        // Returns true if there are any variable-sized rows above this one.
        // Internal function called by plugins.

    bool HasNotFixedRowsAbove( cbRowInfo* pRow );

        // Returns true if there are any variable-sized rows below this one.
        // Internal function called by plugins.

    bool HasNotFixedRowsBelow( cbRowInfo* pRow );

        // Returns true if there are any variable-sized rows to the left of this one.
        // Internal function called by plugins.

    bool HasNotFixedBarsLeft ( cbBarInfo* pBar );

        // Returns true if there are any variable-sized rows to the right of this one.
        // Internal function called by plugins.

    bool HasNotFixedBarsRight( cbBarInfo* pBar );

        // Calculate lengths.
        // Internal function called by plugins.

    virtual void CalcLengthRatios( cbRowInfo* pInRow );

        // Generates a cbLayoutRowEvent event to recalculate row layouts.
        // Internal function called by plugins.

    virtual void RecalcRowLayout( cbRowInfo* pRow );

        // Expands the bar.
        // Internal function called by plugins.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -