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

📄 propgrid.h

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

#ifndef __WX_PROPGRID_H__
#define __WX_PROPGRID_H__

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

/*

  -- IMPORTANT API NOTES --

  * Intermediate property classes that should only be inherited from
    have names that begin with wxPG (for example, wxPGProperty and
    wxPGPropertyWithChildren).

*/

#include <wx/dynarray.h>

#include <wx/hashmap.h>

#include <wx/variant.h>

#include <wx/tooltip.h>

//#include <wx/validate.h>

// Doxygen special
#if !defined(_WX_WINDOW_H_BASE_) && !defined(SWIG)
# include "pg_dox_mainpage.h"
#endif

// Custom version information (takes CVS(i.e. subrelease) into account)
#define wxPG_WX_VERSION ((wxMAJOR_VERSION*100)+(wxMINOR_VERSION*10)+(wxRELEASE_NUMBER+wxSUBRELEASE_NUMBER))

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


//
// Here are some platform dependent defines
// NOTE: More in propertygrid.cpp
//

#ifndef SWIG
#if defined(__WXMSW__)
    // tested

    #define wxPG_XBEFORETEXT            5 // space between vertical line and value text
    #define wxPG_XBEFOREWIDGET          1 // space between vertical line and value editor control

    #define wxPG_ICON_WIDTH             9 // comment to use bitmap buttons
    #define wxPG_USE_RENDERER_NATIVE    0 // 1 if wxRendererNative should be employed

# if defined(__WXWINCE__)
    #define wxPG_DOUBLE_BUFFER          0 // 1 to use double-buffer that guarantees flicker-free painting
# else
    #define wxPG_DOUBLE_BUFFER          1 // 1 to use double-buffer that guarantees flicker-free painting
# endif

    #define wxPG_HEAVY_GFX              1 // 1 for prettier appearance

#ifndef wxPG_USE_CUSTOM_CONTROLS
    #define wxPG_USE_CUSTOM_CONTROLS    0 // 1 to use wxCustomControls instead native ones (usually better)
#endif

    #define wxPG_SUPPORT_TOOLTIPS       1 // Enable tooltips

#elif defined(__WXGTK__)
    // tested

    #define wxPG_XBEFORETEXT            6 // space between vertical line and value text
    #define wxPG_XBEFOREWIDGET          1 // space between vertical line and value editor control

    #define wxPG_ICON_WIDTH             9 // comment to use bitmap buttons
    #define wxPG_USE_RENDERER_NATIVE    0 // 1 if wxRendererNative should be employed

    #define wxPG_DOUBLE_BUFFER          1 // 1 to use double-buffer that guarantees flicker-free painting

    #define wxPG_HEAVY_GFX              1 // 1 for prettier appearance

#ifndef wxPG_USE_CUSTOM_CONTROLS
    #define wxPG_USE_CUSTOM_CONTROLS    0 // 1 to use wxCustomControls instead native ones (usually better)
#endif

    #define wxPG_SUPPORT_TOOLTIPS       1  // Enable tooltips

#elif defined(__WXMAC__)
    // *not* tested

    #define wxPG_XBEFORETEXT            5 // space between vertical line and value text
    #define wxPG_XBEFOREWIDGET          1 // space between vertical line and value editor widget

    #define wxPG_ICON_WIDTH             11  // comment to use bitmap buttons
    #define wxPG_USE_RENDERER_NATIVE    1 // 1 if wxRendererNative should be employed

    #define wxPG_DOUBLE_BUFFER          0 // 1 to use double-buffer that guarantees flicker-free painting

    #define wxPG_HEAVY_GFX              1 // 1 for prettier appearance

#ifndef wxPG_USE_CUSTOM_CONTROLS
    #define wxPG_USE_CUSTOM_CONTROLS    0 // 1 to use wxCustomControls instead native ones (usually better)
#endif

    #define wxPG_SUPPORT_TOOLTIPS       1  // Enable tooltips

#else
    // defaults
    // tested on: none.

    #define wxPG_XBEFORETEXT            6 // space between vertical line and value text
    #define wxPG_XBEFOREWIDGET          1 // space between vertical line and value editor widget

    #define wxPG_ICON_WIDTH             9 // comment to use bitmap buttons
    #define wxPG_USE_RENDERER_NATIVE    0 // 1 if wxRendererNative should be employed

    #define wxPG_DOUBLE_BUFFER          0 // 1 to use double-buffer that guarantees flicker-free painting

    #define wxPG_HEAVY_GFX              0 // 1 for prettier appearance

#ifndef wxPG_USE_CUSTOM_CONTROLS
    #define wxPG_USE_CUSTOM_CONTROLS    1 // 1 to use wxCustomControls instead native ones (usually better)
#endif

    #define wxPG_SUPPORT_TOOLTIPS       0  // Enable tooltips

#endif

#endif // SWIG

// Undefine wxPG_ICON_WIDTH to use supplied xpm bitmaps instead
// (for tree buttons)
//#undef wxPG_ICON_WIDTH

// Need to force disable tooltips?
#if !wxUSE_TOOLTIPS
# undef wxPG_SUPPORT_TOOLTIPS
# define wxPG_SUPPORT_TOOLTIPS       0
#endif

// Set 1 to include basic properties ( ~48k in 0.9.9.2 )
#define wxPG_INCLUDE_BASICPROPS         1

// Set 1 to include advanced properties (wxFontProperty, wxColourProperty, etc.) ( ~32k in 0.9.9.2 )
#define wxPG_INCLUDE_ADVPROPS           1

// Set 1 include wxPropertyGridManager ( ~36k in 0.9.9.1 )
//#define wxPG_INCLUDE_MANAGER            1

// Set 1 to include checkbox editor class ( ~4k in 0.9.9.1 )
#define wxPG_INCLUDE_CHECKBOX           1

// 1 to allow user data for each property
#define wxPG_USE_CLIENT_DATA            1

// 1 to allow per-property validators
#define wxPG_USE_VALIDATORS             0

// NOTE: Currently advantages granted by wxPG_EMBED_VARIANT are probably minimal.
#define wxPG_EMBED_VARIANT              0 // 1 if wxVariant is in wxPGProperty (should be better if used a lot)

// NOTE: Use this only if you really need wxDynamicCast etc. Property class name
//   can be acquired with wxPropertyGrid::GetPropertyClassName() anyway.
// ALSO NOTE: Causes quite a code size increase (~20k in main object file) considering what
//   it does.
#define wxPG_INCLUDE_WXOBJECT           0 // 1 if inherit wxPGProperty from wxObject - always 1 if wxPG_EMBED_VARIANT

#if wxPG_EMBED_VARIANT
# error "wxPG_EMBED_VARIANT is currently broken."
# undef wxPG_INCLUDE_WXOBJECT
# define wxPG_INCLUDE_WXOBJECT           1
#endif

//
// To have same native colour scheme calculation as in version
// 1.0.3 and earlier, set this to 0.
#define wxPG_NEW_COLOUR_SCHEME           1


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

// Our very custom dynamic object macros. Should only be used
// directly in an abstract (typeless etc.) base property classes.
#if wxPG_INCLUDE_WXOBJECT
# error "wxPG_INCLUDE_WXOBJECT is not currently supported (as of 1.0.0b)."
//# define _WX_PG_DECLARE_PROPERTY_CLASS(A)       DECLARE_CLASS(A)
//# define _WX_PG_IMPLEMENT_PROPERTY_CLASS(A,B)   IMPLEMENT_CLASS(A,B)
# define WX_PG_DECLARE_GETCLASSNAME()
#else
//# define _WX_PG_DECLARE_PROPERTY_CLASS(A)
//# define _WX_PG_IMPLEMENT_PROPERTY_CLASS(A,B)
# define WX_PG_DECLARE_GETCLASSNAME()          virtual const wxChar* GetClassName() const;
#endif

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

#ifdef WXMAKINGDLL_PROPGRID
    #define WXDLLIMPEXP_PG WXEXPORT
//#elif defined(WXUSINGDLL)
//    #define WXDLLIMPEXP_PG WXIMPORT
#else // not making nor using DLL
    #define WXDLLIMPEXP_PG
#endif

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

#if wxPG_USE_CUSTOM_CONTROLS
# include "wx/propgrid/custctrl.h"
# define wxPGCtrlClass wxCustomControl
#else
# define wxPGCtrlClass wxWindow
# if !wxPG_USE_GENERIC_TEXTCTRL
#  define wxCCustomTextCtrl wxTextCtrl
# else
#  include "wx/propgrid/custctrl.h"
#  define wxCCustomTextCtrl wxGenericTextCtrl
# endif
//# define wxCCustomComboBox wxComboBox
class WXDLLEXPORT wxPGComboBox;
# define wxCCustomComboBox wxPGComboBox
# define wxCCustomButton wxButton
#endif

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

#ifndef SWIG
class  WXDLLIMPEXP_PG wxPGVariant;
class  WXDLLIMPEXP_PG wxPGValueType;
class  WXDLLIMPEXP_PG wxPGEditor;
class  WXDLLIMPEXP_PG wxPGProperty;
class  WXDLLIMPEXP_PG wxPGPropertyWithChildren;
class  WXDLLIMPEXP_PG wxPropertyCategoryClass;
class  WXDLLIMPEXP_PG wxPGConstants;
class  WXDLLIMPEXP_PG wxPropertyGridState;
class  WXDLLIMPEXP_PG wxPropertyGrid;
class  WXDLLIMPEXP_PG wxPropertyGridEvent;
class  WXDLLIMPEXP_PG wxPropertyGridManager;
#endif

struct wxPGPaintData;

extern WXDLLIMPEXP_PG const wxChar *wxPropertyGridNameStr;

/** @defgroup miscellaneous wxPropertyGrid Miscellanous
    This section describes some miscellanous values, types and macros.
    @{
*/

/** Used to tell wxPGProperty to use label as name as well. */
#define wxPG_LABEL (*((const wxString*)NULL))

/** Convert Red, Green and Blue to a single 32-bit value.
*/
#define wxPG_COLOUR(R,G,B) ((wxUint32)(R+(G<<8)+(B<<16)))

/** Return this in GetImageSize() to indicate that the property
    custom paint is flexible. That is, it will paint (dropdown)
    list items with PREFWID,PREFHEI size, and in with required
    default size in the value cell.
*/
#define wxPG_FLEXIBLE_SIZE(PREFWID,PREFHEI) wxSize(-(PREFWID),-(PREFHEI))

/** This callback function is used by atleast wxCustomProperty
    to facilitiate easy custom action on button press.
    \param propGrid
    related wxPropertyGrid
    \param property
    related wxPGProperty
    \param ctrl
    If not NULL (for example, not selected), a wxWindow* or equivalent
    \param data
    Value depends on the context.
    \retval
    True if changed value of the property.
*/
typedef bool (*wxPropertyGridCallback)(wxPropertyGrid* propGrid,
                                       wxPGProperty* property,
                                       wxPGCtrlClass* ctrl,
                                       int data);

/** This callback function is used by atleast wxCustomProperty
    to facilitiate drawing items in drop down list.

    Works very much like wxPGProperty::OnCustomPaint.
*/
typedef void (*wxPGPaintCallback)(wxPGProperty* property,
                                  wxDC& dc,
                                  const wxRect& rect,
                                  wxPGPaintData& paintdata);


/** @}
*/

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

/** @defgroup wndflags wxPropertyGrid Window Styles
    SetWindowStyleFlag method can be used to modify some of these at run-time.
    @{
*/
/** This will cause Sort() automatically after an item is added.
    When inserting a lot of items in this mode, it may make sense to
    use Freeze() before operations and Thaw() afterwards to increase
    performance.
*/
#define wxPG_AUTO_SORT              0x00000010

/** Categories are not initially shown (even if added).
    IMPORTANT NOTE: If you do not plan to use categories, then this
    style will result in waste of resources.
    This flag can also be changed using wxPropertyGrid::EnableCategories method.
*/
#define wxPG_HIDE_CATEGORIES        0x00000020

/* This style combines non-categoric mode and automatic sorting.
*/
#define wxPG_ALPHABETIC_MODE        (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT)

/** Modified values are shown in bold font. Changing this requires Refresh()
    to show changes.
*/
#define wxPG_BOLD_MODIFIED          0x00000040

/** When wxPropertyGrid is resized, splitter moves to the center. This
    behaviour stops once the user manually moves the splitter.
*/
#define wxPG_SPLITTER_AUTO_CENTER   0x00000080

/** Display tooltips for cell text that cannot be shown completely. If
    wxUSE_TOOLTIPS is 0, then this doesn't have any effect.
*/
#define wxPG_TOOLTIPS               0x00000100

/** Disables margin and hides all expand/collapse buttons that would appear
    outside the margin (for sub-properties). Toggling this style automatically
    expands all collapsed items.
*/
#define wxPG_HIDE_MARGIN            0x00000200

/** This style prevents user from moving the splitter.
*/
#define wxPG_STATIC_SPLITTER        0x00000400

/** Combination of other styles that make it impossible for user to modify
    the layout.
*/
#define wxPG_STATIC_LAYOUT          (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER)

/** Disables wxTextCtrl based editors for properties which
    can be edited in another way. Equals calling wxPropertyGrid::LimitPropertyEditing
    for all added properties.
*/
#define wxPG_LIMITED_EDITING        0x00000800

/** wxPropertyGridManager only: Show toolbar for mode and page selection. */
#define wxPG_TOOLBAR                0x00001000

/** wxPropertyGridManager only: Show adjustable text box showing description
    or help text, if available, for currently selected property.
*/
#define wxPG_DESCRIPTION            0x00002000

/** wxPropertyGridManager only: Show compactor button that toggles hidden
    state of low-priority properties.
*/
#define wxPG_COMPACTOR              0x00004000

/** Speeds up switching to wxPG_HIDE_CATEGORIES mode. Initially, if wxPG_HIDE_CATEGORIES
    is not defined, the non-categorized data storage is not activated, and switching
    the mode first time becomes somewhat slower. wxPG_EX_INIT_NOCAT activates the

⌨️ 快捷键说明

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