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

📄 manager.h

📁 非常好用的可移植的多平台C/C++源代码编辑器
💻 H
📖 第 1 页 / 共 3 页
字号:

    /** Same as SetDefaultPriority(wxPG_HIGH). */
    inline void ResetDefaultPriority()
    {
        m_propGrid.ResetDefaultPriority();
    }

    /** Sets label of a property.
    */
    void SetPropertyLabel( wxPGId id, const wxString& newlabel );
    void SetPropertyLabel( wxPGNameStr name, const wxString& newlabel );

    /** Sets background colour of property and all its children.  Background brush
        cache is optimized for often set colours to be set last.
    */
    inline void SetPropertyColour ( wxPGId id, const wxColour& col )
    {
        m_propGrid.SetPropertyColour ( id, col );
    }
    inline void SetPropertyColour ( wxPGNameStr name, const wxColour& col )
    {
        m_propGrid.SetPropertyColour ( GetPropertyByName(name), col );
    }

    /** Sets background colour of property and all its children to the default. */
    inline void SetPropertyColourToDefault ( wxPGId id )
    {
        m_propGrid.SetColourIndex ( wxPGIdToPtr(id), 0 );
    }
    inline void SetPropertyColourToDefault ( wxPGNameStr name )
    {
        m_propGrid.SetColourIndex ( wxPGIdToPtr(GetPropertyByName(name)), 0 );
    }

    /** Property is be hidden/shown when hider button is toggled or
        when wxPropertyGridManager::Compact is called.
    */
    void SetPropertyPriority ( wxPGId id, int priority );
    void SetPropertyPriority ( wxPGNameStr name, int priority );

    void SetPropertyValue ( wxPGId id, long value );
    void SetPropertyValue ( wxPGId id, int value );
    void SetPropertyValue ( wxPGId id, double value );
    void SetPropertyValue ( wxPGId id, bool value );
    void SetPropertyValue ( wxPGId id, const wxString& value );
    void SetPropertyValue ( wxPGId id, const wxArrayString& value );
    void SetPropertyValue ( wxPGId id, wxObject* value );
    void SetPropertyValue ( wxPGId id, void* value );
    void SetPropertyValue ( wxPGId id, wxVariant& value );
    void SetPropertyValue ( wxPGNameStr name, long value );
    void SetPropertyValue ( wxPGNameStr name, int value );
    void SetPropertyValue ( wxPGNameStr name, double value );
    void SetPropertyValue ( wxPGNameStr name, bool value );
    void SetPropertyValue ( wxPGNameStr name, const wxString& value );
    void SetPropertyValue ( wxPGNameStr name, const wxArrayString& value );
    void SetPropertyValue ( wxPGNameStr name, wxObject* value );
    void SetPropertyValue ( wxPGNameStr name, void* value );
    void SetPropertyValue ( wxPGNameStr name, wxVariant& value );
    wxPG_IMPLEMENT_PGMAN_METHOD_NORET1(SetPropertyValue,const wxPoint&)
    wxPG_IMPLEMENT_PGMAN_METHOD_NORET1(SetPropertyValue,const wxSize&)
    wxPG_IMPLEMENT_PGMAN_METHOD_NORET1(SetPropertyValue,const wxArrayInt&)

    inline void SetPropertyValue ( wxPGId id, wxObject& value )
    {
        SetPropertyValue(id,&value);
    }

    inline void SetPropertyValue ( wxPGNameStr name, wxObject& value )
    {
        SetPropertyValue(name,&value);
    }

    inline void SetPropertyValue ( wxPGId id, const wxChar* value )
    {
        SetPropertyValue(id,wxString(value));
    }
    inline void SetPropertyValue ( wxPGNameStr name, const wxChar* value )
    {
        SetPropertyValue(name,wxString(value));
    }

    /** Sets various property values from a list of wxVariants. If property with
        name is missing from the grid, new property is created under given default
        category (or root if omitted). Works on target page.
    */
    void SetPropertyValues ( const wxList& list, wxPGId default_category )
    {
        m_targetState->SetPropertyValues(list,default_category);
    }

    inline void SetPropertyValues ( const wxVariant& list, wxPGId default_category )
    {
        SetPropertyValues (list.GetList(),default_category);
    }
    inline void SetPropertyValues ( const wxList& list, const wxString& default_category = wxEmptyString )
    {
        SetPropertyValues (list,GetPropertyByName(default_category));
    }
    inline void SetPropertyValues ( const wxVariant& list, const wxString& default_category = wxEmptyString )
    {
        SetPropertyValues (list.GetList(),GetPropertyByName(default_category));
    }

    /** Sets property's value to unspecified. If it has children (it may be category),
        then the same thing is done to them.
    */
    void SetPropertyValueUnspecified ( wxPGId id );
    void SetPropertyValueUnspecified ( wxPGNameStr name );

    /** Synonyme for SelectPage(index). */
    //inline void SetSelection ( int index ) { SelectPage(index); }

    /** Synonyme for SelectPage(name). */
    inline void SetStringSelection ( const wxChar* name )
    {
        SelectPage ( GetPageByName(name) );
    }

    /** Sets page to which append, insert, etc. will add items.
        Every time a page is changed, target page is automatically
        switched to that.
    */
    void SetTargetPage ( int index );

    /** Sets page to which append, insert, etc. will add items.
        Every time a page is changed, target page is automatically
        switched to that.
    */
    inline void SetTargetPage ( const wxChar* name )
    {
        SetTargetPage ( GetPageByName(name) );
    }

    /** Sorts all items at all levels of the target page (except sub-properties). */
    inline void Sort ()
    {
        m_propGrid.Sort(wxPGIdGen(m_targetState->m_properties));
    }

    /** Sorts children of a category.
    */
    inline void Sort ( wxPGId id )
    {
        m_propGrid.Sort(id);
    }

    /** Sorts children of a category.
    */
    inline void Sort ( wxPGNameStr name )
    {
        m_propGrid.Sort ( GetPropertyByName(name) );
    }

    /** Toggles priority of a property between wxPG_HIGH and wxPG_LOW.
    */
    inline void TogglePropertyPriority ( wxPGId id )
    {
        int priority = wxPG_LOW;
        if ( GetPropertyPriority(id) == wxPG_LOW )
            priority = wxPG_HIGH;
        SetPropertyPriority(id,priority);
    }

    /** Toggles priority of a property between wxPG_HIGH and wxPG_LOW.
    */
    inline void TogglePropertyPriority ( wxPGNameStr name )
    {
        TogglePropertyPriority(GetPropertyByName(name));
    }

    /** Deselect current selection, if any (from current page). */
    inline void ClearSelection ()
    {
        m_propGrid.ClearSelection ();
    }

#ifdef _WX_WINDOW_H_BASE_

    //
    // Overridden functions - no documentation required.
    //

    virtual wxSize DoGetBestSize() const;
    void SetId( wxWindowID winid );

    virtual void Freeze();
    virtual void Thaw();
    virtual void SetExtraStyle ( long exStyle );
    virtual bool SetFont ( const wxFont& font );
    virtual void SetWindowStyleFlag ( long style );

    //
    // Event handlers
    //
    void OnMouseMove ( wxMouseEvent &event );
    void OnMouseClick ( wxMouseEvent &event );
    void OnMouseUp ( wxMouseEvent &event );
    void OnMouseEntry ( wxMouseEvent &event );

    void OnPaint ( wxPaintEvent &event );

    void OnToolbarClick ( wxCommandEvent &event );
    void OnResize ( wxSizeEvent& event );
    void OnCompactorClick ( wxCommandEvent& event );
    void OnPropertyGridSelect ( wxPropertyGridEvent& event );

protected:

    wxPropertyGrid  m_propGrid;

    wxArrayPtrVoid  m_arrPages;

#if wxUSE_TOOLBAR
    wxToolBar*      m_pToolbar;
    //wxBitmap*       m_pBmpCatMode;
    //wxBitmap*       m_pBmpNonCatMode;
#endif
    wxStaticText*   m_pTxtHelpCaption;
    wxStaticText*   m_pTxtHelpContent;
    wxButton*       m_pButCompactor;

    //wxWindow*       m_splitterPrevDrawnWin;

    wxPropertyGridState*    m_targetState;

    long            m_iFlags;

    // Selected page index.
    int             m_selPage;

    int             m_width;

    int             m_height;

    int             m_extraHeight;

    int             m_splitterY;

    int             m_splitterHeight;

    int             m_nextTbInd;

    int             m_dragOffset;

    wxCursor        m_cursorSizeNS;

    int             m_nextDescBoxSize;

    unsigned char   m_dragStatus;

    unsigned char   m_onSplitter;

    bool EnsureVisible ( wxPGId id, wxPropertyGridState* parent_state );

    virtual wxPGId DoGetPropertyByName ( wxPGNameStr name ) const;

    wxPGId GetPropertyByName2 ( wxPGNameStr name, wxPropertyGridState** ppState = (wxPropertyGridState**) NULL ) const;

    // Sets some members to defaults.
	void Init1();

    // Initializes some members.
	void Init2( int style );

    /** Recalculates new positions for components, according to the
        given size.
    */
    void RecalculatePositions ( int width, int height );

    /** (Re)creates/destroys controls, according to the window style bits. */
    void RecreateControls ();

    void RefreshHelpBox ( int new_splittery, int new_width, int new_height );

    void RepaintSplitter ( int new_splittery, int new_width, int new_height, bool desc_too );

    void SetDescribedProperty ( wxPGProperty* p );

    inline wxPropertyGridPageData* GetPage ( size_t ind ) const
    {
        return (wxPropertyGridPageData*)m_arrPages.Item(ind);
    }

#endif

private:
    DECLARE_EVENT_TABLE()
};

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

#ifndef __wxPG_SOURCE_FILE__
# undef wxPG_IPAM_DECL
# undef wxPG_IMPLEMENT_PGMAN_METHOD_NORET1
#endif

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

#endif // _WX_PROPGRID_MANAGER_H_

⌨️ 快捷键说明

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