2008-09-12 20:57:41 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/propgrid/propgrid.h
|
|
|
|
// Purpose: wxPropertyGrid
|
|
|
|
// Author: Jaakko Salli
|
|
|
|
// Modified by:
|
|
|
|
// Created: 2004-09-25
|
|
|
|
// Copyright: (c) Jaakko Salli
|
2010-07-13 13:29:13 +00:00
|
|
|
// Licence: wxWindows licence
|
2008-09-12 20:57:41 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_PROPGRID_PROPGRID_H_
|
|
|
|
#define _WX_PROPGRID_PROPGRID_H_
|
|
|
|
|
2019-08-16 00:27:07 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
2008-09-17 15:00:00 +00:00
|
|
|
#if wxUSE_PROPGRID
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
#include "wx/scrolwin.h"
|
2010-03-29 18:17:55 +00:00
|
|
|
#include "wx/recguard.h"
|
2015-04-06 21:40:54 +00:00
|
|
|
#include "wx/time.h" // needed for wxMilliClock_t
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
#include "wx/propgrid/property.h"
|
|
|
|
#include "wx/propgrid/propgridiface.h"
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SWIG
|
2008-11-02 22:16:14 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_PROPGRID(const char) wxPropertyGridNameStr[];
|
2008-09-12 20:57:41 +00:00
|
|
|
#endif
|
|
|
|
|
2008-11-15 10:34:36 +00:00
|
|
|
class wxPGComboBox;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2010-07-11 20:00:44 +00:00
|
|
|
#if wxUSE_STATUSBAR
|
|
|
|
class WXDLLIMPEXP_FWD_CORE wxStatusBar;
|
|
|
|
#endif
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
// Global variables
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// This is required for sharing common global variables.
|
|
|
|
class WXDLLIMPEXP_PROPGRID wxPGGlobalVarsClass
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxPGGlobalVarsClass();
|
|
|
|
~wxPGGlobalVarsClass();
|
|
|
|
|
2009-09-28 06:25:44 +00:00
|
|
|
#if wxUSE_THREADS
|
2009-09-27 14:35:02 +00:00
|
|
|
// Critical section for handling the globals. Generally it is not needed
|
|
|
|
// since GUI code is supposed to be in single thread. However,
|
|
|
|
// we do want the user to be able to convey wxPropertyGridEvents to other
|
|
|
|
// threads.
|
|
|
|
wxCriticalSection m_critSect;
|
|
|
|
#endif
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// Used by advprops, but here to make things easier.
|
|
|
|
wxString m_pDefaultImageWildcard;
|
|
|
|
|
|
|
|
// Map of editor class instances (keys are name string).
|
|
|
|
wxPGHashMapS2P m_mapEditorClasses;
|
|
|
|
|
|
|
|
#if wxUSE_VALIDATORS
|
2008-09-30 17:23:27 +00:00
|
|
|
wxVector<wxValidator*> m_arrValidators; // These wxValidators need to be freed
|
2008-09-12 20:57:41 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
wxPGHashMapS2P m_dictPropertyClassInfo; // PropertyName -> ClassInfo
|
|
|
|
|
|
|
|
wxPGChoices* m_fontFamilyChoices;
|
|
|
|
|
|
|
|
// Replace with your own to affect all properties using default renderer.
|
|
|
|
wxPGCellRenderer* m_defaultRenderer;
|
|
|
|
|
|
|
|
wxPGChoices m_boolChoices;
|
|
|
|
|
2015-01-22 17:32:48 +00:00
|
|
|
// Some shared variants
|
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
2008-09-12 20:57:41 +00:00
|
|
|
wxVariant m_vEmptyString;
|
|
|
|
wxVariant m_vZero;
|
|
|
|
wxVariant m_vMinusOne;
|
|
|
|
wxVariant m_vTrue;
|
|
|
|
wxVariant m_vFalse;
|
2015-01-22 17:32:48 +00:00
|
|
|
#else
|
|
|
|
const wxVariant m_vEmptyString;
|
|
|
|
const wxVariant m_vZero;
|
|
|
|
const wxVariant m_vMinusOne;
|
|
|
|
const wxVariant m_vTrue;
|
|
|
|
const wxVariant m_vFalse;
|
|
|
|
#endif // WXWIN_COMPATIBILITY_3_0
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
// Cached constant strings
|
2015-01-22 17:32:48 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
2008-09-16 15:55:53 +00:00
|
|
|
wxPGCachedString m_strstring;
|
|
|
|
wxPGCachedString m_strlong;
|
|
|
|
wxPGCachedString m_strbool;
|
|
|
|
wxPGCachedString m_strlist;
|
|
|
|
|
2009-05-31 08:58:38 +00:00
|
|
|
wxPGCachedString m_strDefaultValue;
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGCachedString m_strMin;
|
|
|
|
wxPGCachedString m_strMax;
|
|
|
|
wxPGCachedString m_strUnits;
|
2009-12-26 10:45:04 +00:00
|
|
|
wxPGCachedString m_strHint;
|
2015-01-22 17:32:48 +00:00
|
|
|
#else
|
|
|
|
const wxString m_strstring;
|
|
|
|
const wxString m_strlong;
|
|
|
|
const wxString m_strbool;
|
|
|
|
const wxString m_strlist;
|
|
|
|
|
|
|
|
const wxString m_strDefaultValue;
|
|
|
|
const wxString m_strMin;
|
|
|
|
const wxString m_strMax;
|
|
|
|
const wxString m_strUnits;
|
|
|
|
const wxString m_strHint;
|
|
|
|
#endif // WXWIN_COMPATIBILITY_3_0
|
|
|
|
|
2009-12-26 10:45:04 +00:00
|
|
|
#if wxPG_COMPATIBILITY_1_4
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGCachedString m_strInlineHelp;
|
2009-12-26 10:45:04 +00:00
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
// If true then some things are automatically translated
|
|
|
|
bool m_autoGetTranslation;
|
|
|
|
|
|
|
|
// > 0 if errors cannot or should not be shown in statusbar etc.
|
|
|
|
int m_offline;
|
|
|
|
|
|
|
|
int m_extraStyle; // global extra style
|
|
|
|
|
|
|
|
int m_warnings;
|
|
|
|
|
|
|
|
int HasExtraStyle( int style ) const { return (m_extraStyle & style); }
|
|
|
|
};
|
|
|
|
|
2010-01-26 17:44:51 +00:00
|
|
|
extern WXDLLIMPEXP_DATA_PROPGRID(wxPGGlobalVarsClass*) wxPGGlobalVars;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
#define wxPGVariant_EmptyString (wxPGGlobalVars->m_vEmptyString)
|
|
|
|
#define wxPGVariant_Zero (wxPGGlobalVars->m_vZero)
|
|
|
|
#define wxPGVariant_MinusOne (wxPGGlobalVars->m_vMinusOne)
|
|
|
|
#define wxPGVariant_True (wxPGGlobalVars->m_vTrue)
|
|
|
|
#define wxPGVariant_False (wxPGGlobalVars->m_vFalse)
|
|
|
|
|
|
|
|
#define wxPGVariant_Bool(A) (A?wxPGVariant_True:wxPGVariant_False)
|
|
|
|
|
2009-05-30 10:49:05 +00:00
|
|
|
// When wxPG is loaded dynamically after the application is already running
|
|
|
|
// then the built-in module system won't pick this one up. Add it manually.
|
|
|
|
WXDLLIMPEXP_PROPGRID void wxPGInitResourceModule();
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// SetWindowStyleFlag method can be used to modify some of these at run-time.
|
2008-09-12 20:57:41 +00:00
|
|
|
enum wxPG_WINDOW_STYLES
|
|
|
|
{
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 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.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_AUTO_SORT = 0x00000010,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Categories are not initially shown (even if added).
|
|
|
|
// IMPORTANT NOTE: If you do not plan to use categories, then this
|
|
|
|
// style will waste resources.
|
|
|
|
// This flag can also be changed using wxPropertyGrid::EnableCategories method.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_HIDE_CATEGORIES = 0x00000020,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// This style combines non-categoric mode and automatic sorting.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ALPHABETIC_MODE = (wxPG_HIDE_CATEGORIES|wxPG_AUTO_SORT),
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Modified values are shown in bold font. Changing this requires Refresh()
|
|
|
|
// to show changes.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_BOLD_MODIFIED = 0x00000040,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// When wxPropertyGrid is resized, splitter moves to the center. This
|
|
|
|
// behaviour stops once the user manually moves the splitter.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_SPLITTER_AUTO_CENTER = 0x00000080,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Display tooltips for cell text that cannot be shown completely. If
|
|
|
|
// wxUSE_TOOLTIPS is 0, then this doesn't have any effect.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_TOOLTIPS = 0x00000100,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 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.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_HIDE_MARGIN = 0x00000200,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// This style prevents user from moving the splitter.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_STATIC_SPLITTER = 0x00000400,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Combination of other styles that make it impossible for user to modify
|
|
|
|
// the layout.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_STATIC_LAYOUT = (wxPG_HIDE_MARGIN|wxPG_STATIC_SPLITTER),
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Disables wxTextCtrl based editors for properties which
|
|
|
|
// can be edited in another way.
|
|
|
|
// Equals calling wxPropertyGrid::LimitPropertyEditing for all added
|
|
|
|
// properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_LIMITED_EDITING = 0x00000800,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPropertyGridManager only: Show toolbar for mode and page selection.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_TOOLBAR = 0x00001000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPropertyGridManager only: Show adjustable text box showing description
|
|
|
|
// or help text, if available, for currently selected property.
|
2009-09-11 11:49:03 +00:00
|
|
|
wxPG_DESCRIPTION = 0x00002000,
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPropertyGridManager only: don't show an internal border around the
|
|
|
|
// property grid. Recommended if you use a header.
|
2015-05-23 16:25:27 +00:00
|
|
|
wxPG_NO_INTERNAL_BORDER = 0x00004000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// A mask which can be used to filter (out) all styles.
|
2015-05-23 16:25:27 +00:00
|
|
|
wxPG_WINDOW_STYLE_MASK = wxPG_AUTO_SORT|wxPG_HIDE_CATEGORIES|wxPG_BOLD_MODIFIED|
|
|
|
|
wxPG_SPLITTER_AUTO_CENTER|wxPG_TOOLTIPS|wxPG_HIDE_MARGIN|
|
|
|
|
wxPG_STATIC_SPLITTER|wxPG_LIMITED_EDITING|wxPG_TOOLBAR|
|
|
|
|
wxPG_DESCRIPTION|wxPG_NO_INTERNAL_BORDER
|
2008-09-12 20:57:41 +00:00
|
|
|
};
|
|
|
|
|
2009-09-14 15:17:50 +00:00
|
|
|
#if wxPG_COMPATIBILITY_1_4
|
|
|
|
// In wxPG 1.4 this was used to enable now-default theme border support
|
|
|
|
// in wxPropertyGridManager.
|
|
|
|
#define wxPG_THEME_BORDER 0x00000000
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// NOTE: wxPG_EX_xxx are extra window styles and must be set using
|
|
|
|
// SetExtraStyle() member function.
|
2008-09-12 20:57:41 +00:00
|
|
|
enum wxPG_EX_WINDOW_STYLES
|
|
|
|
{
|
2016-06-23 20:02:57 +00:00
|
|
|
// 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 non-categorized data storage right away.
|
|
|
|
// NOTE: If you do plan not switching to non-categoric mode, or if
|
|
|
|
// you don't plan to use categories at all, then using this style will result
|
|
|
|
// in waste of resources.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_INIT_NOCAT = 0x00001000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Extended window style that sets wxPropertyGridManager toolbar to not
|
|
|
|
// use flat style.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_NO_FLAT_TOOLBAR = 0x00002000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Shows alphabetic/categoric mode buttons from toolbar.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_MODE_BUTTONS = 0x00008000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Show property help strings as tool tips instead as text on the status bar.
|
|
|
|
// You can set the help strings using SetPropertyHelpString member function.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_HELP_AS_TOOLTIPS = 0x00010000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Prevent TAB from focusing to wxButtons. This behaviour was default
|
|
|
|
// in version 1.2.0 and earlier.
|
|
|
|
// NOTE! Tabbing to button doesn't work yet. Problem seems to be that on wxMSW
|
|
|
|
// at least the button doesn't properly propagate key events (yes, I'm using
|
|
|
|
// wxWANTS_CHARS).
|
2008-09-12 20:57:41 +00:00
|
|
|
//wxPG_EX_NO_TAB_TO_BUTTON = 0x00020000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Allows relying on native double-buffering.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_NATIVE_DOUBLE_BUFFERING = 0x00080000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set this style to let user have ability to set values of properties to
|
|
|
|
// unspecified state. Same as setting wxPG_PROP_AUTO_UNSPECIFIED for
|
|
|
|
// all properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_AUTO_UNSPECIFIED_VALUES = 0x00200000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// If this style is used, built-in attributes (such as wxPG_FLOAT_PRECISION
|
|
|
|
// and wxPG_STRING_PASSWORD) are not stored into property's attribute storage
|
|
|
|
// (thus they are not readable).
|
|
|
|
// Note that this option is global, and applies to all wxPG property
|
|
|
|
// containers.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES = 0x00400000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Hides page selection buttons from toolbar.
|
2009-08-17 18:36:00 +00:00
|
|
|
wxPG_EX_HIDE_PAGE_BUTTONS = 0x01000000,
|
2009-08-21 10:41:26 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Allows multiple properties to be selected by user (by pressing SHIFT
|
|
|
|
// when clicking on a property, or by dragging with left mouse button
|
|
|
|
// down).
|
|
|
|
// You can get array of selected properties with
|
|
|
|
// wxPropertyGridInterface::GetSelectedProperties(). In multiple selection
|
|
|
|
// mode wxPropertyGridInterface::GetSelection() returns
|
|
|
|
// property which has editor active (usually the first one
|
|
|
|
// selected). Other useful member functions are ClearSelection(),
|
|
|
|
// AddToSelection() and RemoveFromSelection().
|
2009-08-29 08:09:45 +00:00
|
|
|
wxPG_EX_MULTIPLE_SELECTION = 0x02000000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// This enables top-level window tracking which allows wxPropertyGrid to
|
|
|
|
// notify the application of last-minute property value changes by user.
|
|
|
|
// This style is not enabled by default because it may cause crashes when
|
|
|
|
// wxPropertyGrid is used in with wxAUI or similar system.
|
|
|
|
// Note: If you are not in fact using any system that may change
|
|
|
|
// wxPropertyGrid's top-level parent window on its own, then you
|
|
|
|
// are recommended to enable this style.
|
2009-09-11 11:49:03 +00:00
|
|
|
wxPG_EX_ENABLE_TLP_TRACKING = 0x04000000,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Don't show divider above toolbar, on Windows.
|
2009-09-11 16:41:31 +00:00
|
|
|
wxPG_EX_NO_TOOLBAR_DIVIDER = 0x08000000,
|
2009-09-11 11:49:03 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Show a separator below the toolbar.
|
2015-05-21 16:51:08 +00:00
|
|
|
wxPG_EX_TOOLBAR_SEPARATOR = 0x10000000,
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Allows to take focus on the entire area (on canvas)
|
|
|
|
// even if wxPropertyGrid is not a standalone control.
|
2015-05-21 16:51:08 +00:00
|
|
|
wxPG_EX_ALWAYS_ALLOW_FOCUS = 0x00100000,
|
|
|
|
|
2017-10-18 20:58:21 +00:00
|
|
|
|
|
|
|
// A mask which can be used to filter (out) all extra styles applicable to wxPropertyGrid.
|
|
|
|
wxPG_EX_WINDOW_PG_STYLE_MASK = wxPG_EX_INIT_NOCAT|wxPG_EX_HELP_AS_TOOLTIPS|wxPG_EX_NATIVE_DOUBLE_BUFFERING|
|
|
|
|
wxPG_EX_AUTO_UNSPECIFIED_VALUES|wxPG_EX_WRITEONLY_BUILTIN_ATTRIBUTES|
|
|
|
|
wxPG_EX_MULTIPLE_SELECTION|wxPG_EX_ENABLE_TLP_TRACKING|wxPG_EX_ALWAYS_ALLOW_FOCUS,
|
|
|
|
|
|
|
|
// A mask which can be used to filter (out) all extra styles applicable to wxPropertyGridManager.
|
|
|
|
wxPG_EX_WINDOW_PGMAN_STYLE_MASK = wxPG_EX_NO_FLAT_TOOLBAR|wxPG_EX_MODE_BUTTONS|wxPG_EX_HIDE_PAGE_BUTTONS|
|
|
|
|
wxPG_EX_NO_TOOLBAR_DIVIDER|wxPG_EX_TOOLBAR_SEPARATOR,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// A mask which can be used to filter (out) all extra styles.
|
2017-10-18 20:58:21 +00:00
|
|
|
wxPG_EX_WINDOW_STYLE_MASK = wxPG_EX_WINDOW_PG_STYLE_MASK|wxPG_EX_WINDOW_PGMAN_STYLE_MASK
|
2008-09-12 20:57:41 +00:00
|
|
|
};
|
|
|
|
|
2009-08-29 08:09:45 +00:00
|
|
|
#if wxPG_COMPATIBILITY_1_4
|
|
|
|
#define wxPG_EX_DISABLE_TLP_TRACKING 0x00000000
|
|
|
|
#endif
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Combines various styles.
|
2008-09-12 20:57:41 +00:00
|
|
|
#define wxPG_DEFAULT_STYLE (0)
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Combines various styles.
|
2008-09-12 20:57:41 +00:00
|
|
|
#define wxPGMAN_DEFAULT_STYLE (0)
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPropertyGrid stores information about common values in these
|
|
|
|
// records.
|
|
|
|
// NB: Common value feature is not complete, and thus not mentioned in
|
|
|
|
// documentation.
|
2008-09-12 20:57:41 +00:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPGCommonValue
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
wxPGCommonValue( const wxString& label, wxPGCellRenderer* renderer )
|
2019-02-25 18:23:35 +00:00
|
|
|
: m_label(label)
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
|
|
|
m_renderer = renderer;
|
|
|
|
renderer->IncRef();
|
|
|
|
}
|
|
|
|
virtual ~wxPGCommonValue()
|
|
|
|
{
|
|
|
|
m_renderer->DecRef();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual wxString GetEditableText() const { return m_label; }
|
|
|
|
const wxString& GetLabel() const { return m_label; }
|
|
|
|
wxPGCellRenderer* GetRenderer() const { return m_renderer; }
|
|
|
|
|
|
|
|
protected:
|
|
|
|
wxString m_label;
|
|
|
|
wxPGCellRenderer* m_renderer;
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-07-23 21:38:39 +00:00
|
|
|
// wxPropertyGrid Validation Failure behaviour Flags
|
2008-09-12 20:57:41 +00:00
|
|
|
enum wxPG_VALIDATION_FAILURE_BEHAVIOR_FLAGS
|
|
|
|
{
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Prevents user from leaving property unless value is valid. If this
|
|
|
|
// behaviour flag is not used, then value change is instead cancelled.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_VFB_STAY_IN_PROPERTY = 0x01,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Calls wxBell() on validation failure.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_VFB_BEEP = 0x02,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Cell with invalid value will be marked (with red colour).
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_VFB_MARK_CELL = 0x04,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Display a text message explaining the situation.
|
|
|
|
// To customize the way the message is displayed, you need to
|
|
|
|
// reimplement wxPropertyGrid::DoShowPropertyError() in a
|
|
|
|
// derived class. Default behaviour is to display the text on
|
|
|
|
// the top-level frame's status bar, if present, and otherwise
|
|
|
|
// using wxMessageBox.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_VFB_SHOW_MESSAGE = 0x08,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
|
|
|
|
// message using wxMessageBox.
|
2010-07-04 08:22:52 +00:00
|
|
|
wxPG_VFB_SHOW_MESSAGEBOX = 0x10,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
|
|
|
|
// message on the status bar (when present - you can reimplement
|
|
|
|
// wxPropertyGrid::GetStatusBar() in a derived class to specify
|
|
|
|
// this yourself).
|
2010-07-04 08:22:52 +00:00
|
|
|
wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Defaults.
|
2010-07-04 08:53:07 +00:00
|
|
|
wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL |
|
|
|
|
wxPG_VFB_SHOW_MESSAGEBOX,
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Only used internally.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_VFB_UNDEFINED = 0x80
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2010-03-20 14:08:34 +00:00
|
|
|
// Having this as define instead of wxByte typedef makes things easier for
|
|
|
|
// wxPython bindings (ignoring and redefining it in SWIG interface file
|
|
|
|
// seemed rather tricky)
|
|
|
|
#define wxPGVFBFlags unsigned char
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Used to convey validation information to and from functions that
|
|
|
|
// actually perform validation. Mostly used in custom property
|
|
|
|
// classes.
|
2008-09-30 15:36:52 +00:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPGValidationInfo
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2008-09-29 16:23:38 +00:00
|
|
|
friend class wxPropertyGrid;
|
|
|
|
public:
|
2010-07-03 11:43:49 +00:00
|
|
|
wxPGValidationInfo()
|
|
|
|
{
|
|
|
|
m_failureBehavior = 0;
|
|
|
|
m_isFailing = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
~wxPGValidationInfo()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns failure behaviour which is a combination of
|
|
|
|
// wxPG_VFB_XXX flags.
|
2008-09-30 15:36:52 +00:00
|
|
|
wxPGVFBFlags GetFailureBehavior() const
|
|
|
|
{ return m_failureBehavior; }
|
2008-09-29 16:07:00 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current failure message.
|
2008-09-29 16:07:00 +00:00
|
|
|
const wxString& GetFailureMessage() const
|
|
|
|
{ return m_failureMessage; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns reference to pending value.
|
2009-09-27 14:35:02 +00:00
|
|
|
wxVariant& GetValue()
|
2008-09-29 16:23:38 +00:00
|
|
|
{
|
|
|
|
wxASSERT(m_pValue);
|
|
|
|
return *m_pValue;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set validation failure behaviour
|
|
|
|
// failureBehavior - Mixture of wxPG_VFB_XXX flags.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetFailureBehavior(wxPGVFBFlags failureBehavior)
|
|
|
|
{ m_failureBehavior = failureBehavior; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set current failure message.
|
2008-09-29 16:34:07 +00:00
|
|
|
void SetFailureMessage(const wxString& message)
|
|
|
|
{ m_failureMessage = message; }
|
2008-09-29 16:23:38 +00:00
|
|
|
|
|
|
|
private:
|
2016-06-23 20:02:57 +00:00
|
|
|
// Value to be validated.
|
2008-09-29 16:23:38 +00:00
|
|
|
wxVariant* m_pValue;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Message displayed on validation failure.
|
2008-09-29 16:23:38 +00:00
|
|
|
wxString m_failureMessage;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Validation failure behaviour. Use wxPG_VFB_XXX flags.
|
2008-09-29 16:23:38 +00:00
|
|
|
wxPGVFBFlags m_failureBehavior;
|
2010-07-03 11:43:49 +00:00
|
|
|
|
|
|
|
// True when validation is currently failing.
|
|
|
|
bool m_isFailing;
|
2008-09-12 20:57:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// These are used with wxPropertyGrid::AddActionTrigger() and
|
|
|
|
// wxPropertyGrid::ClearActionTriggers().
|
2008-09-12 20:57:41 +00:00
|
|
|
enum wxPG_KEYBOARD_ACTIONS
|
|
|
|
{
|
|
|
|
wxPG_ACTION_INVALID = 0,
|
2010-12-22 17:25:45 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Select the next property.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ACTION_NEXT_PROPERTY,
|
2010-12-22 17:25:45 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Select the previous property.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ACTION_PREV_PROPERTY,
|
2010-12-22 17:25:45 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Expand the selected property, if it has child items.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ACTION_EXPAND_PROPERTY,
|
2010-12-22 17:25:45 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Collapse the selected property, if it has child items.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ACTION_COLLAPSE_PROPERTY,
|
2010-12-22 17:25:45 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Cancel and undo any editing done in the currently active property
|
|
|
|
// editor.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ACTION_CANCEL_EDIT,
|
2010-12-22 17:25:45 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Move focus to the editor control of the currently selected
|
|
|
|
// property.
|
2010-12-22 17:25:45 +00:00
|
|
|
wxPG_ACTION_EDIT,
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Causes editor's button (if any) to be pressed.
|
2010-12-22 17:25:45 +00:00
|
|
|
wxPG_ACTION_PRESS_BUTTON,
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPG_ACTION_MAX
|
|
|
|
};
|
2008-11-02 22:16:14 +00:00
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// wxPropertyGrid::DoSelectProperty flags (selFlags)
|
2015-07-16 19:04:25 +00:00
|
|
|
enum wxPG_SELECT_PROPERTY_FLAGS
|
|
|
|
{
|
|
|
|
// Focuses to created editor
|
|
|
|
wxPG_SEL_FOCUS = 0x0001,
|
|
|
|
// Forces deletion and recreation of editor
|
|
|
|
wxPG_SEL_FORCE = 0x0002,
|
|
|
|
// For example, doesn't cause EnsureVisible
|
|
|
|
wxPG_SEL_NONVISIBLE = 0x0004,
|
|
|
|
// Do not validate editor's value before selecting
|
|
|
|
wxPG_SEL_NOVALIDATE = 0x0008,
|
|
|
|
// Property being deselected is about to be deleted
|
|
|
|
wxPG_SEL_DELETING = 0x0010,
|
|
|
|
// Property's values was set to unspecified by the user
|
|
|
|
wxPG_SEL_SETUNSPEC = 0x0020,
|
|
|
|
// Property's event handler changed the value
|
|
|
|
wxPG_SEL_DIALOGVAL = 0x0040,
|
|
|
|
// Set to disable sending of wxEVT_PG_SELECTED event
|
|
|
|
wxPG_SEL_DONT_SEND_EVENT = 0x0080,
|
|
|
|
// Don't make any graphics updates
|
|
|
|
wxPG_SEL_NO_REFRESH = 0x0100
|
|
|
|
};
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2009-12-13 12:00:04 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// DoSetSplitterPosition() flags
|
|
|
|
|
|
|
|
enum wxPG_SET_SPLITTER_POSITION_SPLITTER_FLAGS
|
|
|
|
{
|
|
|
|
wxPG_SPLITTER_REFRESH = 0x0001,
|
|
|
|
wxPG_SPLITTER_ALL_PAGES = 0x0002,
|
|
|
|
wxPG_SPLITTER_FROM_EVENT = 0x0004,
|
|
|
|
wxPG_SPLITTER_FROM_AUTO_CENTER = 0x0008
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// Internal flags
|
2016-03-06 20:19:07 +00:00
|
|
|
enum wxPG_INTERNAL_FLAGS
|
|
|
|
{
|
|
|
|
wxPG_FL_INITIALIZED = 0x0001,
|
|
|
|
// Set when creating editor controls if it was clicked on.
|
|
|
|
wxPG_FL_ACTIVATION_BY_CLICK = 0x0002,
|
|
|
|
wxPG_FL_DONT_CENTER_SPLITTER = 0x0004,
|
|
|
|
wxPG_FL_FOCUSED = 0x0008,
|
|
|
|
wxPG_FL_MOUSE_CAPTURED = 0x0010,
|
|
|
|
wxPG_FL_MOUSE_INSIDE = 0x0020,
|
|
|
|
wxPG_FL_VALUE_MODIFIED = 0x0040,
|
|
|
|
// don't clear background of m_wndEditor
|
|
|
|
wxPG_FL_PRIMARY_FILLS_ENTIRE = 0x0080,
|
|
|
|
// currently active editor uses custom image
|
|
|
|
wxPG_FL_CUR_USES_CUSTOM_IMAGE = 0x0100,
|
|
|
|
// cell colours override selection colours for selected cell
|
|
|
|
wxPG_FL_CELL_OVERRIDES_SEL = 0x0200,
|
|
|
|
wxPG_FL_SCROLLED = 0x0400,
|
|
|
|
// set when all added/inserted properties get hideable flag
|
|
|
|
wxPG_FL_ADDING_HIDEABLES = 0x0800,
|
|
|
|
// Disables showing help strings on statusbar.
|
|
|
|
wxPG_FL_NOSTATUSBARHELP = 0x1000,
|
|
|
|
// Marks that we created the state, so we have to destroy it too.
|
|
|
|
wxPG_FL_CREATEDSTATE = 0x2000,
|
|
|
|
// Set if wxPGMan requires redrawing of description text box.
|
|
|
|
wxPG_FL_DESC_REFRESH_REQUIRED = 0x8000,
|
|
|
|
// Set if contained in wxPropertyGridManager
|
|
|
|
wxPG_FL_IN_MANAGER = 0x00020000,
|
|
|
|
// Set after wxPropertyGrid is shown in its initial good size
|
|
|
|
wxPG_FL_GOOD_SIZE_SET = 0x00040000,
|
|
|
|
// Set when in SelectProperty.
|
|
|
|
wxPG_FL_IN_SELECT_PROPERTY = 0x00100000,
|
|
|
|
// Set when help string is shown in status bar
|
|
|
|
wxPG_FL_STRING_IN_STATUSBAR = 0x00200000,
|
|
|
|
// Auto sort is enabled (for categorized mode)
|
|
|
|
wxPG_FL_CATMODE_AUTO_SORT = 0x01000000,
|
|
|
|
// Set after page has been inserted to manager
|
|
|
|
wxPG_MAN_FL_PAGE_INSERTED = 0x02000000,
|
|
|
|
// Active editor control is abnormally large
|
|
|
|
wxPG_FL_ABNORMAL_EDITOR = 0x04000000,
|
|
|
|
// Recursion guard for HandleCustomEditorEvent
|
|
|
|
wxPG_FL_IN_HANDLECUSTOMEDITOREVENT = 0x08000000,
|
|
|
|
wxPG_FL_VALUE_CHANGE_IN_EVENT = 0x10000000,
|
|
|
|
// Editor control width should not change on resize
|
|
|
|
wxPG_FL_FIXED_WIDTH_EDITOR = 0x20000000,
|
2018-08-14 15:15:39 +00:00
|
|
|
// Width of panel can be different from width of grid
|
2016-03-06 20:19:07 +00:00
|
|
|
wxPG_FL_HAS_VIRTUAL_WIDTH = 0x40000000,
|
|
|
|
// Prevents RecalculateVirtualSize re-entrancy
|
|
|
|
wxPG_FL_RECALCULATING_VIRTUAL_SIZE = 0x80000000
|
|
|
|
};
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2010-02-10 16:45:39 +00:00
|
|
|
#if !defined(__wxPG_SOURCE_FILE__)
|
2008-09-12 20:57:41 +00:00
|
|
|
// Reduce compile time, but still include in user app
|
|
|
|
#include "wx/propgrid/props.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPropertyGrid is a specialized grid for editing properties
|
|
|
|
// such as strings, numbers, flagsets, fonts, and colours. wxPropertySheet
|
|
|
|
// used to do the very same thing, but it hasn't been updated for a while
|
|
|
|
// and it is currently deprecated.
|
|
|
|
// Please note that most member functions are inherited and as such not
|
|
|
|
// documented heree. This means you will probably also want to read
|
|
|
|
// wxPropertyGridInterface class reference.
|
|
|
|
// To process input from a propertygrid control, use these event handler
|
|
|
|
// macros to direct input to member functions that take a wxPropertyGridEvent
|
|
|
|
// argument.
|
|
|
|
// EVT_PG_SELECTED (id, func)
|
|
|
|
// Respond to wxEVT_PG_SELECTED event, generated when a property selection
|
|
|
|
// has been changed, either by user action or by indirect program
|
|
|
|
// function. For instance, collapsing a parent property programmatically
|
|
|
|
// causes any selected child property to become unselected, and may
|
|
|
|
// therefore cause this event to be generated.
|
|
|
|
// EVT_PG_CHANGING(id, func)
|
|
|
|
// Respond to wxEVT_PG_CHANGING event, generated when property value
|
|
|
|
// is about to be changed by user. Use wxPropertyGridEvent::GetValue()
|
|
|
|
// to take a peek at the pending value, and wxPropertyGridEvent::Veto()
|
|
|
|
// to prevent change from taking place, if necessary.
|
|
|
|
// EVT_PG_HIGHLIGHTED(id, func)
|
|
|
|
// Respond to wxEVT_PG_HIGHLIGHTED event, which occurs when mouse
|
|
|
|
// moves over a property. Event's property is NULL if hovered area does
|
|
|
|
// not belong to any property.
|
|
|
|
// EVT_PG_RIGHT_CLICK(id, func)
|
|
|
|
// Respond to wxEVT_PG_RIGHT_CLICK event, which occurs when property is
|
|
|
|
// clicked on with right mouse button.
|
|
|
|
// EVT_PG_DOUBLE_CLICK(id, func)
|
|
|
|
// Respond to wxEVT_PG_DOUBLE_CLICK event, which occurs when property is
|
|
|
|
// double-clicked onwith left mouse button.
|
|
|
|
// EVT_PG_ITEM_COLLAPSED(id, func)
|
|
|
|
// Respond to wxEVT_PG_ITEM_COLLAPSED event, generated when user collapses
|
|
|
|
// a property or category..
|
|
|
|
// EVT_PG_ITEM_EXPANDED(id, func)
|
|
|
|
// Respond to wxEVT_PG_ITEM_EXPANDED event, generated when user expands
|
|
|
|
// a property or category..
|
|
|
|
// EVT_PG_LABEL_EDIT_BEGIN(id, func)
|
|
|
|
// Respond to wxEVT_PG_LABEL_EDIT_BEGIN event, generated when is about to
|
|
|
|
// begin editing a property label. You can veto this event to prevent the
|
|
|
|
// action.
|
|
|
|
// EVT_PG_LABEL_EDIT_ENDING(id, func)
|
|
|
|
// Respond to wxEVT_PG_LABEL_EDIT_ENDING event, generated when is about to
|
|
|
|
// end editing of a property label. You can veto this event to prevent the
|
|
|
|
// action.
|
|
|
|
// EVT_PG_COL_BEGIN_DRAG(id, func)
|
|
|
|
// Respond to wxEVT_PG_COL_BEGIN_DRAG event, generated when user
|
|
|
|
// starts resizing a column - can be vetoed.
|
|
|
|
// EVT_PG_COL_DRAGGING,(id, func)
|
|
|
|
// Respond to wxEVT_PG_COL_DRAGGING, event, generated when a
|
|
|
|
// column resize by user is in progress. This event is also generated
|
|
|
|
// when user double-clicks the splitter in order to recenter
|
|
|
|
// it.
|
|
|
|
// EVT_PG_COL_END_DRAG(id, func)
|
|
|
|
// Respond to wxEVT_PG_COL_END_DRAG event, generated after column
|
|
|
|
// resize by user has finished.
|
|
|
|
// Use Freeze() and Thaw() respectively to disable and enable drawing. This
|
|
|
|
// will also delay sorting etc. miscellaneous calculations to the last
|
|
|
|
// possible moment.
|
2019-05-19 20:35:33 +00:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPropertyGrid : public wxScrolled<wxControl>,
|
2010-09-24 14:47:20 +00:00
|
|
|
public wxPropertyGridInterface
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2009-09-27 14:35:02 +00:00
|
|
|
friend class wxPropertyGridEvent;
|
2008-09-12 20:57:41 +00:00
|
|
|
friend class wxPropertyGridPageState;
|
|
|
|
friend class wxPropertyGridInterface;
|
|
|
|
friend class wxPropertyGridManager;
|
2009-12-13 12:00:04 +00:00
|
|
|
friend class wxPGHeaderCtrl;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxPropertyGrid);
|
2008-09-12 20:57:41 +00:00
|
|
|
public:
|
|
|
|
|
2009-05-30 11:20:35 +00:00
|
|
|
#ifndef SWIG
|
2016-06-23 20:02:57 +00:00
|
|
|
// Two step constructor.
|
|
|
|
// Call Create when this constructor is called to build up the
|
|
|
|
// wxPropertyGrid
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGrid();
|
2009-05-30 11:20:35 +00:00
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// The default constructor. The styles to be used are styles valid for
|
|
|
|
// the wxWindow.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGrid( wxWindow *parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxPG_DEFAULT_STYLE,
|
2008-11-02 22:16:14 +00:00
|
|
|
const wxString& name = wxPropertyGridNameStr );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Destructor
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual ~wxPropertyGrid();
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Adds given key combination to trigger given action.
|
|
|
|
// Here is a sample code to make Enter key press move focus to
|
|
|
|
// the next property.
|
|
|
|
// propGrid->AddActionTrigger(wxPG_ACTION_NEXT_PROPERTY, WXK_RETURN);
|
|
|
|
// propGrid->DedicateKey(WXK_RETURN);
|
|
|
|
// action - Which action to trigger. See @ref propgrid_keyboard_actions.
|
|
|
|
// keycode - Which keycode triggers the action.
|
|
|
|
// modifiers - Which key event modifiers, in addition to keycode, are needed to
|
|
|
|
// trigger the action.
|
2008-09-12 20:57:41 +00:00
|
|
|
void AddActionTrigger( int action, int keycode, int modifiers = 0 );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Dedicates a specific keycode to wxPropertyGrid. This means that such
|
|
|
|
// key presses will not be redirected to editor controls.
|
|
|
|
// Using this function allows, for example, navigation between
|
|
|
|
// properties using arrow keys even when the focus is in the editor
|
|
|
|
// control.
|
2010-06-12 09:30:57 +00:00
|
|
|
void DedicateKey( int keycode )
|
|
|
|
{
|
2014-11-24 16:04:53 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
// Deprecated: use a hash set instead.
|
2010-06-12 09:30:57 +00:00
|
|
|
m_dedicatedKeys.push_back(keycode);
|
2014-11-24 16:04:53 +00:00
|
|
|
#else
|
|
|
|
m_dedicatedKeys.insert(keycode);
|
|
|
|
#endif
|
2010-06-12 09:30:57 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// This static function enables or disables automatic use of
|
|
|
|
// wxGetTranslation for following strings: wxEnumProperty list labels,
|
|
|
|
// wxFlagsProperty child property labels.
|
|
|
|
// Default is false.
|
2008-09-12 20:57:41 +00:00
|
|
|
static void AutoGetTranslation( bool enable );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Changes value of a property, as if from an editor.
|
|
|
|
// Use this instead of SetPropertyValue() if you need the value to run
|
|
|
|
// through validation process, and also send the property change event.
|
|
|
|
// Returns true if value was successfully changed.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool ChangePropertyValue( wxPGPropArg id, wxVariant newValue );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Centers the splitter.
|
|
|
|
// enableAutoResizing - If true, automatic column resizing is enabled
|
|
|
|
// (only applicable if window style wxPG_SPLITTER_AUTO_CENTER is used).
|
2010-02-16 16:24:30 +00:00
|
|
|
void CenterSplitter( bool enableAutoResizing = false );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Deletes all properties.
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual void Clear() wxOVERRIDE;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Clears action triggers for given action.
|
|
|
|
// action - Which action to trigger.
|
2008-09-12 20:57:41 +00:00
|
|
|
void ClearActionTriggers( int action );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Forces updating the value of property from the editor control.
|
|
|
|
// Note that wxEVT_PG_CHANGING and wxEVT_PG_CHANGED are dispatched using
|
|
|
|
// ProcessEvent, meaning your event handlers will be called immediately.
|
|
|
|
// Returns true if anything was changed.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual bool CommitChangesFromEditor( wxUint32 flags = 0 );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 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 @see @link wndflags Additional Window Styles@endlink
|
2008-09-12 20:57:41 +00:00
|
|
|
bool Create( wxWindow *parent, wxWindowID id = wxID_ANY,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxPG_DEFAULT_STYLE,
|
2008-11-02 22:16:14 +00:00
|
|
|
const wxString& name = wxPropertyGridNameStr );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Call when editor widget's contents is modified.
|
|
|
|
// For example, this is called when changes text in wxTextCtrl (used in
|
|
|
|
// wxStringProperty and wxIntProperty).
|
|
|
|
// This function should only be called by custom properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
void EditorsValueWasModified() { m_iFlags |= wxPG_FL_VALUE_MODIFIED; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Reverse of EditorsValueWasModified().
|
|
|
|
// This function should only be called by custom properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
void EditorsValueWasNotModified()
|
|
|
|
{
|
|
|
|
m_iFlags &= ~(wxPG_FL_VALUE_MODIFIED);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Enables or disables (shows/hides) categories according to parameter
|
|
|
|
// enable.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool EnableCategories( bool enable );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Scrolls and/or expands items to ensure that the given item is visible.
|
|
|
|
// Returns true if something was actually done.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool EnsureVisible( wxPGPropArg id );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Reduces column sizes to minimum possible that contents are still
|
|
|
|
// visibly (naturally some margin space will be applied as well).
|
|
|
|
// Returns minimum size for the grid to still display everything.
|
|
|
|
// Does not work well with wxPG_SPLITTER_AUTO_CENTER window style.
|
|
|
|
// This function only works properly if grid size prior to call was already
|
|
|
|
// fairly large.
|
|
|
|
// Note that you can also get calculated column widths by calling
|
|
|
|
// GetState->GetColumnWidth() immediately after this function returns.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxSize FitColumns()
|
|
|
|
{
|
|
|
|
wxSize sz = m_pState->DoFitColumns();
|
|
|
|
return sz;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns wxWindow that the properties are painted on, and which should
|
|
|
|
// be used as the parent for editor controls.
|
2009-10-10 09:52:44 +00:00
|
|
|
wxWindow* GetPanel()
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2009-10-10 09:52:44 +00:00
|
|
|
return this;
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current category caption background colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetCaptionBackgroundColour() const { return m_colCapBack; }
|
|
|
|
|
|
|
|
wxFont& GetCaptionFont() { return m_captionFont; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current category caption font.
|
2008-09-12 20:57:41 +00:00
|
|
|
const wxFont& GetCaptionFont() const { return m_captionFont; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current category caption text colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetCaptionForegroundColour() const { return m_colCapFore; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current cell background colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetCellBackgroundColour() const { return m_colPropBack; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current cell text colour when disabled.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetCellDisabledTextColour() const { return m_colDisPropFore; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current cell text colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetCellTextColour() const { return m_colPropFore; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns number of columns currently on grid.
|
2008-10-12 12:23:48 +00:00
|
|
|
unsigned int GetColumnCount() const
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2015-05-24 18:44:20 +00:00
|
|
|
return m_pState->GetColumnCount();
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns colour of empty space below properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetEmptySpaceColour() const { return m_colEmptySpace; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns height of highest characters of used font.
|
2008-09-12 20:57:41 +00:00
|
|
|
int GetFontHeight() const { return m_fontHeight; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns pointer to itself. Dummy function that enables same kind
|
|
|
|
// of code to use wxPropertyGrid and wxPropertyGridManager.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGrid* GetGrid() { return this; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns rectangle of custom paint image.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxRect GetImageRect( wxPGProperty* p, int item ) const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns size of the custom paint image in front of property.
|
|
|
|
// If no argument is given (p is NULL), returns preferred size.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxSize GetImageSize( wxPGProperty* p = NULL, int item = -1 ) const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns last item which could be iterated using given flags.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT )
|
|
|
|
{
|
|
|
|
return m_pState->GetLastItem(flags);
|
|
|
|
}
|
|
|
|
|
|
|
|
const wxPGProperty* GetLastItem( int flags = wxPG_ITERATE_DEFAULT ) const
|
|
|
|
{
|
|
|
|
return m_pState->GetLastItem(flags);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns colour of lines between cells.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetLineColour() const { return m_colLine; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns background colour of margin.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetMarginColour() const { return m_colMargin; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns margin width.
|
2009-12-13 12:00:04 +00:00
|
|
|
int GetMarginWidth() const { return m_marginWidth; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns most up-to-date value of selected property. This will return
|
|
|
|
// value different from GetSelectedProperty()->GetValue() only when text
|
|
|
|
// editor is activate and string edited by user represents valid,
|
|
|
|
// uncommitted property value.
|
2008-10-10 15:22:08 +00:00
|
|
|
wxVariant GetUncommittedPropertyValue();
|
2008-10-08 18:15:10 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns "root property". It does not have name, etc. and it is not
|
|
|
|
// visible. It is only useful for accessing its children.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* GetRoot() const { return m_pState->m_properties; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns height of a single grid row (in pixels).
|
2008-09-12 20:57:41 +00:00
|
|
|
int GetRowHeight() const { return m_lineHeight; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns currently selected property.
|
2008-09-29 16:07:00 +00:00
|
|
|
wxPGProperty* GetSelectedProperty() const { return GetSelection(); }
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current selection background colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetSelectionBackgroundColour() const { return m_colSelBack; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current selection text colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxColour GetSelectionForegroundColour() const { return m_colSelFore; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current splitter x position.
|
2010-02-16 16:24:30 +00:00
|
|
|
int GetSplitterPosition( unsigned int splitterIndex = 0 ) const
|
|
|
|
{
|
|
|
|
return m_pState->DoGetSplitterPosition(splitterIndex);
|
|
|
|
}
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns wxTextCtrl active in currently selected property, if any. Takes
|
|
|
|
// into account wxOwnerDrawnComboBox.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxTextCtrl* GetEditorTextCtrl() const;
|
|
|
|
|
|
|
|
wxPGValidationInfo& GetValidationInfo()
|
|
|
|
{
|
|
|
|
return m_validationInfo;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current vertical spacing.
|
2008-09-12 20:57:41 +00:00
|
|
|
int GetVerticalSpacing() const { return (int)m_vspacing; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns true if a property editor control has focus.
|
2009-02-26 19:00:46 +00:00
|
|
|
bool IsEditorFocused() const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns true if editor's value was marked modified.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool IsEditorsValueModified() const
|
|
|
|
{ return ( m_iFlags & wxPG_FL_VALUE_MODIFIED ) ? true : false; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns information about arbitrary position in the grid.
|
|
|
|
// pt - Coordinates in the virtual grid space. You may need to use
|
|
|
|
// wxScrolled<T>::CalcScrolledPosition() for translating
|
|
|
|
// wxPropertyGrid client coordinates into something this member
|
|
|
|
// function can use.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGridHitTestResult HitTest( const wxPoint& pt ) const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns true if any property has been modified by the user.
|
2014-09-25 17:29:50 +00:00
|
|
|
bool IsAnyModified() const
|
2014-11-08 18:17:24 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
2014-09-25 17:29:50 +00:00
|
|
|
{ return m_pState->m_anyModified != (unsigned char)false; }
|
|
|
|
#else
|
|
|
|
{ return m_pState->m_anyModified; }
|
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// It is recommended that you call this function any time your code causes
|
|
|
|
// wxPropertyGrid's top-level parent to change. wxPropertyGrid's OnIdle()
|
|
|
|
// handler should be able to detect most changes, but it is not perfect.
|
|
|
|
// newTLP - New top-level parent that is about to be set. Old top-level parent
|
|
|
|
// window should still exist as the current one.
|
|
|
|
// This function is automatically called from wxPropertyGrid::
|
|
|
|
// Reparent() and wxPropertyGridManager::Reparent(). You only
|
|
|
|
// need to use it if you reparent wxPropertyGrid indirectly.
|
2009-06-10 20:36:56 +00:00
|
|
|
void OnTLPChanging( wxWindow* newTLP );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Redraws given property.
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual void RefreshProperty( wxPGProperty* p ) wxOVERRIDE;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Registers a new editor class.
|
|
|
|
// Returns pointer to the editor class instance that should be used.
|
2008-09-12 20:57:41 +00:00
|
|
|
static wxPGEditor* RegisterEditorClass( wxPGEditor* editor,
|
2009-06-12 13:49:59 +00:00
|
|
|
bool noDefCheck = false )
|
|
|
|
{
|
|
|
|
return DoRegisterEditorClass(editor, wxEmptyString, noDefCheck);
|
|
|
|
}
|
|
|
|
|
|
|
|
static wxPGEditor* DoRegisterEditorClass( wxPGEditor* editorClass,
|
|
|
|
const wxString& editorName,
|
|
|
|
bool noDefCheck = false );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Resets all colours to the original system values.
|
2008-09-12 20:57:41 +00:00
|
|
|
void ResetColours();
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Resets column sizes and splitter positions, based on proportions.
|
|
|
|
// enableAutoResizing - If true, automatic column resizing is enabled
|
2017-10-06 13:28:58 +00:00
|
|
|
// (only applicable if window style wxPG_SPLITTER_AUTO_CENTER is used).
|
2010-02-16 16:24:30 +00:00
|
|
|
void ResetColumnSizes( bool enableAutoResizing = false );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Selects a property.
|
|
|
|
// Editor widget is automatically created, but not focused unless focus is
|
|
|
|
// true.
|
|
|
|
// id - Property to select.
|
|
|
|
// Returns true if selection finished successfully. Usually only fails if
|
|
|
|
// current value in editor is not valid.
|
|
|
|
// This function clears any previous selection.
|
2009-08-11 16:53:05 +00:00
|
|
|
bool SelectProperty( wxPGPropArg id, bool focus = false );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set entire new selection from given list of properties.
|
2009-08-17 18:36:00 +00:00
|
|
|
void SetSelection( const wxArrayPGProperty& newSelection )
|
|
|
|
{
|
|
|
|
DoSetSelection( newSelection, wxPG_SEL_DONT_SEND_EVENT );
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Adds given property into selection. If wxPG_EX_MULTIPLE_SELECTION
|
|
|
|
// extra style is not used, then this has same effect as
|
|
|
|
// calling SelectProperty().
|
|
|
|
// Multiple selection is not supported for categories. This
|
|
|
|
// means that if you have properties selected, you cannot
|
|
|
|
// add category to selection, and also if you have category
|
|
|
|
// selected, you cannot add other properties to selection.
|
|
|
|
// This member function will fail silently in these cases,
|
|
|
|
// even returning true.
|
2009-08-17 18:36:00 +00:00
|
|
|
bool AddToSelection( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
|
|
|
return DoAddToSelection(p, wxPG_SEL_DONT_SEND_EVENT);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Removes given property from selection. If property is not selected,
|
|
|
|
// an assertion failure will occur.
|
2009-08-17 18:36:00 +00:00
|
|
|
bool RemoveFromSelection( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG_RETVAL(false)
|
|
|
|
return DoRemoveFromSelection(p, wxPG_SEL_DONT_SEND_EVENT);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Makes given column editable by user.
|
|
|
|
// editable - Using false here will disable column from being editable.
|
2009-09-01 13:54:41 +00:00
|
|
|
void MakeColumnEditable( unsigned int column, bool editable = true );
|
2009-08-23 15:31:03 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Creates label editor wxTextCtrl for given column, for property
|
|
|
|
// that is currently selected. When multiple selection is
|
|
|
|
// enabled, this applies to whatever property GetSelection()
|
|
|
|
// returns.
|
|
|
|
// colIndex - Which column's label to edit. Note that you should not
|
|
|
|
// use value 1, which is reserved for property value
|
|
|
|
// column.
|
2009-08-23 15:31:03 +00:00
|
|
|
void BeginLabelEdit( unsigned int column = 0 )
|
|
|
|
{
|
|
|
|
DoBeginLabelEdit(column, wxPG_SEL_DONT_SEND_EVENT);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Destroys label editor wxTextCtrl, if any.
|
|
|
|
// commit - Use true (default) to store edited label text in
|
|
|
|
// property cell data.
|
2009-08-23 15:31:03 +00:00
|
|
|
void EndLabelEdit( bool commit = true )
|
|
|
|
{
|
|
|
|
DoEndLabelEdit(commit, wxPG_SEL_DONT_SEND_EVENT);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns currently active label editor, NULL if none.
|
2009-08-23 15:31:03 +00:00
|
|
|
wxTextCtrl* GetLabelEditor() const
|
|
|
|
{
|
|
|
|
return m_labelEditor;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets category caption background colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCaptionBackgroundColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets category caption text colour.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCaptionTextColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets default cell background colour - applies to property cells.
|
|
|
|
// Note that appearance of editor widgets may not be affected.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCellBackgroundColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets cell text colour for disabled properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCellDisabledTextColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets default cell text colour - applies to property name and value text.
|
|
|
|
// Note that appearance of editor widgets may not be affected.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCellTextColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set number of columns (2 or more).
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetColumnCount( int colCount )
|
|
|
|
{
|
|
|
|
m_pState->SetColumnCount(colCount);
|
|
|
|
Refresh();
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets the 'current' category - Append will add non-category properties
|
|
|
|
// under it.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCurrentCategory( wxPGPropArg id )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
2008-09-13 19:43:44 +00:00
|
|
|
wxPropertyCategory* pc = wxDynamicCast(p, wxPropertyCategory);
|
|
|
|
wxASSERT(pc);
|
2008-09-12 20:57:41 +00:00
|
|
|
m_pState->m_currentCategory = pc;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets colour of empty space below properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetEmptySpaceColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets colour of lines between cells.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetLineColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets background colour of margin.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetMarginColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets selection background colour - applies to selected property name
|
|
|
|
// background.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetSelectionBackgroundColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets selection foreground colour - applies to selected property name
|
|
|
|
// text.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetSelectionTextColour(const wxColour& col);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets x coordinate of the splitter.
|
|
|
|
// Splitter position cannot exceed grid size, and therefore setting it
|
|
|
|
// during form creation may fail as initial grid size is often smaller
|
|
|
|
// than desired splitter position, especially when sizers are being used.
|
2009-12-13 12:00:04 +00:00
|
|
|
void SetSplitterPosition( int newXPos, int col = 0 )
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2009-12-13 12:00:04 +00:00
|
|
|
DoSetSplitterPosition(newXPos, col, wxPG_SPLITTER_REFRESH);
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets the property sorting function.
|
|
|
|
// sortFunction - The sorting function to be used. It should return a value greater
|
|
|
|
// than 0 if position of p1 is after p2. So, for instance, when
|
|
|
|
// comparing property names, you can use following implementation:
|
|
|
|
// int MyPropertySortFunction(wxPropertyGrid* propGrid,
|
|
|
|
// wxPGProperty* p1,
|
|
|
|
// wxPGProperty* p2)
|
|
|
|
// {
|
|
|
|
// return p1->GetBaseName().compare( p2->GetBaseName() );
|
|
|
|
// }
|
|
|
|
// Default property sort function sorts properties by their labels
|
|
|
|
// (case-insensitively).
|
2009-01-07 18:53:09 +00:00
|
|
|
void SetSortFunction( wxPGSortCallback sortFunction )
|
|
|
|
{
|
|
|
|
m_sortFunction = sortFunction;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns the property sort function (default is NULL).
|
2009-01-07 18:53:09 +00:00
|
|
|
wxPGSortCallback GetSortFunction() const
|
|
|
|
{
|
|
|
|
return m_sortFunction;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets appearance of value cells representing an unspecified property
|
|
|
|
// value. Default appearance is blank.
|
|
|
|
// If you set the unspecified value to have any
|
|
|
|
// textual representation, then that will override
|
|
|
|
// "InlineHelp" attribute.
|
2009-12-22 16:12:02 +00:00
|
|
|
void SetUnspecifiedValueAppearance( const wxPGCell& cell )
|
|
|
|
{
|
|
|
|
m_unspecifiedAppearance = m_propertyDefaultCell;
|
|
|
|
m_unspecifiedAppearance.MergeFrom(cell);
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns current appearance of unspecified value cells.
|
2009-12-22 16:12:02 +00:00
|
|
|
const wxPGCell& GetUnspecifiedValueAppearance() const
|
|
|
|
{
|
|
|
|
return m_unspecifiedAppearance;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns (visual) text representation of the unspecified
|
|
|
|
// property value.
|
|
|
|
// argFlags - For internal use only.
|
2009-12-20 12:48:41 +00:00
|
|
|
wxString GetUnspecifiedValueText( int argFlags = 0 ) const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set virtual width for this particular page. Width -1 indicates that the
|
|
|
|
// virtual width should be disabled.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetVirtualWidth( int width );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Moves splitter as left as possible, while still allowing all
|
|
|
|
// labels to be shown in full.
|
|
|
|
// privateChildrenToo - If false, will still allow private children to be cropped.
|
2008-09-29 16:07:00 +00:00
|
|
|
void SetSplitterLeft( bool privateChildrenToo = false )
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2008-09-29 16:07:00 +00:00
|
|
|
m_pState->SetSplitterLeft(privateChildrenToo);
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets vertical spacing. Can be 1, 2, or 3 - a value relative to font
|
|
|
|
// height. Value of 2 should be default on most platforms.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetVerticalSpacing( int vspacing )
|
|
|
|
{
|
|
|
|
m_vspacing = (unsigned char)vspacing;
|
|
|
|
CalculateFontAndBitmapStuff( vspacing );
|
|
|
|
if ( !m_pState->m_itemsAdded ) Refresh();
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Shows an brief error message that is related to a property.
|
2008-09-12 20:57:41 +00:00
|
|
|
void ShowPropertyError( wxPGPropArg id, const wxString& msg )
|
|
|
|
{
|
|
|
|
wxPG_PROP_ARG_CALL_PROLOG()
|
|
|
|
DoShowPropertyError(p, msg);
|
|
|
|
}
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
//
|
|
|
|
// Following methods do not need to be (currently) documented
|
|
|
|
//
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
bool HasVirtualWidth() const
|
|
|
|
{ return (m_iFlags & wxPG_FL_HAS_VIRTUAL_WIDTH) ? true : false; }
|
|
|
|
|
|
|
|
const wxPGCommonValue* GetCommonValue( unsigned int i ) const
|
|
|
|
{
|
2020-02-09 19:39:06 +00:00
|
|
|
wxCHECK_MSG( i < m_commonValues.size(), NULL, "Invalid item index" );
|
2019-06-16 16:05:03 +00:00
|
|
|
return m_commonValues[i];
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns number of common values.
|
2008-09-12 20:57:41 +00:00
|
|
|
unsigned int GetCommonValueCount() const
|
|
|
|
{
|
2008-10-12 12:23:48 +00:00
|
|
|
return (unsigned int) m_commonValues.size();
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns label of given common value.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxString GetCommonValueLabel( unsigned int i ) const
|
|
|
|
{
|
2020-02-09 19:39:06 +00:00
|
|
|
wxCHECK_MSG( i < m_commonValues.size(), wxString(), "Invalid item index" );
|
2008-09-12 20:57:41 +00:00
|
|
|
return GetCommonValue(i)->GetLabel();
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns index of common value that will truly change value to
|
|
|
|
// unspecified.
|
2008-09-12 20:57:41 +00:00
|
|
|
int GetUnspecifiedCommonValue() const { return m_cvUnspecified; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set index of common value that will truly change value to unspecified.
|
|
|
|
// Using -1 will set none to have such effect.
|
|
|
|
// Default is 0.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetUnspecifiedCommonValue( int index ) { m_cvUnspecified = index; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Shortcut for creating dialog-caller button. Used, for example, by
|
|
|
|
// wxFontProperty.
|
|
|
|
// This should only be called by properties.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow* GenerateEditorButton( const wxPoint& pos, const wxSize& sz );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Fixes position of wxTextCtrl-like control (wxSpinCtrl usually
|
|
|
|
// fits as one). Call after control has been created (but before
|
|
|
|
// shown).
|
2008-09-12 20:57:41 +00:00
|
|
|
void FixPosForTextCtrl( wxWindow* ctrl,
|
2009-08-23 15:31:03 +00:00
|
|
|
unsigned int forColumn = 1,
|
2008-09-12 20:57:41 +00:00
|
|
|
const wxPoint& offset = wxPoint(0, 0) );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Shortcut for creating text editor widget.
|
|
|
|
// pos - Same as pos given for CreateEditor.
|
|
|
|
// sz - Same as sz given for CreateEditor.
|
|
|
|
// value - Initial text for wxTextCtrl.
|
|
|
|
// secondary - If right-side control, such as button, also created,
|
|
|
|
// then create it first and pass it as this parameter.
|
|
|
|
// extraStyle - Extra style flags to pass for wxTextCtrl.
|
|
|
|
// Note that this should generally be called only by new classes derived
|
|
|
|
// from wxPGProperty.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow* GenerateEditorTextCtrl( const wxPoint& pos,
|
|
|
|
const wxSize& sz,
|
|
|
|
const wxString& value,
|
|
|
|
wxWindow* secondary,
|
|
|
|
int extraStyle = 0,
|
2009-08-23 15:31:03 +00:00
|
|
|
int maxLen = 0,
|
|
|
|
unsigned int forColumn = 1 );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Generates both textctrl and button.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow* GenerateEditorTextCtrlAndButton( const wxPoint& pos,
|
|
|
|
const wxSize& sz, wxWindow** psecondary, int limited_editing,
|
|
|
|
wxPGProperty* property );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Generates position for a widget editor dialog box.
|
|
|
|
// p - Property for which dialog is positioned.
|
|
|
|
// sz - Known or over-approximated size of the dialog.
|
|
|
|
// Returns position for dialog.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPoint GetGoodEditorDialogPosition( wxPGProperty* p,
|
|
|
|
const wxSize& sz );
|
|
|
|
|
|
|
|
// Converts escape sequences in src_str to newlines,
|
|
|
|
// tabs, etc. and copies result to dst_str.
|
|
|
|
static wxString& ExpandEscapeSequences( wxString& dst_str,
|
2016-04-14 13:57:37 +00:00
|
|
|
const wxString& src_str );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
// Converts newlines, tabs, etc. in src_str to escape
|
|
|
|
// sequences, and copies result to dst_str.
|
|
|
|
static wxString& CreateEscapeSequences( wxString& dst_str,
|
2016-04-14 13:57:37 +00:00
|
|
|
const wxString& src_str );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2015-06-08 19:46:03 +00:00
|
|
|
// Checks system screen design used for laying out various dialogs.
|
2015-06-09 16:03:56 +00:00
|
|
|
static bool IsSmallScreen();
|
2015-06-08 19:46:03 +00:00
|
|
|
|
2020-04-10 18:45:34 +00:00
|
|
|
// Returns rescaled bitmap
|
|
|
|
static wxBitmap RescaleBitmap(const wxBitmap& srcBmp, double scaleX, double scaleY);
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns rectangle that fully contains properties between and including
|
|
|
|
// p1 and p2. Rectangle is in virtual scrolled window coordinates.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxRect GetPropertyRect( const wxPGProperty* p1,
|
|
|
|
const wxPGProperty* p2 ) const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns pointer to current active primary editor control (NULL if none).
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow* GetEditorControl() const;
|
|
|
|
|
|
|
|
wxWindow* GetPrimaryEditor() const
|
|
|
|
{
|
|
|
|
return GetEditorControl();
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns pointer to current active secondary editor control (NULL if
|
|
|
|
// none).
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow* GetEditorControlSecondary() const
|
|
|
|
{
|
|
|
|
return m_wndEditor2;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Refreshes any active editor control.
|
2008-12-26 18:46:08 +00:00
|
|
|
void RefreshEditor();
|
|
|
|
|
2008-11-23 11:00:40 +00:00
|
|
|
// Events from editor controls are forward to this function
|
2010-11-22 14:28:16 +00:00
|
|
|
bool HandleCustomEditorEvent( wxEvent &event );
|
2008-11-23 11:00:40 +00:00
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// Mostly useful for page switching.
|
|
|
|
void SwitchState( wxPropertyGridPageState* pNewState );
|
|
|
|
|
|
|
|
long GetInternalFlags() const { return m_iFlags; }
|
2008-10-14 17:15:59 +00:00
|
|
|
bool HasInternalFlag( long flag ) const
|
|
|
|
{ return (m_iFlags & flag) ? true : false; }
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetInternalFlag( long flag ) { m_iFlags |= flag; }
|
|
|
|
void ClearInternalFlag( long flag ) { m_iFlags &= ~(flag); }
|
|
|
|
|
2008-11-15 10:34:36 +00:00
|
|
|
void OnComboItemPaint( const wxPGComboBox* pCb,
|
|
|
|
int item,
|
|
|
|
wxDC* pDc,
|
|
|
|
wxRect& rect,
|
|
|
|
int flags );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2014-01-05 21:10:58 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
2016-06-23 20:02:57 +00:00
|
|
|
// Standardized double-to-string conversion.
|
2010-12-13 16:07:49 +00:00
|
|
|
static const wxString& DoubleToString( wxString& target,
|
|
|
|
double value,
|
|
|
|
int precision,
|
|
|
|
bool removeZeroes,
|
|
|
|
wxString* precTemplate = NULL );
|
2014-01-05 21:10:58 +00:00
|
|
|
#endif // WXWIN_COMPATIBILITY_3_0
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Call this from wxPGProperty::OnEvent() to cause property value to be
|
|
|
|
// changed after the function returns (with true as return value).
|
|
|
|
// ValueChangeInEvent() must be used if you wish the application to be
|
|
|
|
// able to use wxEVT_PG_CHANGING to potentially veto the given value.
|
2019-04-05 16:18:07 +00:00
|
|
|
void ValueChangeInEvent( const wxVariant& variant )
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
|
|
|
m_changeInEventValue = variant;
|
|
|
|
m_iFlags |= wxPG_FL_VALUE_CHANGE_IN_EVENT;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// You can use this member function, for instance, to detect in
|
|
|
|
// wxPGProperty::OnEvent() if wxPGProperty::SetValueInEvent() was
|
|
|
|
// already called in wxPGEditor::OnEvent(). It really only detects
|
|
|
|
// if was value was changed using wxPGProperty::SetValueInEvent(), which
|
|
|
|
// is usually used when a 'picker' dialog is displayed. If value was
|
|
|
|
// written by "normal means" in wxPGProperty::StringToValue() or
|
|
|
|
// IntToValue(), then this function will return false (on the other hand,
|
|
|
|
// wxPGProperty::OnEvent() is not even called in those cases).
|
2009-07-11 07:59:59 +00:00
|
|
|
bool WasValueChangedInEvent() const
|
|
|
|
{
|
|
|
|
return (m_iFlags & wxPG_FL_VALUE_CHANGE_IN_EVENT) ? true : false;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns true if given event is from first of an array of buttons
|
|
|
|
// (as can be in case when wxPGMultiButton is used).
|
2008-09-12 20:57:41 +00:00
|
|
|
bool IsMainButtonEvent( const wxEvent& event )
|
|
|
|
{
|
2013-04-25 10:11:03 +00:00
|
|
|
return (event.GetEventType() == wxEVT_BUTTON)
|
2008-09-12 20:57:41 +00:00
|
|
|
&& (m_wndSecId == event.GetId());
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Pending value is expected to be passed in PerformValidation().
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual bool DoPropertyChanged( wxPGProperty* p,
|
|
|
|
unsigned int selFlags = 0 );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Called when validation for given property fails.
|
|
|
|
// invalidValue - Value which failed in validation.
|
|
|
|
// Returns true if user is allowed to change to another property even
|
|
|
|
// if current has invalid value.
|
|
|
|
// To add your own validation failure behaviour, override
|
|
|
|
// wxPropertyGrid::DoOnValidationFailure().
|
2009-01-12 16:12:15 +00:00
|
|
|
bool OnValidationFailure( wxPGProperty* property,
|
|
|
|
wxVariant& invalidValue );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Called to indicate property and editor has valid value now.
|
2008-09-12 20:57:41 +00:00
|
|
|
void OnValidationFailureReset( wxPGProperty* property )
|
|
|
|
{
|
|
|
|
if ( property && property->HasFlag(wxPG_PROP_INVALID_VALUE) )
|
|
|
|
{
|
|
|
|
DoOnValidationFailureReset(property);
|
|
|
|
property->ClearFlag(wxPG_PROP_INVALID_VALUE);
|
|
|
|
}
|
|
|
|
m_validationInfo.m_failureMessage.clear();
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Override in derived class to display error messages in custom manner
|
|
|
|
// (these message usually only result from validation failure).
|
|
|
|
// If you implement this, then you also need to implement
|
|
|
|
// DoHidePropertyError() - possibly to do nothing, if error
|
|
|
|
// does not need hiding (e.g. it was logged or shown in a
|
|
|
|
// message box).
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual void DoShowPropertyError( wxPGProperty* property,
|
|
|
|
const wxString& msg );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Override in derived class to hide an error displayed by
|
|
|
|
// DoShowPropertyError().
|
2010-07-03 12:22:58 +00:00
|
|
|
virtual void DoHidePropertyError( wxPGProperty* property );
|
|
|
|
|
|
|
|
#if wxUSE_STATUSBAR
|
2016-06-23 20:02:57 +00:00
|
|
|
// Return wxStatusBar that is used by this wxPropertyGrid. You can
|
|
|
|
// reimplement this member function in derived class to override
|
|
|
|
// the default behaviour of using the top-level wxFrame's status
|
|
|
|
// bar, if any.
|
2010-07-03 12:22:58 +00:00
|
|
|
virtual wxStatusBar* GetStatusBar();
|
|
|
|
#endif
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Override to customize property validation failure behaviour.
|
|
|
|
// invalidValue - Value which failed in validation.
|
|
|
|
// Returns true if user is allowed to change to another property even
|
|
|
|
// if current has invalid value.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual bool DoOnValidationFailure( wxPGProperty* property,
|
|
|
|
wxVariant& invalidValue );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Override to customize resetting of property validation failure status.
|
|
|
|
// Property is guaranteed to have flag wxPG_PROP_INVALID_VALUE set.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual void DoOnValidationFailureReset( wxPGProperty* property );
|
|
|
|
|
|
|
|
int GetSpacingY() const { return m_spacingy; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Must be called in wxPGEditor::CreateControls() if primary editor window
|
|
|
|
// is wxTextCtrl, just before textctrl is created.
|
|
|
|
// text - Initial text value of created wxTextCtrl.
|
2014-01-20 14:45:08 +00:00
|
|
|
void SetupTextCtrlValue( const wxString& text ) { m_prevTcValue = text; }
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Unfocuses or closes editor if one was open, but does not deselect
|
|
|
|
// property.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool UnfocusEditor();
|
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual void SetWindowStyleFlag( long style ) wxOVERRIDE;
|
2008-11-16 18:20:21 +00:00
|
|
|
|
2009-03-04 19:53:34 +00:00
|
|
|
void DrawItems( const wxPGProperty* p1, const wxPGProperty* p2 );
|
|
|
|
|
|
|
|
void DrawItem( wxPGProperty* p )
|
|
|
|
{
|
|
|
|
DrawItems(p,p);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void DrawItemAndChildren( wxPGProperty* p );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Draws item, children, and consecutive parents as long as category is
|
|
|
|
// not met.
|
2009-03-04 19:53:34 +00:00
|
|
|
void DrawItemAndValueRelated( wxPGProperty* p );
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
protected:
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPropertyGridPageState used by the grid is created here.
|
|
|
|
// If grid is used in wxPropertyGridManager, there is no point overriding
|
|
|
|
// this - instead, set custom wxPropertyGridPage classes.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual wxPropertyGridPageState* CreateState() const;
|
|
|
|
|
2008-10-08 18:15:10 +00:00
|
|
|
enum PerformValidationFlags
|
|
|
|
{
|
|
|
|
SendEvtChanging = 0x0001,
|
|
|
|
IsStandaloneValidation = 0x0002 // Not called in response to event
|
|
|
|
};
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Runs all validation functionality (includes sending wxEVT_PG_CHANGING).
|
|
|
|
// Returns true if all tests passed. Implement in derived class to
|
|
|
|
// add additional validation behaviour.
|
2008-10-08 18:15:10 +00:00
|
|
|
virtual bool PerformValidation( wxPGProperty* p,
|
|
|
|
wxVariant& pendingValue,
|
|
|
|
int flags = SendEvtChanging );
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
public:
|
|
|
|
|
|
|
|
// Control font changer helper.
|
|
|
|
void SetCurControlBoldFont();
|
|
|
|
|
2008-10-31 18:53:37 +00:00
|
|
|
wxPGCell& GetPropertyDefaultCell()
|
|
|
|
{
|
|
|
|
return m_propertyDefaultCell;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxPGCell& GetCategoryDefaultCell()
|
|
|
|
{
|
|
|
|
return m_categoryDefaultCell;
|
|
|
|
}
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// Public methods for semi-public use
|
|
|
|
bool DoSelectProperty( wxPGProperty* p, unsigned int flags = 0 );
|
|
|
|
|
|
|
|
// Overridden functions.
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual bool Destroy() wxOVERRIDE;
|
2008-09-12 20:57:41 +00:00
|
|
|
// Returns property at given y coordinate (relative to grid's top left).
|
|
|
|
wxPGProperty* GetItemAtY( int y ) const { return DoGetItemAtY(y); }
|
|
|
|
|
|
|
|
virtual void Refresh( bool eraseBackground = true,
|
2014-03-30 00:02:23 +00:00
|
|
|
const wxRect *rect = (const wxRect *) NULL ) wxOVERRIDE;
|
|
|
|
virtual bool SetFont( const wxFont& font ) wxOVERRIDE;
|
|
|
|
virtual void SetExtraStyle( long exStyle ) wxOVERRIDE;
|
|
|
|
virtual bool Reparent( wxWindowBase *newParent ) wxOVERRIDE;
|
2019-01-07 19:14:35 +00:00
|
|
|
virtual void ScrollWindow(int dx, int dy, const wxRect* rect) wxOVERRIDE;
|
|
|
|
virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
|
|
|
|
int noUnitsX, int noUnitsY,
|
|
|
|
int xPos, int yPos, bool noRefresh) wxOVERRIDE;
|
2008-09-12 20:57:41 +00:00
|
|
|
protected:
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual void DoThaw() wxOVERRIDE;
|
2014-01-17 18:56:13 +00:00
|
|
|
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual wxSize DoGetBestSize() const wxOVERRIDE;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
#ifndef wxPG_ICON_WIDTH
|
|
|
|
wxBitmap *m_expandbmp, *m_collbmp;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
wxCursor *m_cursorSizeWE;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxWindow pointers to editor control(s).
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow *m_wndEditor;
|
|
|
|
wxWindow *m_wndEditor2;
|
2017-07-16 17:15:07 +00:00
|
|
|
// Actual positions of the editors within the cell.
|
|
|
|
wxPoint m_wndEditorPosRel;
|
|
|
|
wxPoint m_wndEditor2PosRel;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
wxBitmap *m_doubleBuffer;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Local time ms when control was created.
|
2015-04-03 19:10:04 +00:00
|
|
|
wxMilliClock_t m_timeCreated;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// wxPGProperty::OnEvent can change value by setting this.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxVariant m_changeInEventValue;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Id of m_wndEditor2, or its first child, if any.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_wndSecId;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Extra Y spacing between the items.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_spacingy;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Control client area width; updated on resize.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_width;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Control client area height; updated on resize.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_height;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Current non-client width (needed when auto-centering).
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_ncWidth;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// The gutter spacing in front and back of the image.
|
|
|
|
// This determines the amount of spacing in front of each item
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_gutterWidth;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Includes separator line.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_lineHeight;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Gutter*2 + image width.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_marginWidth;
|
|
|
|
|
|
|
|
// y spacing for expand/collapse button.
|
|
|
|
int m_buttonSpacingY;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Extra margin for expanded sub-group items.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_subgroup_extramargin;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// The image width of the [+] icon.
|
|
|
|
// This is also calculated in the gutter
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_iconWidth;
|
|
|
|
|
|
|
|
#ifndef wxPG_ICON_WIDTH
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// The image height of the [+] icon.
|
|
|
|
// This is calculated as minimal size and to align
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_iconHeight;
|
|
|
|
#endif
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Current cursor id.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_curcursor;
|
|
|
|
|
2010-09-24 14:47:20 +00:00
|
|
|
// Caption font. Same as normal font plus bold style.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxFont m_captionFont;
|
|
|
|
|
|
|
|
int m_fontHeight; // Height of the font.
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// m_splitterx when drag began.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_startingSplitterX;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Index to splitter currently being dragged (0=one after the first
|
|
|
|
// column).
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_draggedSplitter;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Changed property, calculated in PerformValidation().
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* m_chgInfo_changedProperty;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Lowest property for which editing happened, but which does not have
|
|
|
|
// aggregate parent
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* m_chgInfo_baseChangedProperty;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Changed property value, calculated in PerformValidation().
|
2008-09-12 20:57:41 +00:00
|
|
|
wxVariant m_chgInfo_pendingValue;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Passed to SetValue.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxVariant m_chgInfo_valueList;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Validation information.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGValidationInfo m_validationInfo;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Actions and keys that trigger them.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGHashMapI2I m_actionTriggers;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Appearance of currently active editor.
|
2009-12-22 16:12:02 +00:00
|
|
|
wxPGCell m_editorAppearance;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Appearance of a unspecified value cell.
|
2009-12-22 16:12:02 +00:00
|
|
|
wxPGCell m_unspecifiedAppearance;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// List of properties to be deleted/removed in idle event handler.
|
2018-11-01 17:19:55 +00:00
|
|
|
wxVector<wxPGProperty*> m_deletedProperties;
|
|
|
|
wxVector<wxPGProperty*> m_removedProperties;
|
2010-02-22 16:44:56 +00:00
|
|
|
|
2014-10-16 22:49:01 +00:00
|
|
|
#if !WXWIN_COMPATIBILITY_3_0
|
2016-06-23 20:02:57 +00:00
|
|
|
// List of editors and their event handlers to be deleted in idle event handler.
|
2019-01-07 20:54:15 +00:00
|
|
|
wxVector<wxObject*> m_deletedEditorObjects;
|
2014-10-16 22:49:01 +00:00
|
|
|
#endif
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// List of key codes that will not be handed over to editor controls.
|
2014-11-24 16:04:53 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
// Deprecated: use a hash set instead.
|
2010-06-12 09:30:57 +00:00
|
|
|
wxVector<int> m_dedicatedKeys;
|
2014-11-24 16:04:53 +00:00
|
|
|
#else
|
|
|
|
wxPGHashSetInt m_dedicatedKeys;
|
|
|
|
#endif
|
2010-06-12 09:30:57 +00:00
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
//
|
|
|
|
// Temporary values
|
|
|
|
//
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Bits are used to indicate which colours are customized.
|
2008-09-12 20:57:41 +00:00
|
|
|
unsigned short m_coloursCustomized;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// x - m_splitterx.
|
2008-09-12 20:57:41 +00:00
|
|
|
signed char m_dragOffset;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 0 = not dragging, 1 = drag just started, 2 = drag in progress
|
2008-09-12 20:57:41 +00:00
|
|
|
unsigned char m_dragStatus;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 0 = margin, 1 = label, 2 = value.
|
2008-09-12 20:57:41 +00:00
|
|
|
unsigned char m_mouseSide;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// True when editor control is focused.
|
2014-11-24 16:09:46 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
2008-09-12 20:57:41 +00:00
|
|
|
unsigned char m_editorFocused;
|
2014-11-24 16:09:46 +00:00
|
|
|
#else
|
|
|
|
bool m_editorFocused;
|
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
unsigned char m_vspacing;
|
|
|
|
|
2014-11-08 18:17:24 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
// Unused variable.
|
2008-09-12 20:57:41 +00:00
|
|
|
// Used to track when Alt/Ctrl+Key was consumed.
|
|
|
|
unsigned char m_keyComboConsumed;
|
2014-11-08 18:17:24 +00:00
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 1 if in DoPropertyChanged()
|
2010-07-04 11:21:27 +00:00
|
|
|
bool m_inDoPropertyChanged;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 1 if in CommitChangesFromEditor()
|
2010-07-04 11:21:27 +00:00
|
|
|
bool m_inCommitChangesFromEditor;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// 1 if in DoSelectProperty()
|
2010-07-04 10:30:13 +00:00
|
|
|
bool m_inDoSelectProperty;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2010-07-04 09:46:43 +00:00
|
|
|
bool m_inOnValidationFailure;
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGVFBFlags m_permanentValidationFailureBehavior; // Set by app
|
|
|
|
|
2010-03-29 18:17:55 +00:00
|
|
|
// DoEditorValidate() recursion guard
|
|
|
|
wxRecursionGuardFlag m_validatingEditor;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Internal flags - see wxPG_FL_XXX constants.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxUint32 m_iFlags;
|
|
|
|
|
2014-11-24 16:11:19 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
// Unused variable.
|
2016-07-23 21:38:39 +00:00
|
|
|
// When drawing next time, clear this many item slots at the end.
|
2008-09-12 20:57:41 +00:00
|
|
|
int m_clearThisMany;
|
2014-11-24 16:11:19 +00:00
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2009-08-23 15:31:03 +00:00
|
|
|
// Mouse is hovering over this column (index)
|
|
|
|
unsigned int m_colHover;
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// pointer to property that has mouse hovering
|
|
|
|
wxPGProperty* m_propHover;
|
|
|
|
|
2017-07-16 17:15:07 +00:00
|
|
|
// Active label editor and its actual position within the cell
|
2009-08-23 15:31:03 +00:00
|
|
|
wxTextCtrl* m_labelEditor;
|
2017-07-16 17:15:07 +00:00
|
|
|
wxPoint m_labelEditorPosRel;
|
2009-08-23 15:31:03 +00:00
|
|
|
|
|
|
|
// For which property the label editor is active
|
|
|
|
wxPGProperty* m_labelEditorProperty;
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// EventObject for wxPropertyGridEvents
|
|
|
|
wxWindow* m_eventObject;
|
|
|
|
|
|
|
|
// What (global) window is currently focused (needed to resolve event
|
|
|
|
// handling mess).
|
|
|
|
wxWindow* m_curFocused;
|
|
|
|
|
2009-09-10 14:15:32 +00:00
|
|
|
// Event currently being sent - NULL if none at the moment
|
|
|
|
wxPropertyGridEvent* m_processedEvent;
|
|
|
|
|
2009-06-10 20:36:56 +00:00
|
|
|
// Last known top-level parent
|
2008-09-12 20:57:41 +00:00
|
|
|
wxWindow* m_tlp;
|
|
|
|
|
2009-06-22 17:02:53 +00:00
|
|
|
// Last closed top-level parent
|
|
|
|
wxWindow* m_tlpClosed;
|
|
|
|
|
|
|
|
// Local time ms when tlp was closed.
|
2015-04-03 19:10:04 +00:00
|
|
|
wxMilliClock_t m_tlpClosedTime;
|
2009-06-22 17:02:53 +00:00
|
|
|
|
2009-01-07 18:53:09 +00:00
|
|
|
// Sort function
|
|
|
|
wxPGSortCallback m_sortFunction;
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// y coordinate of property that mouse hovering
|
|
|
|
int m_propHoverY;
|
2009-08-23 15:31:03 +00:00
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// Which column's editor is selected (usually 1)?
|
2009-08-23 15:31:03 +00:00
|
|
|
unsigned int m_selColumn;
|
2008-09-12 20:57:41 +00:00
|
|
|
// x relative to splitter (needed for resize).
|
|
|
|
int m_ctrlXAdjust;
|
|
|
|
// lines between cells
|
|
|
|
wxColour m_colLine;
|
|
|
|
// property labels and values are written in this colour
|
|
|
|
wxColour m_colPropFore;
|
|
|
|
// or with this colour when disabled
|
|
|
|
wxColour m_colDisPropFore;
|
|
|
|
// background for m_colPropFore
|
|
|
|
wxColour m_colPropBack;
|
|
|
|
// text color for captions
|
|
|
|
wxColour m_colCapFore;
|
|
|
|
// background color for captions
|
|
|
|
wxColour m_colCapBack;
|
|
|
|
// foreground for selected property
|
|
|
|
wxColour m_colSelFore;
|
|
|
|
// background for selected property (actually use background color when
|
|
|
|
// control out-of-focus)
|
|
|
|
wxColour m_colSelBack;
|
|
|
|
// background colour for margin
|
|
|
|
wxColour m_colMargin;
|
|
|
|
// background colour for empty space below the grid
|
|
|
|
wxColour m_colEmptySpace;
|
|
|
|
|
2008-10-31 18:53:37 +00:00
|
|
|
// Default property colours
|
|
|
|
wxPGCell m_propertyDefaultCell;
|
|
|
|
|
|
|
|
// Default property category
|
|
|
|
wxPGCell m_categoryDefaultCell;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2008-10-31 18:53:37 +00:00
|
|
|
// Backup of selected property's cells
|
|
|
|
wxVector<wxPGCell> m_propCellsBackup;
|
2008-09-30 17:23:27 +00:00
|
|
|
|
2008-10-31 18:53:37 +00:00
|
|
|
// NB: These *cannot* be moved to globals.
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
// labels when properties use common values
|
2008-09-30 17:23:27 +00:00
|
|
|
wxVector<wxPGCommonValue*> m_commonValues;
|
|
|
|
|
2009-09-27 14:35:02 +00:00
|
|
|
// array of live events
|
|
|
|
wxVector<wxPropertyGridEvent*> m_liveEvents;
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
// Which cv selection really sets value to unspecified?
|
|
|
|
int m_cvUnspecified;
|
|
|
|
|
|
|
|
// Used to skip excess text editor events
|
|
|
|
wxString m_prevTcValue;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
|
|
|
// Sets some members to defaults (called constructors).
|
|
|
|
void Init1();
|
|
|
|
|
|
|
|
// Initializes some members (called by Create and complex constructor).
|
|
|
|
void Init2();
|
|
|
|
|
|
|
|
void OnPaint(wxPaintEvent &event );
|
|
|
|
|
|
|
|
// main event receivers
|
|
|
|
void OnMouseMove( wxMouseEvent &event );
|
|
|
|
void OnMouseClick( wxMouseEvent &event );
|
|
|
|
void OnMouseRightClick( wxMouseEvent &event );
|
|
|
|
void OnMouseDoubleClick( wxMouseEvent &event );
|
|
|
|
void OnMouseUp( wxMouseEvent &event );
|
|
|
|
void OnKey( wxKeyEvent &event );
|
|
|
|
void OnResize( wxSizeEvent &event );
|
|
|
|
|
|
|
|
// event handlers
|
|
|
|
bool HandleMouseMove( int x, unsigned int y, wxMouseEvent &event );
|
|
|
|
bool HandleMouseClick( int x, unsigned int y, wxMouseEvent &event );
|
|
|
|
bool HandleMouseRightClick( int x, unsigned int y, wxMouseEvent &event );
|
|
|
|
bool HandleMouseDoubleClick( int x, unsigned int y, wxMouseEvent &event );
|
|
|
|
bool HandleMouseUp( int x, unsigned int y, wxMouseEvent &event );
|
2008-10-18 15:11:44 +00:00
|
|
|
void HandleKeyEvent( wxKeyEvent &event, bool fromChild );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
void OnMouseEntry( wxMouseEvent &event );
|
|
|
|
|
|
|
|
void OnIdle( wxIdleEvent &event );
|
|
|
|
void OnFocusEvent( wxFocusEvent &event );
|
|
|
|
void OnChildFocusEvent( wxChildFocusEvent& event );
|
|
|
|
|
|
|
|
bool OnMouseCommon( wxMouseEvent &event, int* px, int *py );
|
|
|
|
bool OnMouseChildCommon( wxMouseEvent &event, int* px, int *py );
|
|
|
|
|
|
|
|
// sub-control event handlers
|
|
|
|
void OnMouseClickChild( wxMouseEvent &event );
|
|
|
|
void OnMouseRightClickChild( wxMouseEvent &event );
|
|
|
|
void OnMouseMoveChild( wxMouseEvent &event );
|
|
|
|
void OnMouseUpChild( wxMouseEvent &event );
|
|
|
|
void OnChildKeyDown( wxKeyEvent &event );
|
|
|
|
|
|
|
|
void OnCaptureChange( wxMouseCaptureChangedEvent &event );
|
|
|
|
|
|
|
|
void OnScrollEvent( wxScrollWinEvent &event );
|
|
|
|
|
|
|
|
void OnSysColourChanged( wxSysColourChangedEvent &event );
|
|
|
|
|
2019-01-13 14:28:10 +00:00
|
|
|
void OnDPIChanged(wxDPIChangedEvent& event);
|
|
|
|
|
2009-06-10 20:36:56 +00:00
|
|
|
void OnTLPClose( wxCloseEvent& event );
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
protected:
|
|
|
|
|
2009-08-17 18:36:00 +00:00
|
|
|
bool AddToSelectionFromInputEvent( wxPGProperty* prop,
|
2009-08-23 15:31:03 +00:00
|
|
|
unsigned int colIndex,
|
2009-08-17 18:36:00 +00:00
|
|
|
wxMouseEvent* event = NULL,
|
|
|
|
int selFlags = 0 );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Adjust the centering of the bitmap icons (collapse / expand) when the
|
|
|
|
// caption font changes.
|
|
|
|
// They need to be centered in the middle of the font, so a bit of deltaY
|
|
|
|
// adjustment is needed. On entry, m_captionFont must be set to window
|
|
|
|
// font. It will be modified properly.
|
2008-09-12 20:57:41 +00:00
|
|
|
void CalculateFontAndBitmapStuff( int vspacing );
|
|
|
|
|
|
|
|
wxRect GetEditorWidgetRect( wxPGProperty* p, int column ) const;
|
|
|
|
|
|
|
|
void CorrectEditorWidgetSizeX();
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Called in RecalculateVirtualSize() to reposition control
|
|
|
|
// on virtual height changes.
|
2008-09-12 20:57:41 +00:00
|
|
|
void CorrectEditorWidgetPosY();
|
|
|
|
|
2014-12-12 22:36:28 +00:00
|
|
|
#if WXWIN_COMPATIBILITY_3_0
|
|
|
|
wxDEPRECATED_MSG("use two-argument function DoDrawItems(dc,rect)")
|
|
|
|
int DoDrawItems( wxDC& dc,
|
|
|
|
const wxRect* itemsRect,
|
|
|
|
bool isBuffered ) const
|
|
|
|
{
|
|
|
|
return DoDrawItemsBase(dc, itemsRect, isBuffered);
|
|
|
|
}
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
int DoDrawItems( wxDC& dc,
|
2014-12-12 22:36:28 +00:00
|
|
|
const wxRect* itemsRect ) const
|
|
|
|
{
|
|
|
|
return DoDrawItemsBase(dc, itemsRect, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
int DoDrawItemsBase( wxDC& dc,
|
2010-09-24 14:47:20 +00:00
|
|
|
const wxRect* itemsRect,
|
2008-09-12 20:57:41 +00:00
|
|
|
bool isBuffered ) const;
|
2014-12-12 22:36:28 +00:00
|
|
|
#else
|
|
|
|
int DoDrawItems( wxDC& dc,
|
|
|
|
const wxRect* itemsRect ) const;
|
|
|
|
#endif
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Draws an expand/collapse (ie. +/-) button.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual void DrawExpanderButton( wxDC& dc, const wxRect& rect,
|
|
|
|
wxPGProperty* property ) const;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Draws items from topItemY to bottomItemY
|
2009-10-11 08:45:34 +00:00
|
|
|
void DrawItems( wxDC& dc,
|
|
|
|
unsigned int topItemY,
|
|
|
|
unsigned int bottomItemY,
|
2010-09-24 14:47:20 +00:00
|
|
|
const wxRect* itemsRect = NULL );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
// Translate wxKeyEvent to wxPG_ACTION_XXX
|
|
|
|
int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;
|
|
|
|
|
|
|
|
int KeyEventToAction(wxKeyEvent &event) const
|
|
|
|
{
|
|
|
|
return KeyEventToActions(event, NULL);
|
|
|
|
}
|
|
|
|
|
|
|
|
void ImprovedClientToScreen( int* px, int* py );
|
|
|
|
|
|
|
|
// Called by focus event handlers. newFocused is the window that becomes
|
|
|
|
// focused.
|
|
|
|
void HandleFocusChange( wxWindow* newFocused );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Reloads all non-customized colours from system settings.
|
2008-09-12 20:57:41 +00:00
|
|
|
void RegainColours();
|
|
|
|
|
2010-03-29 18:17:55 +00:00
|
|
|
virtual bool DoEditorValidate();
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2009-08-23 15:31:03 +00:00
|
|
|
// Similar to DoSelectProperty() but also works on columns
|
|
|
|
// other than 1. Does not active editor if column is not
|
|
|
|
// editable.
|
|
|
|
bool DoSelectAndEdit( wxPGProperty* prop,
|
|
|
|
unsigned int colIndex,
|
|
|
|
unsigned int selFlags );
|
|
|
|
|
2009-08-17 18:36:00 +00:00
|
|
|
void DoSetSelection( const wxArrayPGProperty& newSelection,
|
|
|
|
int selFlags = 0 );
|
|
|
|
|
2009-12-13 12:00:04 +00:00
|
|
|
void DoSetSplitterPosition( int newxpos,
|
|
|
|
int splitterIndex = 0,
|
|
|
|
int flags = wxPG_SPLITTER_REFRESH );
|
|
|
|
|
2009-08-17 18:36:00 +00:00
|
|
|
bool DoAddToSelection( wxPGProperty* prop,
|
|
|
|
int selFlags = 0 );
|
|
|
|
|
|
|
|
bool DoRemoveFromSelection( wxPGProperty* prop,
|
|
|
|
int selFlags = 0 );
|
|
|
|
|
2009-08-23 15:31:03 +00:00
|
|
|
void DoBeginLabelEdit( unsigned int colIndex, int selFlags = 0 );
|
|
|
|
void DoEndLabelEdit( bool commit, int selFlags = 0 );
|
|
|
|
void OnLabelEditorEnterPress( wxCommandEvent& event );
|
|
|
|
void OnLabelEditorKeyPress( wxKeyEvent& event );
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* DoGetItemAtY( int y ) const;
|
|
|
|
|
2009-08-23 15:31:03 +00:00
|
|
|
void DestroyEditorWnd( wxWindow* wnd );
|
2008-09-12 20:57:41 +00:00
|
|
|
void FreeEditors();
|
|
|
|
|
|
|
|
virtual bool DoExpand( wxPGProperty* p, bool sendEvent = false );
|
|
|
|
|
|
|
|
virtual bool DoCollapse( wxPGProperty* p, bool sendEvent = false );
|
|
|
|
|
|
|
|
// Returns nearest paint visible property (such that will be painted unless
|
|
|
|
// window is scrolled or resized). If given property is paint visible, then
|
|
|
|
// it itself will be returned.
|
|
|
|
wxPGProperty* GetNearestPaintVisible( wxPGProperty* p ) const;
|
|
|
|
|
|
|
|
static void RegisterDefaultEditors();
|
|
|
|
|
2008-09-26 18:20:17 +00:00
|
|
|
// Sets up basic event handling for child control
|
2008-09-30 16:33:43 +00:00
|
|
|
void SetupChildEventHandling( wxWindow* wnd );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
void CustomSetCursor( int type, bool override = false );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Repositions scrollbar and underlying panel according
|
|
|
|
// to changed virtual size.
|
2008-09-12 20:57:41 +00:00
|
|
|
void RecalculateVirtualSize( int forceXPos = -1 );
|
|
|
|
|
2009-12-22 16:12:02 +00:00
|
|
|
void SetEditorAppearance( const wxPGCell& cell,
|
|
|
|
bool unspecified = false );
|
|
|
|
|
|
|
|
void ResetEditorAppearance()
|
|
|
|
{
|
|
|
|
wxPGCell cell;
|
|
|
|
cell.SetEmptyData();
|
|
|
|
SetEditorAppearance(cell, false);
|
|
|
|
}
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
void PrepareAfterItemsAdded();
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Send event from the property grid.
|
|
|
|
// Omit the wxPG_SEL_NOVALIDATE flag to allow vetoing the event
|
2019-01-09 15:47:00 +00:00
|
|
|
bool SendEvent( wxEventType eventType, wxPGProperty* p,
|
2008-09-12 20:57:41 +00:00
|
|
|
wxVariant* pValue = NULL,
|
2009-08-23 15:31:03 +00:00
|
|
|
unsigned int selFlags = wxPG_SEL_NOVALIDATE,
|
|
|
|
unsigned int column = 1 );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2019-01-07 19:14:35 +00:00
|
|
|
void SendEvent(wxEventType eventType, int intVal);
|
|
|
|
|
2011-03-07 13:02:33 +00:00
|
|
|
// This function only moves focus to the wxPropertyGrid if it already
|
|
|
|
// was on one of its child controls.
|
2008-09-30 07:15:40 +00:00
|
|
|
void SetFocusOnCanvas();
|
2008-09-17 17:34:22 +00:00
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
bool DoHideProperty( wxPGProperty* p, bool hide, int flags );
|
|
|
|
|
2014-10-16 22:49:01 +00:00
|
|
|
void DeletePendingObjects();
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
private:
|
|
|
|
|
2008-10-02 16:02:20 +00:00
|
|
|
bool ButtonTriggerKeyTest( int action, wxKeyEvent& event );
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_EVENT_TABLE();
|
2008-09-12 20:57:41 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-11-22 16:41:05 +00:00
|
|
|
#define wxPG_BASE_EVT_PRE_ID 1775
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
|
2009-02-07 18:59:25 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_SELECTED, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGING, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_CHANGED, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_HIGHLIGHTED, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_RIGHT_CLICK, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_PAGE_CHANGED, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_COLLAPSED, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_ITEM_EXPANDED, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID, wxEVT_PG_DOUBLE_CLICK, wxPropertyGridEvent );
|
2009-08-23 15:31:03 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
|
|
|
|
wxEVT_PG_LABEL_EDIT_BEGIN, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
|
|
|
|
wxEVT_PG_LABEL_EDIT_ENDING, wxPropertyGridEvent );
|
2009-12-12 09:38:10 +00:00
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
|
|
|
|
wxEVT_PG_COL_BEGIN_DRAG, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
|
|
|
|
wxEVT_PG_COL_DRAGGING, wxPropertyGridEvent );
|
|
|
|
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_PROPGRID,
|
|
|
|
wxEVT_PG_COL_END_DRAG, wxPropertyGridEvent );
|
2019-04-27 19:53:49 +00:00
|
|
|
// Events used only internally
|
2019-01-07 19:14:35 +00:00
|
|
|
wxDECLARE_EVENT(wxEVT_PG_HSCROLL, wxPropertyGridEvent);
|
2019-04-27 19:53:49 +00:00
|
|
|
wxDECLARE_EVENT(wxEVT_PG_COLS_RESIZED, wxPropertyGridEvent);
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
enum {
|
|
|
|
wxEVT_PG_SELECTED = wxPG_BASE_EVT_PRE_ID,
|
|
|
|
wxEVT_PG_CHANGING,
|
|
|
|
wxEVT_PG_CHANGED,
|
|
|
|
wxEVT_PG_HIGHLIGHTED,
|
|
|
|
wxEVT_PG_RIGHT_CLICK,
|
|
|
|
wxEVT_PG_PAGE_CHANGED,
|
|
|
|
wxEVT_PG_ITEM_COLLAPSED,
|
|
|
|
wxEVT_PG_ITEM_EXPANDED,
|
2009-08-23 15:31:03 +00:00
|
|
|
wxEVT_PG_DOUBLE_CLICK,
|
|
|
|
wxEVT_PG_LABEL_EDIT_BEGIN,
|
2009-12-12 09:38:10 +00:00
|
|
|
wxEVT_PG_LABEL_EDIT_ENDING,
|
|
|
|
wxEVT_PG_COL_BEGIN_DRAG,
|
|
|
|
wxEVT_PG_COL_DRAGGING,
|
|
|
|
wxEVT_PG_COL_END_DRAG
|
2008-09-12 20:57:41 +00:00
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
#define wxPG_BASE_EVT_TYPE wxEVT_PG_SELECTED
|
|
|
|
#define wxPG_MAX_EVT_TYPE (wxPG_BASE_EVT_TYPE+30)
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef SWIG
|
|
|
|
typedef void (wxEvtHandler::*wxPropertyGridEventFunction)(wxPropertyGridEvent&);
|
|
|
|
|
2010-06-09 14:28:08 +00:00
|
|
|
#define EVT_PG_SELECTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_SELECTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_CHANGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_HIGHLIGHTED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_HIGHLIGHTED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_RIGHT_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_RIGHT_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_DOUBLE_CLICK(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_DOUBLE_CLICK, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_PAGE_CHANGED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_PAGE_CHANGED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_ITEM_COLLAPSED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_COLLAPSED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_ITEM_EXPANDED(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_ITEM_EXPANDED, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_LABEL_EDIT_BEGIN(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_BEGIN, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_LABEL_EDIT_ENDING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_LABEL_EDIT_ENDING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_COL_BEGIN_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_BEGIN_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_COL_DRAGGING(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_DRAGGING, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
|
|
|
#define EVT_PG_COL_END_DRAG(id, fn) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_PG_COL_END_DRAG, id, -1, wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn ), NULL ),
|
2009-01-12 14:26:13 +00:00
|
|
|
|
|
|
|
#define wxPropertyGridEventHandler(fn) \
|
|
|
|
wxEVENT_HANDLER_CAST( wxPropertyGridEventFunction, fn )
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// A propertygrid event holds information about events associated with
|
|
|
|
// wxPropertyGrid objects.
|
2008-09-12 20:57:41 +00:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPropertyGridEvent : public wxCommandEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Constructor.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGridEvent(wxEventType commandType=0, int id=0);
|
2010-02-10 16:45:39 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Copy constructor.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGridEvent(const wxPropertyGridEvent& event);
|
2010-02-10 16:45:39 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Destructor.
|
2008-09-12 20:57:41 +00:00
|
|
|
~wxPropertyGridEvent();
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Copyer.
|
2014-03-30 00:02:23 +00:00
|
|
|
virtual wxEvent* Clone() const wxOVERRIDE;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns the column index associated with this event.
|
|
|
|
// For the column dragging events, it is the column to the left
|
|
|
|
// of the splitter being dragged
|
2009-08-23 15:31:03 +00:00
|
|
|
unsigned int GetColumn() const
|
|
|
|
{
|
|
|
|
return m_column;
|
|
|
|
}
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* GetMainParent() const
|
|
|
|
{
|
|
|
|
wxASSERT(m_property);
|
|
|
|
return m_property->GetMainParent();
|
|
|
|
}
|
|
|
|
|
2016-07-23 21:38:39 +00:00
|
|
|
// Returns property associated with this event.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* GetProperty() const
|
|
|
|
{
|
|
|
|
return m_property;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxPGValidationInfo& GetValidationInfo()
|
|
|
|
{
|
|
|
|
wxASSERT(m_validationInfo);
|
|
|
|
return *m_validationInfo;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns true if you can veto the action that the event is signaling.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool CanVeto() const { return m_canVeto; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Call this from your event handler to veto action that the event is
|
|
|
|
// signaling.
|
|
|
|
// You can only veto a shutdown if wxPropertyGridEvent::CanVeto returns
|
|
|
|
// true.
|
|
|
|
// Currently only wxEVT_PG_CHANGING supports vetoing.
|
2008-09-12 20:57:41 +00:00
|
|
|
void Veto( bool veto = true ) { m_wasVetoed = veto; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns name of the associated property.
|
|
|
|
// Property name is stored in event, so it remains
|
|
|
|
// accessible even after the associated property or
|
|
|
|
// the property grid has been deleted.
|
2009-09-27 14:35:02 +00:00
|
|
|
wxString GetPropertyName() const
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
2009-09-27 14:35:02 +00:00
|
|
|
return m_propertyName;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns value of the associated property. Works for all event
|
|
|
|
// types, but for wxEVT_PG_CHANGING this member function returns
|
|
|
|
// the value that is pending, so you can call Veto() if the
|
|
|
|
// value is not satisfactory.
|
|
|
|
// Property value is stored in event, so it remains
|
|
|
|
// accessible even after the associated property or
|
|
|
|
// the property grid has been deleted.
|
2009-09-27 14:35:02 +00:00
|
|
|
wxVariant GetPropertyValue() const
|
|
|
|
{
|
|
|
|
if ( m_validationInfo )
|
|
|
|
return m_validationInfo->GetValue();
|
|
|
|
return m_value;
|
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns value of the associated property.
|
|
|
|
// See GetPropertyValue()
|
2009-09-27 14:35:02 +00:00
|
|
|
wxVariant GetValue() const
|
|
|
|
{
|
|
|
|
return GetPropertyValue();
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Set override validation failure behaviour.
|
|
|
|
// Only effective if Veto was also called, and only allowed if event type
|
|
|
|
// is wxEVT_PG_CHANGING.
|
2008-09-29 16:23:38 +00:00
|
|
|
void SetValidationFailureBehavior( wxPGVFBFlags flags )
|
2008-09-12 20:57:41 +00:00
|
|
|
{
|
|
|
|
wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
|
2008-09-29 16:23:38 +00:00
|
|
|
m_validationInfo->SetFailureBehavior( flags );
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Sets custom failure message for this time only. Only applies if
|
|
|
|
// wxPG_VFB_SHOW_MESSAGE is set in validation failure flags.
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetValidationFailureMessage( const wxString& message )
|
|
|
|
{
|
|
|
|
wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
|
2008-09-29 16:23:38 +00:00
|
|
|
m_validationInfo->SetFailureMessage( message );
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxPGVFBFlags GetValidationFailureBehavior() const
|
|
|
|
{
|
|
|
|
wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
|
2008-09-29 16:23:38 +00:00
|
|
|
return m_validationInfo->GetFailureBehavior();
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
2009-08-23 15:31:03 +00:00
|
|
|
void SetColumn( unsigned int column )
|
|
|
|
{
|
|
|
|
m_column = column;
|
|
|
|
}
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
void SetCanVeto( bool canVeto ) { m_canVeto = canVeto; }
|
|
|
|
bool WasVetoed() const { return m_wasVetoed; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Changes the property associated with this event.
|
2009-09-27 14:35:02 +00:00
|
|
|
void SetProperty( wxPGProperty* p )
|
|
|
|
{
|
|
|
|
m_property = p;
|
|
|
|
if ( p )
|
|
|
|
m_propertyName = p->GetName();
|
|
|
|
}
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2019-04-05 16:18:07 +00:00
|
|
|
void SetPropertyValue( const wxVariant& value )
|
2009-09-27 14:35:02 +00:00
|
|
|
{
|
|
|
|
m_value = value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetPropertyGrid( wxPropertyGrid* pg )
|
|
|
|
{
|
|
|
|
m_pg = pg;
|
|
|
|
OnPropertyGridSet();
|
|
|
|
}
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
void SetupValidationInfo()
|
|
|
|
{
|
|
|
|
wxASSERT(m_pg);
|
|
|
|
wxASSERT( GetEventType() == wxEVT_PG_CHANGING );
|
|
|
|
m_validationInfo = &m_pg->GetValidationInfo();
|
2009-09-27 14:35:02 +00:00
|
|
|
m_value = m_validationInfo->GetValue();
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void Init();
|
2009-09-27 14:35:02 +00:00
|
|
|
void OnPropertyGridSet();
|
2015-04-23 11:49:01 +00:00
|
|
|
wxDECLARE_DYNAMIC_CLASS(wxPropertyGridEvent);
|
2008-09-12 20:57:41 +00:00
|
|
|
|
|
|
|
wxPGProperty* m_property;
|
|
|
|
wxPropertyGrid* m_pg;
|
|
|
|
wxPGValidationInfo* m_validationInfo;
|
|
|
|
|
2009-09-27 14:35:02 +00:00
|
|
|
wxString m_propertyName;
|
|
|
|
wxVariant m_value;
|
|
|
|
|
2009-08-23 15:31:03 +00:00
|
|
|
unsigned int m_column;
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
bool m_canVeto;
|
|
|
|
bool m_wasVetoed;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Allows populating wxPropertyGrid from arbitrary text source.
|
2008-09-12 20:57:41 +00:00
|
|
|
class WXDLLIMPEXP_PROPGRID wxPropertyGridPopulator
|
|
|
|
{
|
|
|
|
public:
|
2016-06-23 20:02:57 +00:00
|
|
|
// Default constructor.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGridPopulator();
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Destructor.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual ~wxPropertyGridPopulator();
|
|
|
|
|
|
|
|
void SetState( wxPropertyGridPageState* state );
|
|
|
|
|
|
|
|
void SetGrid( wxPropertyGrid* pg );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Appends a new property under bottommost parent.
|
|
|
|
// propClass - Property class as string.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* Add( const wxString& propClass,
|
|
|
|
const wxString& propLabel,
|
|
|
|
const wxString& propName,
|
|
|
|
const wxString* propValue,
|
|
|
|
wxPGChoices* pChoices = NULL );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Pushes property to the back of parent array (ie it becomes bottommost
|
|
|
|
// parent), and starts scanning/adding children for it.
|
|
|
|
// When finished, parent array is returned to the original state.
|
2008-09-12 20:57:41 +00:00
|
|
|
void AddChildren( wxPGProperty* property );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Adds attribute to the bottommost property.
|
|
|
|
// type - Allowed values: "string", (same as string), "int", "bool".
|
|
|
|
// Empty string mean autodetect.
|
2008-09-12 20:57:41 +00:00
|
|
|
bool AddAttribute( const wxString& name,
|
|
|
|
const wxString& type,
|
|
|
|
const wxString& value );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Called once in AddChildren.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual void DoScanForChildren() = 0;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Returns id of parent property for which children can currently be
|
|
|
|
// added.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGProperty* GetCurParent() const
|
|
|
|
{
|
2018-11-01 17:19:55 +00:00
|
|
|
return m_propHierarchy.back();
|
2008-09-12 20:57:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
wxPropertyGridPageState* GetState() { return m_state; }
|
|
|
|
const wxPropertyGridPageState* GetState() const { return m_state; }
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Like wxString::ToLong, except allows N% in addition of N.
|
2008-09-12 20:57:41 +00:00
|
|
|
static bool ToLongPCT( const wxString& s, long* pval, long max );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Parses strings of format "choice1"[=value1] ... "choiceN"[=valueN] into
|
|
|
|
// wxPGChoices. Registers parsed result using idString (if not empty).
|
|
|
|
// Also, if choices with given id already registered, then don't parse but
|
|
|
|
// return those choices instead.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGChoices ParseChoices( const wxString& choicesString,
|
|
|
|
const wxString& idString );
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Implement in derived class to do custom process when an error occurs.
|
|
|
|
// Default implementation uses wxLogError.
|
2008-09-12 20:57:41 +00:00
|
|
|
virtual void ProcessError( const wxString& msg );
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Used property grid.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGrid* m_pg;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Used property grid state.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPropertyGridPageState* m_state;
|
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Tree-hierarchy of added properties (that can have children).
|
2018-11-01 17:19:55 +00:00
|
|
|
wxVector<wxPGProperty*> m_propHierarchy;
|
2008-09-12 20:57:41 +00:00
|
|
|
|
2016-06-23 20:02:57 +00:00
|
|
|
// Hashmap for string-id to wxPGChoicesData mapping.
|
2008-09-12 20:57:41 +00:00
|
|
|
wxPGHashMapS2P m_dictIdChoices;
|
|
|
|
};
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
|
|
|
//
|
|
|
|
// Undefine macros that are not needed outside propertygrid sources
|
|
|
|
//
|
|
|
|
#ifndef __wxPG_SOURCE_FILE__
|
|
|
|
#undef wxPG_FL_DESC_REFRESH_REQUIRED
|
|
|
|
#undef wxPG_FL_CREATEDSTATE
|
|
|
|
#undef wxPG_FL_NOSTATUSBARHELP
|
|
|
|
#undef wxPG_FL_SCROLLED
|
|
|
|
#undef wxPG_FL_CUR_USES_CUSTOM_IMAGE
|
|
|
|
#undef wxPG_FL_PRIMARY_FILLS_ENTIRE
|
|
|
|
#undef wxPG_FL_VALUE_MODIFIED
|
|
|
|
#undef wxPG_FL_MOUSE_INSIDE
|
|
|
|
#undef wxPG_FL_FOCUSED
|
|
|
|
#undef wxPG_FL_MOUSE_CAPTURED
|
|
|
|
#undef wxPG_FL_INITIALIZED
|
|
|
|
#undef wxPG_FL_ACTIVATION_BY_CLICK
|
|
|
|
#undef wxPG_ICON_WIDTH
|
|
|
|
#undef wxPG_USE_RENDERER_NATIVE
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------
|
|
|
|
|
2008-09-17 15:00:00 +00:00
|
|
|
#endif
|
|
|
|
|
2008-09-12 20:57:41 +00:00
|
|
|
#endif // _WX_PROPGRID_PROPGRID_H_
|