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

📄 controlbar.h

📁 Wxpython Implemented on Windows CE, Source code
💻 H
📖 第 1 页 / 共 5 页
字号:

        // Hooking custom plugins to frame layout.
        //
        // Note: when hooking one plugin on top of the other,
        // use SetNextHandler or similar methods
        // of wxEvtHandler class to compose the chain of plugins,
        // than pass the left-most handler in this chain to
        // the above methods (assuming that events are delegated
        // from left-most towards right-most handler).
        //
        // This secenario is very inconvenient and "low-level",
        // so use the Add/Push/PopPlugin methods instead.

    virtual void SetTopPlugin( cbPluginBase* pPlugin );

        // Similar to wxWindow's "push/pop-event-handler" methods, execept
        // that the plugin is deleted upon "popping".

    virtual void PushPlugin( cbPluginBase* pPugin );

        // Similar to wxWindow's "push/pop-event-handler" methods, execept
        // that the plugin is deleted upon "popping".

    virtual void PopPlugin();

        // Pop all plugins.
    virtual void PopAllPlugins();

        // Adds the default plugins. These are cbPaneDrawPlugin, cbRowLayoutPlugin, cbBarDragPlugin,
        // cbAntiflickerPlugin, cbSimpleCustomizePlugin.
        //
        // This method is automatically invoked if no plugins were found upon
        // firing of the first plugin-event, i.e. when wxFrameLayout configures itself.

    virtual void PushDefaultPlugins();

        // An advanced methods for plugin configuration    using their
        // dynamic class information, for example CLASSINFO(pluginClass).

        // First checks if the plugin of the given class is already "hooked up".
        // If not, adds it to the top of the plugins chain.

    virtual void AddPlugin( wxClassInfo* pPlInfo, int paneMask = wxALL_PANES );

        // First checks if the plugin of the given class is already hooked.
        // If so, removes it, and then inserts it into the chain
        // before the plugin of the class given by pNextPlInfo.
        //
        // Note: this method is handy in some cases where the order
        // of the plugin-chain could be important, for example when one plugin overrides
        // some functionality of another already-hooked plugin,
        // so that the former plugin should be hooked before the one
        // whose functionality is being overridden.

    virtual void AddPluginBefore( wxClassInfo* pNextPlInfo, wxClassInfo* pPlInfo,
                                  int paneMask = wxALL_PANES );

        // Checks if the plugin of the given class is hooked, and removes
        // it if found.

    virtual void RemovePlugin( wxClassInfo* pPlInfo );

        // Finds a plugin with the given class, or returns NULL if a plugin of the given
        // class is not hooked.

    virtual cbPluginBase* FindPlugin( wxClassInfo* pPlInfo );

        // Returns true if there is a top plugin.

    bool HasTopPlugin();

    DECLARE_EVENT_TABLE()
    DECLARE_DYNAMIC_CLASS( wxFrameLayout )

public: /* protected really, acessed only by plugins and serializers */

    friend class cbDockPane;
    friend class wxBarHandler;

    wxWindow*    mpFrame;           // parent frame
    wxWindow*    mpFrameClient;        // client window
    cbDockPane*  mPanes[MAX_PANES];    // panes in the panel

    // misc. cursors
    wxCursor*    mpHorizCursor;
    wxCursor*    mpVertCursor;
    wxCursor*    mpNormalCursor;
    wxCursor*    mpDragCursor;
    wxCursor*    mpNECursor; // no-entry cursor

    // pens for decoration and shades

    wxPen        mDarkPen;     // default wxSYS_COLOUR_3DSHADOW
    wxPen        mLightPen;  // default wxSYS_COLOUR_3DHILIGHT
    wxPen        mGrayPen;     // default wxSYS_COLOUR_3DFACE
    wxPen        mBlackPen;  // default wxColour(  0,  0,  0)
    wxPen        mBorderPen; // default wxSYS_COLOUR_3DFACE

    wxPen        mNullPen;   // transparent pen

        // pane to which the all mouse input is currently directed (caputred)

    cbDockPane*  mpPaneInFocus;

        // pane, from which mouse pointer had just left

    cbDockPane*  mpLRUPane;

        // bounds of client window in parent frame's coordinates

    wxRect       mClntWndBounds;
    wxRect       mPrevClntWndBounds;

    bool         mFloatingOn;
    wxPoint      mNextFloatedWndPos;
    wxSize       mFloatingPosStep;

        // current plugin (right-most) plugin which receives events first

    cbPluginBase* mpTopPlugin;

        // plugin, which currently has captured all input events, otherwise NULL

    cbPluginBase* mpCaputesInput;

        // list of event handlers which are "pushed" onto each bar, to catch
        // mouse events which are not handled by bars, and froward them to the ,
        // frome-layout and further to plugins

    wxList        mBarSpyList;

        // list of top-most frames which contain floated bars

    wxList        mFloatedFrames;

        // linked list of references to all bars (docked/floated/hidden)

    BarArrayT    mAllBars;

    // FOR NOW:: dirty stuff...
    bool         mClientWndRefreshPending;
    bool         mRecalcPending;
    bool         mCheckFocusWhenIdle;

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

        // refrence to custom updates manager
    cbUpdatesManagerBase* mpUpdatesMgr;

        // Called to apply the calculated layout to window objects.

    void PositionClientWindow();

        // Called to apply the calculated layout to window objects.

    void PositionPanes();

        // Creates the cursors.

    void CreateCursors();

        // Applies the calculated layout to a floating bar.

    void RepositionFloatedBar( cbBarInfo* pBar );

        // Applies the state to the window objects.

    void DoSetBarState( cbBarInfo* pBar );

        // The purpose of this function is unknown.

    bool LocateBar( cbBarInfo* pBarInfo,
                    cbRowInfo**  ppRow,
                    cbDockPane** ppPane );


        // Returns true if the position is within the given pane.

    bool HitTestPane( cbDockPane* pPane, int x, int y );

        // Returns the pane for which the rectangle hit test succeeds, giving
        // preference to the given pane if supplied.

    cbDockPane* HitTestPanes( const wxRect& rect, cbDockPane* pCurPane );

        // Returns the pane to which the given bar belongs.

    cbDockPane* GetBarPane( cbBarInfo* pBar );

        // Delegated from "bar-spy".
    void ForwardMouseEvent( wxMouseEvent& event,
                            cbDockPane*   pToPane,
                            int           eventType );

        // Routes the mouse event to the appropriate pane.

    void RouteMouseEvent( wxMouseEvent& event, int pluginEvtType );

        // Shows all floated windows.

    void ShowFloatedWindows( bool show );

        // Unhooks the layout from the frame.

    void UnhookFromFrame();

        // Hooks the layout up to the frame (pushes the layout onto the
        // frame's event handler stack).

    void HookUpToFrame();

        // Returns true if the platform allows reparenting. This may not return true
        // for all platforms. Reparenting allows control bars to be floated.

    bool CanReparent();

        // Reparents pChild to have parent pNewParent.

    void ReparentWindow( wxWindow* pChild, wxWindow* pNewParent );

        // Returns the previous client window rectangle.

    wxRect& GetPrevClientRect() { return mPrevClntWndBounds; }

        // Handles paint events, calling PaintPane for each pane.

    void OnPaint( wxPaintEvent& event );

        // Handles background erase events. Currently does nothing.

    void OnEraseBackground( wxEraseEvent& event );

        // Handles focus kill events. Currently does nothing.

    void OnKillFocus( wxFocusEvent& event );

        // Handles focus set events. Currently does nothing.

    void OnSetFocus( wxFocusEvent& event );

        // Handles activation events. Currently does nothing.

    void OnActivate( wxActivateEvent& event );

        // Handles idle events.

    void OnIdle( wxIdleEvent& event );

        // Returns a new cbGCUpdatesMgr object.

    virtual cbUpdatesManagerBase* CreateUpdatesManager();
};

/*
A structure that is present in each item of layout,
used by any particular updates-manager to store
auxiliary information to be used by its updating algorithm.
*/

class WXDLLIMPEXP_FL cbUpdateMgrData : public wxObject
{
    DECLARE_DYNAMIC_CLASS( cbUpdateMgrData )
public:
    wxRect mPrevBounds;      // previous state of layout item (in parent frame's coordinates)

    bool   mIsDirty;         // overrides result of current-against-previous bounds comparison,
                             // i.e. requires item to be updated, regardless of it's current area

    wxObject*  mpCustomData; // any custom data stored by specific updates mgr.

        // Default constructor. Is-dirty flag is set true initially.

    cbUpdateMgrData();

        // Store the item state.

    void StoreItemState( const wxRect& boundsInParent );

        // Set the dirty flag.

    void SetDirty( bool isDirty = true );

        // Set custom data.

    void SetCustomData( wxObject* pCustomData );

        // Returns the is-dirty flag.

    inline bool IsDirty() { return mIsDirty; }
};

/*
Abstract interface for bar-size handler classes.
These objects receive notifications whenever the docking
state of the bar is changed, thus they provide the possibility
to adjust the values in cbDimInfo::mSizes accordingly.
Specific handlers can be hooked up to specific types of bar.
*/

class WXDLLIMPEXP_FL cbBarDimHandlerBase : public wxObject
{
    DECLARE_ABSTRACT_CLASS( cbBarDimHandlerBase )

public:
    int mRefCount; // since one dim-handler can be assigned
                   // to multiple bars, it's instance is
                   // reference-counted
public:

        // Default constructor. The initial reference count is 0, since
        // the handler is not used until the first invocation of AddRef().

    cbBarDimHandlerBase();

        // Increments the reference count.

    void AddRef();

        // Decrements the reference count, and if the count is at zero,
        // delete 'this'.

    void RemoveRef();

        // Responds to "bar-state-changes" notifications.

    virtual void OnChangeBarState(cbBarInfo* pBar, int newState ) = 0;

        // Responds to bar resize notifications.

    virtual void OnResizeBar( cbBarInfo* pBar, const wxSize& given, wxSize& preferred ) = 0;
};

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

class WXDLLIMPEXP_FL cbDimInfo : public wxObject
{
    DECLARE_DYNAMIC_CLASS( cbDimInfo )
public:
    wxSize mSizes[MAX_BAR_STATES];  // preferred sizes for each possible bar state

    wxRect mBounds[MAX_BAR_STATES]; // saved positions and sizes for each
                                    // possible state, values contain (-1)s if
                                    // not initialized yet

    int    mLRUPane; // pane to which this bar was docked before it was floated
                     // (FL_ALIGN_TOP,FL_ALIGN_BOTTOM,..)

    // top/bottom gap, separates decorations
    // from the bar's actual window, filled
    // with frame's beckground color, default: 0

    int    mVertGap;

    // left/right gap, separates decorations
    // from the bar's actual wndow, filled
    // with frame's beckground colour, default: 0

    int    mHorizGap;    // NOTE:: gaps are given in frame's coord. orientation

    // true, if vertical/horizontal dimensions cannot be mannualy adjusted
    //       by user using resizing handles. If false, the frame-layout
    //       *automatically* places resizing handles among not-fixed bars

    bool   mIsFixed;

    cbBarDimHandlerBase* mpHandler; // NULL, if no handler present

public:

        // Default constructor.

    cbDimInfo(void);

        // Constructor.
        // isFixed is true if vertical/horizontal dimensions cannot be manually adjusted
        // by the user using resizing handles. If false, the frame-layout
        // automatically places resizing handles among bars that do are not fixed.

    cbDimInfo( cbBarDimHandlerBase* pDimHandler,
               bool                 isFixed         // (see comments on mIsFixed member)
             );

        // Constructor taking dimenstion information.
        //
        // dh_x, dh_y are the dimensions when docked horizontally.

⌨️ 快捷键说明

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