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

📄 manager.h

📁 非常好用的可移植的多平台C/C++源代码编辑器
💻 H
📖 第 1 页 / 共 3 页
字号:
/////////////////////////////////////////////////////////////////////////////
// Name:        manager.h
// Purpose:     wxPropertyGridManager
// Author:      Jaakko Salli
// Modified by:
// Created:     Jan-14-2005
// RCS-ID:      $Id:
// Copyright:   (c) Jaakko Salli
// Licence:     wxWindows license
/////////////////////////////////////////////////////////////////////////////

#ifndef _WX_PROPGRID_MANAGER_H_
#define _WX_PROPGRID_MANAGER_H_

#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
    #pragma interface "manager.cpp"
#endif

#include <wx/propgrid/propgrid.h>

// -----------------------------------------------------------------------

extern WXDLLIMPEXP_PG const wxChar *wxPropertyGridManagerNameStr;

// -----------------------------------------------------------------------

// This is for mirroring wxPropertyGrid methods with ease.
// Needs to be in hear because of inlines.
#define wxPG_IMPLEMENT_PGMAN_METHOD_NORET1(NAME,AT1) \
wxPG_IPAM_DECL void wxPropertyGridManager::NAME ( wxPGId id, AT1 _av1_ ) \
{ \
    wxPGProperty* p = wxPGIdToPtr(id); \
    wxPropertyGridState* pState = p->GetParentState(); \
    wxASSERT ( pState != (wxPropertyGridState*) NULL ); \
    if ( pState == m_propGrid.m_pState ) m_propGrid.NAME(id,_av1_); \
    else pState->NAME(p,_av1_); \
} \
wxPG_IPAM_DECL void wxPropertyGridManager::NAME ( wxPGNameStr name, AT1 _av1_ ) \
{ \
    wxPropertyGridState* pState; \
    wxPGId id = GetPropertyByName2(name,&pState); \
    wxASSERT ( pState != (wxPropertyGridState*) NULL ); \
    if ( pState == m_propGrid.m_pState ) m_propGrid.NAME(id,_av1_); \
    else pState->NAME(wxPGIdToPtr(id),_av1_); \
}

class wxPropertyGridPageData;

#define wxPG_IPAM_DECL inline

/** \class wxPropertyGridManager
    \ingroup classes
    \brief
    wxPropertyGridManager is an efficient multi-page version of wxPropertyGrid,
    which can optionally have toolbar for mode and page selection, help text box,
    and a compactor button.
    Use window flags to select which ones to include.

    <h4>Derived from</h4>

    wxPropertyContainerMethods\n
    wxWindow\n
    wxEvtHandler\n
    wxObject\n

    <h4>Include files</h4>

    <wx/propgrid/manager.h>

    <h4>Window styles</h4>

    @link wndflags Additional Window Styles@endlink

    <h4>Event handling</h4>

    To process input from a propertygrid control, use these event handler macros to
    direct input to member functions that take a wxPropertyGridEvent argument.

    <table>
    <tr><td>EVT_PG_SELECTED (id, func)</td><td>Property is selected.</td></tr>
    <tr><td>EVT_PG_CHANGED (id, func)</td><td>Property value is modified.</td></tr>
    <tr><td>EVT_PG_HIGHLIGHTED (id, func)</td><td>Mouse moves over property. Event's property is NULL if hovered on area that is not a property.</td></tr>
    <tr><td>EVT_PG_PAGE_CHANGED (id, func)</td><td>User changed page in manager.</td></tr>
    </table>

    \sa @link wxPropertyGridEvent wxPropertyGridEvent@endlink

*/
// BM_MANAGER
class WXDLLIMPEXP_PG wxPropertyGridManager : public wxPanel, public wxPropertyContainerMethods
{
	DECLARE_CLASS(wxPropertyGridManager)

public:

	/** Two step constructor. Call Create when this constructor is called to build up the 
	    wxPropertyGridManager.
	*/
    wxPropertyGridManager();

    /** The default constructor. The styles to be used are styles valid for
        the wxWindow.
        \sa @link wndflags Additional Window Styles@endlink
    */
    wxPropertyGridManager(wxWindow *parent, wxWindowID id = -1,
               	      const wxPoint& pos = wxDefaultPosition,
               	      const wxSize& size = wxDefaultSize,
               	      long style = wxPGMAN_DEFAULT_STYLE,
               	      const wxChar* name = wxPropertyGridManagerNameStr);

    /** Destructor */
    virtual ~wxPropertyGridManager();

    /** Creates new property page. Note that the first page is not created
        automatically, and before you have created any pages you are basicly
        in a non-paged mode. When you create the first page, contents
        of the underlying propertygrid is added into it (or this is how it
        will seem to to the user).
        \param label
        A label for the page. This may be shown as a toolbar tooltip etc.
        \param bmp
        Bitmap image for toolbar. If wxNullBitmap is used, then a built-in
        default image is used.
        \retval
        Returns index to the page created.
        \remarks
        If toolbar is used, it is highly recommended that the pages are
        added when the toolbar is not turned off using window style flag
        switching.
    */
    inline int AddPage ( const wxString& label = wxEmptyString, const wxBitmap& bmp = wxNullBitmap )
    {
        return InsertPage (-1,label,bmp);
    }

    /** See wxPropertyGrid::Append. */
    inline wxPGId AppendCategory ( const wxString& label, const wxString& name = wxPG_LABEL )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Append ( new wxPropertyCategoryClass(label,name) );
    }

    /** See wxPropertyGrid::Append. */
    inline wxPGId Append ( wxPGProperty* property )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Append(property);
    }

    inline wxPGId Append ( const wxString& label, const wxString& name, const wxString& value = wxEmptyString )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Append ( wxStringProperty(label,name,value) );
    }

    inline wxPGId Append ( const wxString& label, const wxString& name, int value )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Append ( wxIntProperty(label,name,value) );
    }

    inline wxPGId Append ( const wxString& label, const wxString& name, double value )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Append ( wxFloatProperty(label,name,value) );
    }

    inline wxPGId Append ( const wxString& label, const wxString& name, bool value )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Append ( wxBoolProperty(label,name,value) );
    }

    /** See wxPropertyGrid::AppendIn. */
    inline wxPGId AppendIn ( wxPGId id, wxPGProperty* property )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Insert((wxPGPropertyWithChildren*)(wxPGProperty*)id,-1,property);
    }

    /** See wxPropertyGrid::AppendIn. */
    inline wxPGId AppendIn ( wxPGNameStr name, wxPGProperty* property )
    {
        wxASSERT ( m_targetState );
        return m_targetState->Insert((wxPGPropertyWithChildren*)(wxPGProperty*)m_targetState->BaseGetPropertyByName(name),-1,property);
    }
    
    void ClearModifiedStatus ( wxPGId id );

    inline void ClearModifiedStatus ()
    {
        m_propGrid.ClearModifiedStatus();
    }

    /** Deletes all properties on given page.
    */
    void ClearPage( int page );

    bool ClearPropertyValue( wxPGId id );
    bool ClearPropertyValue( wxPGNameStr name );
    
    /** Collapses given item. Returns TRUE if it was collapsable and previously expanded. */
    bool Collapse ( wxPGId id );
    bool Collapse ( wxPGNameStr name );

    /** Collapses all parents on target page. */
    inline void CollapseAll ()
    {
        m_targetState->ExpandAll(0);
    }

    /** Compacts (arg is TRUE) or expands the propertygrid (i.e. low priority
        items are already hidden or shown).
    */
    void Compact ( bool compact );

    /** Two step creation. Whenever the control is created without any parameters,
        use Create to actually create it. Don't access the control's public methods
        before this is called.
        \sa @link wndflags Additional Window Styles@endlink
    */
    bool Create(wxWindow *parent, wxWindowID id = -1,
                const wxPoint& pos = wxDefaultPosition,
                const wxSize& size = wxDefaultSize,
                long style = wxPGMAN_DEFAULT_STYLE,
                const wxChar* name = wxPropertyGridManagerNameStr);

    /** Deletes a property. */
    void Delete ( wxPGId id );
    void Delete ( wxPGNameStr name );

    /** Disables a property. */
    inline bool DisableProperty ( wxPGId id ) { return EnableProperty (id,FALSE); }

    /** Disables a property. */
    inline bool DisableProperty ( wxPGNameStr name ) { return EnableProperty (name,FALSE); }

    /** Enables or disables (shows/hides) categories according to parameter enable.
        WARNING: Not tested properly, use at your own risk.
    */
    inline bool EnableCategories ( bool enable )
    {
        long fl = m_windowStyle | wxPG_HIDE_CATEGORIES;
        if ( enable ) fl = m_windowStyle & ~(wxPG_HIDE_CATEGORIES);
        SetWindowStyleFlag(m_windowStyle);
        return TRUE;
    }

    /** Enables or disables a property on target page. */
    bool EnableProperty ( wxPGId id, bool enable = TRUE );
    bool EnableProperty ( wxPGNameStr name, bool enable = TRUE );

    /** Selects page, scrolls and/or expands items to ensure that the
        given item is visible. Returns TRUE if something was actually done.
    */
    inline bool EnsureVisible ( wxPGId id )
    {
        return EnsureVisible(id,((wxPGProperty*)id)->GetParentState());
    }

    /** Selects page, scrolls and/or expands items to ensure that the
        given item is visible. Returns TRUE if something was actually done.
    */
    inline bool EnsureVisible ( wxPGNameStr name )
    {
        wxPropertyGridState* pstate;
        wxPGId id = GetPropertyByName2(name,&pstate);
        return EnsureVisible(id,pstate);
    }

    /** Expands given item. Returns TRUE if it was expandable and previously collapsed. */
    bool Expand ( wxPGId id );
    bool Expand ( wxPGNameStr name );

    /** Expands all parents on target page. */
    void ExpandAll ()
    {
        m_targetState->ExpandAll(1);
    }

    /** Returns cell background colour of a category. */
    /*wxColour GetCategoryColour ( wxPGId id )
    {
        return wxPropertyGrid::GetCategoryColour(id);
    }
    wxColour GetCategoryColour ( wxPGNameStr name ) { return GetCategoryColour(GetPropertyByName(name)); }*/

    /** Returns number of children of the root property of the selected page. */
    inline size_t GetChildrenCount ()
    {
        return GetChildrenCount( wxPGId(m_propGrid.m_pState->m_properties) );
    }

    /** Returns number of children of the root property of given page. */
    size_t GetChildrenCount ( int page_index );

    /** Returns number of children for the property. */
    inline size_t GetChildrenCount ( wxPGId id ) const
    {
        wxASSERT ( wxPGIdIsOk(id) );
        return ((wxPGProperty*)id)->GetChildCount();

⌨️ 快捷键说明

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