diff --git a/interface/wx/aui/floatpane.h b/interface/wx/aui/floatpane.h new file mode 100644 index 0000000000..6bad7019fa --- /dev/null +++ b/interface/wx/aui/floatpane.h @@ -0,0 +1,33 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: wx/aui/floatpane.h +// Purpose: wxaui: wx advanced user interface - docking window manager +// Author: Benjamin I. Williams +// Modified by: +// Created: 2005-05-17 +// Copyright: (C) Copyright 2005, Kirix Corporation, All Rights Reserved. +// Licence: wxWindows Library Licence, Version 3.1 +/////////////////////////////////////////////////////////////////////////////// + + +class wxAuiFloatingFrame : public wxFrame +{ +public: + wxAuiFloatingFrame(wxWindow* parent, + wxAuiManager* ownerMgr, + const wxAuiPaneInfo& pane, + wxWindowID id = wxID_ANY, + long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION | + wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT | + wxCLIP_CHILDREN + ); + virtual ~wxAuiFloatingFrame(); + void SetPaneWindow(const wxAuiPaneInfo& pane); + wxAuiManager* GetOwnerManager() const; + +protected: + virtual void OnMoveStart(); + virtual void OnMoving(const wxRect& windowRect, wxDirection dir); + virtual void OnMoveFinished(); +}; + + diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index 81c493efa4..c2214852c7 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -3667,11 +3667,32 @@ class wxDataViewEvent : public wxNotifyEvent { public: /** - Constructor. Typically used by wxWidgets internals only. + Default ctor, normally shouldn't be used and mostly exists only for + backwards compatibility. */ - wxDataViewEvent(wxEventType commandType = wxEVT_NULL, - int winid = 0); + wxDataViewEvent(); + /** + Constructor for the events affecting columns (and possibly also items). + */ + wxDataViewEvent(wxEventType evtType, + wxDataViewCtrl* dvc, + wxDataViewColumn* column, + const wxDataViewItem& item = wxDataViewItem()); + + /** + Constructor for the events affecting only the items. + */ + wxDataViewEvent(wxEventType evtType, + wxDataViewCtrl* dvc, + const wxDataViewItem& item); + + /** + Copy constructor. + */ + wxDataViewEvent(const wxDataViewEvent& event); + + /** Returns the position of the column in the control or -1 if no column field was set by the event emitter. @@ -3808,7 +3829,6 @@ public: int GetCacheTo() const; - /** Returns the item affected by the event. @@ -3817,6 +3837,7 @@ public: indicating that the drop is about to happen outside of the item area. */ wxDataViewItem GetItem() const; + void SetItem( const wxDataViewItem &item ); void SetPosition( int x, int y ); void SetCache(int from, int to); @@ -3826,6 +3847,7 @@ public: void SetDataBuffer( void* buf ); int GetDragFlags() const; void SetDropEffect( wxDragResult effect ); + void SetEditCancelled(); }; diff --git a/interface/wx/event.h b/interface/wx/event.h index 60e6f98475..7272ace498 100644 --- a/interface/wx/event.h +++ b/interface/wx/event.h @@ -3721,7 +3721,7 @@ public: @since 3.1.1 */ -class wxPanGestureEvent : class wxGestureEvent +class wxPanGestureEvent : public wxGestureEvent { public: /** @@ -3773,7 +3773,7 @@ public: /** Sets the zoom Factor. */ - double SetZoomFactor() const; + void SetZoomFactor(double zoomFactor); }; @@ -4930,6 +4930,7 @@ wxEventType wxEVT_SET_FOCUS; wxEventType wxEVT_KILL_FOCUS; wxEventType wxEVT_CHILD_FOCUS; wxEventType wxEVT_MOUSEWHEEL; +wxEventType wxEVT_MAGNIFY; wxEventType wxEVT_AUX1_DOWN; wxEventType wxEVT_AUX1_UP; wxEventType wxEVT_AUX1_DCLICK; @@ -4963,6 +4964,12 @@ wxEventType wxEVT_SCROLLWIN_PAGEUP; wxEventType wxEVT_SCROLLWIN_PAGEDOWN; wxEventType wxEVT_SCROLLWIN_THUMBTRACK; wxEventType wxEVT_SCROLLWIN_THUMBRELEASE; +wxEventType wxEVT_GESTURE_PAN; +wxEventType wxEVT_GESTURE_ZOOM; +wxEventType wxEVT_GESTURE_ROTATE; +wxEventType wxEVT_TWO_FINGER_TAP; +wxEventType wxEVT_LONG_PRESS; +wxEventType wxEVT_PRESS_AND_TAP; wxEventType wxEVT_SIZE; wxEventType wxEVT_MOVE; wxEventType wxEVT_CLOSE_WINDOW; diff --git a/interface/wx/graphics.h b/interface/wx/graphics.h index 84ab4dd929..792821e61d 100644 --- a/interface/wx/graphics.h +++ b/interface/wx/graphics.h @@ -1573,8 +1573,6 @@ public: wxGraphicsPenInfo& Style(wxPenStyle style); - wxGraphicsPenInfo& Style(wxPenStyle style); - wxGraphicsPenInfo& Stipple(const wxBitmap& stipple); wxGraphicsPenInfo& Dashes(int nb_dashes, const wxDash *dash); diff --git a/interface/wx/grid.h b/interface/wx/grid.h index d4d38c9513..2426c89714 100644 --- a/interface/wx/grid.h +++ b/interface/wx/grid.h @@ -84,8 +84,8 @@ public: @since 3.1.0 */ - virtual wxSize GetBestHeight(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col, int width); + virtual int GetBestHeight(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, + int row, int col, int width); /** Get the preferred width of the cell at the given height. @@ -94,8 +94,8 @@ public: @since 3.1.0 */ - virtual wxSize GetBestWidth(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, - int row, int col, int height); + virtual int GetBestWidth(wxGrid& grid, wxGridCellAttr& attr, wxDC& dc, + int row, int col, int height); protected: /** diff --git a/interface/wx/pen.h b/interface/wx/pen.h index 04000e478f..13f7e65ce6 100644 --- a/interface/wx/pen.h +++ b/interface/wx/pen.h @@ -130,8 +130,6 @@ public: wxPenInfo& Style(wxPenStyle style); - wxPenInfo& Style(wxPenStyle style); - wxPenInfo& Stipple(const wxBitmap& stipple); wxPenInfo& Dashes(int nb_dashes, const wxDash *dash); diff --git a/interface/wx/propgrid/advprops.h b/interface/wx/propgrid/advprops.h new file mode 100644 index 0000000000..0e6a9bcc25 --- /dev/null +++ b/interface/wx/propgrid/advprops.h @@ -0,0 +1,351 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: advprops.h +// Purpose: interfaces of wxPropertyGrid Advanced Properties (font, +// colour, etc.) +// Author: wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + + + +// Web colour is currently unsupported +#define wxPG_COLOUR_WEB_BASE 0x10000 + + +#define wxPG_COLOUR_CUSTOM 0xFFFFFF +#define wxPG_COLOUR_UNSPECIFIED (wxPG_COLOUR_CUSTOM+1) + +/** @class wxColourPropertyValue + + Because text, background and other colours tend to differ between + platforms, wxSystemColourProperty must be able to select between system + colour and, when necessary, to pick a custom one. wxSystemColourProperty + value makes this possible. +*/ +class wxColourPropertyValue : public wxObject +{ +public: + /** An integer value relating to the colour, and which exact + meaning depends on the property with which it is used. + + For wxSystemColourProperty: + + Any of wxSYS_COLOUR_XXX, or any web-colour ( use wxPG_TO_WEB_COLOUR + macro - (currently unsupported) ), or wxPG_COLOUR_CUSTOM. + + For custom colour properties without values array specified: + + index or wxPG_COLOUR_CUSTOM + + For custom colour properties with values array specified: + + m_arrValues[index] or wxPG_COLOUR_CUSTOM + */ + wxUint32 m_type; + + /** Resulting colour. Should be correct regardless of type. */ + wxColour m_colour; + + wxColourPropertyValue(); + wxColourPropertyValue( const wxColourPropertyValue& v ); + wxColourPropertyValue( const wxColour& colour ); + wxColourPropertyValue( wxUint32 type ); + wxColourPropertyValue( wxUint32 type, const wxColour& colour ); + + virtual ~wxColourPropertyValue(); + + void Init( wxUint32 type, const wxColour& colour ); + + void operator=(const wxColourPropertyValue& cpv); +}; + + + +/** @class wxFontProperty + @ingroup classes + Property representing wxFont. +*/ +class wxFontProperty : public wxPGProperty +{ +public: + + wxFontProperty(const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxFont& value = wxFont()); + virtual ~wxFontProperty(); + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + virtual wxVariant ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const; + virtual void RefreshChildren(); +}; + + + + +/** If set, then match from list is searched for a custom colour. */ +#define wxPG_PROP_TRANSLATE_CUSTOM wxPG_PROP_CLASS_SPECIFIC_1 + + +/** @class wxSystemColourProperty + @ingroup classes + Has dropdown list of wxWidgets system colours. Value used is + of wxColourPropertyValue type. +*/ +class wxSystemColourProperty : public wxEnumProperty +{ +public: + + wxSystemColourProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxColourPropertyValue& + value = wxColourPropertyValue() ); + virtual ~wxSystemColourProperty(); + + virtual void OnSetValue(); + virtual bool IntToValue(wxVariant& variant, + int number, + int argFlags = 0) const; + + /** + Override in derived class to customize how colours are printed as + strings. + */ + virtual wxString ColourToString( const wxColour& col, int index, + int argFlags = 0 ) const; + + /** Returns index of entry that triggers colour picker dialog + (default is last). + */ + virtual int GetCustomColourIndex() const; + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + virtual wxSize OnMeasureImage( int item ) const; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ); + + // Helper function to show the colour dialog + bool QueryColourFromUser( wxVariant& variant ) const; + + /** Default is to use wxSystemSettings::GetColour(index). Override to use + custom colour tables etc. + */ + virtual wxColour GetColour( int index ) const; + + wxColourPropertyValue GetVal( const wxVariant* pVariant = NULL ) const; + +protected: + + // Special constructors to be used by derived classes. + wxSystemColourProperty( const wxString& label, const wxString& name, + const wxChar* const* labels, const long* values, wxPGChoices* choicesCache, + const wxColourPropertyValue& value ); + + wxSystemColourProperty( const wxString& label, const wxString& name, + const wxChar* const* labels, const long* values, wxPGChoices* choicesCache, + const wxColour& value ); + + void Init( int type, const wxColour& colour ); + + // Utility functions for internal use + virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const; + wxVariant TranslateVal( wxColourPropertyValue& v ) const; + wxVariant TranslateVal( int type, const wxColour& colour ) const; + + // Translates colour to a int value, return wxNOT_FOUND if no match. + int ColToInd( const wxColour& colour ) const; +}; + + + +class wxColourProperty : public wxSystemColourProperty +{ +public: + wxColourProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxColour& value = *wxWHITE ); + virtual ~wxColourProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual wxColour GetColour( int index ) const; + +protected: + virtual wxVariant DoTranslateVal( wxColourPropertyValue& v ) const; +}; + + + +/** @class wxCursorProperty + @ingroup classes + Property representing wxCursor. +*/ +class wxCursorProperty : public wxEnumProperty +{ +public: + wxCursorProperty( const wxString& label= wxPG_LABEL, + const wxString& name= wxPG_LABEL, + int value = 0 ); + virtual ~wxCursorProperty(); + + virtual wxSize OnMeasureImage( int item ) const; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ); +}; + + +const wxString& wxPGGetDefaultImageWildcard(); + +/** @class wxImageFileProperty + @ingroup classes + Property representing image file(name). +*/ +class wxImageFileProperty : public wxFileProperty +{ +public: + + wxImageFileProperty( const wxString& label= wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString); + virtual ~wxImageFileProperty(); + + virtual void OnSetValue(); + + virtual wxSize OnMeasureImage( int item ) const; + virtual void OnCustomPaint( wxDC& dc, + const wxRect& rect, wxPGPaintData& paintdata ); + +protected: + wxBitmap* m_pBitmap; // final thumbnail area + wxImage* m_pImage; // intermediate thumbnail area +}; + + + +/** @class wxMultiChoiceProperty + @ingroup classes + Property that manages a value resulting from wxMultiChoiceDialog. Value is + array of strings. You can get value as array of choice values/indices by + calling wxMultiChoiceProperty::GetValueAsArrayInt(). + + Supported special attributes: + - "UserStringMode": If > 0, allow user to manually enter strings that are + not in the list of choices. If this value is 1, user strings are + preferably placed in front of valid choices. If value is 2, then those + strings will placed behind valid choices. +*/ +class wxMultiChoiceProperty : public wxPGProperty +{ +public: + + wxMultiChoiceProperty( const wxString& label, + const wxString& name, + const wxArrayString& strings, + const wxArrayString& value ); + wxMultiChoiceProperty( const wxString& label, + const wxString& name, + const wxPGChoices& choices, + const wxArrayString& value = wxArrayString() ); + + wxMultiChoiceProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& value = wxArrayString() ); + + virtual ~wxMultiChoiceProperty(); + + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue(wxVariant& variant, + const wxString& text, + int argFlags = 0) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + + wxArrayInt GetValueAsArrayInt() const; + +protected: + + void GenerateValueAsString( wxVariant& value, wxString* target ) const; + + // Returns translation of values into string indices. + wxArrayInt GetValueAsIndices() const; + + wxArrayString m_valueAsStrings; // Value as array of strings + + // Cache displayed text since generating it is relatively complicated. + wxString m_display; +}; + + + +/** @class wxDateProperty + @ingroup classes + Property representing wxDateTime. + + Supported special attributes: + - "DateFormat": Determines displayed date format. + - "PickerStyle": Determines window style used with wxDatePickerCtrl. + Default is wxDP_DEFAULT | wxDP_SHOWCENTURY. Using wxDP_ALLOWNONE + enables additional support for unspecified property value. +*/ +class wxDateProperty : public wxPGProperty +{ +public: + + wxDateProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxDateTime& value = wxDateTime() ); + virtual ~wxDateProperty(); + + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue(wxVariant& variant, + const wxString& text, + int argFlags = 0) const; + + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + + void SetFormat( const wxString& format ); + const wxString& GetFormat() const; + + void SetDateValue( const wxDateTime& dt ); + wxDateTime GetDateValue() const; + + long GetDatePickerStyle() const; + +protected: + wxString m_format; + long m_dpStyle; // DatePicker style + + static wxString ms_defaultDateFormat; + static wxString DetermineDefaultDateFormat( bool showCentury ); +}; + + + +class wxPGSpinCtrlEditor : public wxPGTextCtrlEditor +{ +public: + virtual ~wxPGSpinCtrlEditor(); + + wxString GetName() const; + virtual wxPGWindowList CreateControls(wxPropertyGrid* propgrid, + wxPGProperty* property, + const wxPoint& pos, + const wxSize& size) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, wxPGProperty* property, + wxWindow* wnd, wxEvent& event ) const; +}; + + +extern wxPGEditor* wxPGEditor_SpinCtrl; +extern wxPGEditor* wxPGEditor_DatePickerCtrl; diff --git a/interface/wx/propgrid/editors.h b/interface/wx/propgrid/editors.h index 32d8f83748..6fe9c15544 100644 --- a/interface/wx/propgrid/editors.h +++ b/interface/wx/propgrid/editors.h @@ -578,35 +578,9 @@ public: wxSize GetPrimarySize() const; }; -/** @class wxPGEditorDialogAdapter - - Derive a class from this to adapt an existing editor dialog or function to - be used when editor button of a property is pushed. - - You only need to derive class and implement DoShowDialog() to create and - show the dialog, and finally submit the value returned by the dialog - via SetValue(). - - @library{wxpropgrid} - @category{propgrid} -*/ -class wxPGEditorDialogAdapter : public wxObject -{ -public: - wxPGEditorDialogAdapter(); - - virtual ~wxPGEditorDialogAdapter(); - - bool ShowDialog( wxPropertyGrid* propGrid, wxPGProperty* property ); - - virtual bool DoShowDialog( wxPropertyGrid* propGrid, - wxPGProperty* property ) = 0; - - void SetValue( wxVariant value ); - - /** - This method is typically only used if deriving class from existing - adapter with value conversion purposes. - */ - wxVariant& GetValue(); -}; +extern wxPGEditor* wxPGEditor_TextCtrl; +extern wxPGEditor* wxPGEditor_Choice; +extern wxPGEditor* wxPGEditor_ComboBox; +extern wxPGEditor* wxPGEditor_TextCtrlAndButton; +extern wxPGEditor* wxPGEditor_CheckBox; +extern wxPGEditor* wxPGEditor_ChoiceAndButton; diff --git a/interface/wx/propgrid/property.h b/interface/wx/propgrid/property.h index 8f56e84036..e12ad51e3f 100644 --- a/interface/wx/propgrid/property.h +++ b/interface/wx/propgrid/property.h @@ -2190,7 +2190,7 @@ public: /** Paints property category selection rectangle. */ - virtual void DrawCaptionSelectionRect(wxWindow *win, wxDC& dc, + virtual void DrawCaptionSelectionRect(wxDC& dc, int x, int y, int w, int h) const; /** Utility to draw vertically centered text. @@ -2706,28 +2706,6 @@ protected: // ----------------------------------------------------------------------- -/** @class wxPGChoiceEntry - - Data of a single wxPGChoices choice. -*/ -class wxPGChoiceEntry : public wxPGCell -{ -public: - wxPGChoiceEntry(); - wxPGChoiceEntry(const wxPGChoiceEntry& other); - wxPGChoiceEntry( const wxString& label, - int value = wxPG_INVALID_VALUE ); - - virtual ~wxPGChoiceEntry(); - - void SetValue( int value ); - int GetValue() const; - - wxPGChoiceEntry& operator=( const wxPGChoiceEntry& other ); -}; - -// ----------------------------------------------------------------------- - /** @class wxPGRootProperty Root parent property. diff --git a/interface/wx/propgrid/propgridpagestate.h b/interface/wx/propgrid/propgridpagestate.h index 328af6c0c6..1a392b7659 100644 --- a/interface/wx/propgrid/propgridpagestate.h +++ b/interface/wx/propgrid/propgridpagestate.h @@ -225,7 +225,14 @@ public: class wxPropertyGridIterator : public wxPropertyGridIteratorBase { public: -}; + wxPropertyGridIterator(); + wxPropertyGridIterator( wxPropertyGridPageState* state, + int flags = wxPG_ITERATE_DEFAULT, + wxPGProperty* property = NULL, int dir = 1 ); + wxPropertyGridIterator( wxPropertyGridPageState* state, + int flags, int startPos, int dir = 0 ); + wxPropertyGridIterator( const wxPropertyGridIterator& it ); + ~wxPropertyGridIterator();}; /** Const version of wxPropertyGridIterator. @@ -242,6 +249,15 @@ public: Additional assignment operator. */ const wxPropertyGridConstIterator& operator=( const wxPropertyGridIterator& it ); + + wxPropertyGridConstIterator(); + wxPropertyGridConstIterator( const wxPropertyGridPageState* state, + int flags = wxPG_ITERATE_DEFAULT, + const wxPGProperty* property = NULL, int dir = 1 ); + wxPropertyGridConstIterator( wxPropertyGridPageState* state, + int flags, int startPos, int dir = 0 ); + wxPropertyGridConstIterator( const wxPropertyGridConstIterator& it ); + ~wxPropertyGridConstIterator(); }; /** @} diff --git a/interface/wx/propgrid/props.h b/interface/wx/propgrid/props.h new file mode 100644 index 0000000000..564916c829 --- /dev/null +++ b/interface/wx/propgrid/props.h @@ -0,0 +1,812 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: props.h +// Purpose: interface of some wxPGProperty subclasses +// Author: wxWidgets team +// Licence: wxWindows licence +///////////////////////////////////////////////////////////////////////////// + + + +/** @class wxPGInDialogValidator + @ingroup classes + Creates and manages a temporary wxTextCtrl for validation purposes. + Uses wxPropertyGrid's current editor, if available. +*/ +class wxPGInDialogValidator +{ +public: + wxPGInDialogValidator(); + ~wxPGInDialogValidator(); + + bool DoValidate( wxPropertyGrid* propGrid, + wxValidator* validator, + const wxString& value ); +}; + + +// ----------------------------------------------------------------------- +// Property classes +// ----------------------------------------------------------------------- + +#define wxPG_PROP_PASSWORD wxPG_PROP_CLASS_SPECIFIC_2 + +/** @class wxStringProperty + @ingroup classes + Basic property with string value. + + Supported special attributes: + - "Password": set to 1 in order to enable wxTE_PASSWORD on the editor. + + @remarks + - If value "" is set, then actual value is formed (or composed) + from values of child properties. +*/ +class wxStringProperty : public wxPGProperty +{ +public: + wxStringProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxStringProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + + /** This is updated so "" special value can be handled. + */ + virtual void OnSetValue(); +}; + + +/** Constants used with NumericValidation<>(). +*/ +enum wxPGNumericValidationConstants +{ + /** Instead of modifying the value, show an error message. + */ + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE = 0, + + /** Modify value, but stick with the limitations. + */ + wxPG_PROPERTY_VALIDATION_SATURATE = 1, + + /** Modify value, wrap around on overflow. + */ + wxPG_PROPERTY_VALIDATION_WRAP = 2 +}; + + + +/** + A more comprehensive numeric validator class. +*/ +class wxNumericPropertyValidator : public wxTextValidator +{ +public: + enum NumericType + { + Signed = 0, + Unsigned, + Float + }; + + wxNumericPropertyValidator( NumericType numericType, int base = 10 ); + virtual ~wxNumericPropertyValidator() { } + virtual bool Validate(wxWindow* parent); +}; + + + +/** @class wxIntProperty + @ingroup classes + Basic property with integer value. + + Seamlessly supports 64-bit integer (wxLongLong) on overflow. + + Example how to use seamless 64-bit integer support + + Getting value: + + @code + wxLongLong_t value = pg->GetPropertyValueAsLongLong(); + @endcode + + or + + @code + wxLongLong_t value; + wxVariant variant = property->GetValue(); + if ( variant.GetType() == "wxLongLong" ) + value = wxLongLongFromVariant(variant); + else + value = variant.GetLong(); + @endcode + + Setting value: + + @code + pg->SetPropertyValue(longLongVal); + @endcode + + or + + @code + property->SetValue(WXVARIANT(longLongVal)); + @endcode + + + Supported special attributes: + - "Min", "Max": Specify acceptable value range. +*/ +class wxIntProperty : public wxPGProperty +{ +public: + wxIntProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + long value = 0 ); + virtual ~wxIntProperty(); + + wxIntProperty( const wxString& label, + const wxString& name, + const wxLongLong& value ); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const; + virtual bool IntToValue( wxVariant& variant, + int number, + int argFlags = 0 ) const; + static wxValidator* GetClassValidator(); + virtual wxValidator* DoGetValidator() const; + + /** Validation helper. + */ + static bool DoValidation( const wxPGProperty* property, + wxLongLong_t& value, + wxPGValidationInfo* pValidationInfo, + int mode = + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ); +}; + + +/** @class wxUIntProperty + @ingroup classes + Basic property with unsigned integer value. + Seamlessly supports 64-bit integer (wxULongLong) on overflow. + + Supported special attributes: + - "Min", "Max": Specify acceptable value range. + - "Base": Define base. Valid constants are wxPG_BASE_OCT, wxPG_BASE_DEC, + wxPG_BASE_HEX and wxPG_BASE_HEXL (lowercase characters). Arbitrary bases + are not supported. + - "Prefix": Possible values are wxPG_PREFIX_NONE, wxPG_PREFIX_0x, and + wxPG_PREFIX_DOLLAR_SIGN. Only wxPG_PREFIX_NONE works with Decimal and Octal + numbers. + + @remarks + - For example how to use seamless 64-bit integer support, see wxIntProperty + documentation (just use wxULongLong instead of wxLongLong). +*/ +class wxUIntProperty : public wxPGProperty +{ +public: + wxUIntProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + unsigned long value = 0 ); + virtual ~wxUIntProperty(); + wxUIntProperty( const wxString& label, + const wxString& name, + const wxULongLong& value ); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const; + virtual wxValidator* DoGetValidator () const; + virtual bool IntToValue( wxVariant& variant, + int number, + int argFlags = 0 ) const; +protected: + wxByte m_base; + wxByte m_realBase; // translated to 8,16,etc. + wxByte m_prefix; +}; + + +/** @class wxFloatProperty + @ingroup classes + Basic property with double-precision floating point value. + + Supported special attributes: + - "Precision": Sets the (max) precision used when floating point value is + rendered as text. The default -1 means infinite precision. +*/ +class wxFloatProperty : public wxPGProperty +{ +public: + wxFloatProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + double value = 0.0 ); + virtual ~wxFloatProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + virtual wxVariant DoGetAttribute( const wxString& name ) const; + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const; + + /** Validation helper. + */ + static bool DoValidation( const wxPGProperty* property, + double& value, + wxPGValidationInfo* pValidationInfo, + int mode = + wxPG_PROPERTY_VALIDATION_ERROR_MESSAGE ); + static wxValidator* GetClassValidator(); + virtual wxValidator* DoGetValidator () const; + +protected: + int m_precision; +}; + + + +/** @class wxBoolProperty + @ingroup classes + Basic property with boolean value. + + Supported special attributes: + - "UseCheckbox": Set to 1 to use check box editor instead of combo box. + - "UseDClickCycling": Set to 1 to cycle combo box instead showing the list. +*/ +class wxBoolProperty : public wxPGProperty +{ +public: + wxBoolProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + bool value = false ); + virtual ~wxBoolProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool IntToValue( wxVariant& variant, + int number, int argFlags = 0 ) const; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); +}; + + + +// If set, then selection of choices is static and should not be +// changed (i.e. returns NULL in GetPropertyChoices). +#define wxPG_PROP_STATIC_CHOICES wxPG_PROP_CLASS_SPECIFIC_1 + +/** @class wxEnumProperty + @ingroup classes + You can derive custom properties with choices from this class. See + wxBaseEnumProperty for remarks. + + @remarks + - Updating private index is important. You can do this either by calling + SetIndex() in IntToValue, and then letting wxBaseEnumProperty::OnSetValue + be called (by not implementing it, or by calling super class function in + it) -OR- you can just call SetIndex in OnSetValue. +*/ +class wxEnumProperty : public wxPGProperty +{ +public: + wxEnumProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxChar* const* labels = NULL, + const long* values = NULL, + int value = 0 ); + + wxEnumProperty( const wxString& label, + const wxString& name, + wxPGChoices& choices, + int value = 0 ); + + // Special constructor for caching choices (used by derived class) + wxEnumProperty( const wxString& label, + const wxString& name, + const wxChar* const* labels, + const long* values, + wxPGChoices* choicesCache, + int value = 0 ); + + wxEnumProperty( const wxString& label, + const wxString& name, + const wxArrayString& labels, + const wxArrayInt& values = wxArrayInt(), + int value = 0 ); + + virtual ~wxEnumProperty(); + + size_t GetItemCount() const; + + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool ValidateValue( wxVariant& value, + wxPGValidationInfo& validationInfo ) const; + + // If wxPG_FULL_VALUE is not set in flags, then the value is interpreted + // as index to choices list. Otherwise, it is actual value. + virtual bool IntToValue( wxVariant& variant, + int number, + int argFlags = 0 ) const; + + // + // Additional virtuals + + // This must be overridden to have non-index based value + virtual int GetIndexForValue( int value ) const; + + // GetChoiceSelection needs to overridden since m_index is + // the true index, and various property classes derived from + // this take advantage of it. + virtual int GetChoiceSelection() const; + + virtual void OnValidationFailure( wxVariant& pendingValue ); + +protected: + + int GetIndex() const; + void SetIndex( int index ); + + bool ValueFromString_( wxVariant& value, + const wxString& text, + int argFlags ) const; + bool ValueFromInt_( wxVariant& value, int intVal, int argFlags ) const; + + static void ResetNextIndex(); + +}; + + + +/** @class wxEditEnumProperty + @ingroup classes + wxEnumProperty with wxString value and writable combo box editor. + + @remarks + Uses int value, similar to wxEnumProperty, unless text entered by user is + is not in choices (in which case string value is used). +*/ +class wxEditEnumProperty : public wxEnumProperty +{ +public: + + wxEditEnumProperty( const wxString& label, + const wxString& name, + const wxChar* const* labels, + const long* values, + const wxString& value ); + + wxEditEnumProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& labels = wxArrayString(), + const wxArrayInt& values = wxArrayInt(), + const wxString& value = wxEmptyString ); + + wxEditEnumProperty( const wxString& label, + const wxString& name, + wxPGChoices& choices, + const wxString& value = wxEmptyString ); + + // Special constructor for caching choices (used by derived class) + wxEditEnumProperty( const wxString& label, + const wxString& name, + const wxChar* const* labels, + const long* values, + wxPGChoices* choicesCache, + const wxString& value ); + + virtual ~wxEditEnumProperty(); + +}; + + + +/** @class wxFlagsProperty + @ingroup classes + Represents a bit set that fits in a long integer. wxBoolProperty + sub-properties are created for editing individual bits. Textctrl is created + to manually edit the flags as a text; a continuous sequence of spaces, + commas and semicolons is considered as a flag id separator. + Note: When changing "choices" (ie. flag labels) of wxFlagsProperty, + you will need to use SetPropertyChoices - otherwise they will not get + updated properly. +*/ +class wxFlagsProperty : public wxPGProperty +{ +public: + + wxFlagsProperty( const wxString& label, + const wxString& name, + const wxChar* const* labels, + const long* values = NULL, + long value = 0 ); + + wxFlagsProperty( const wxString& label, + const wxString& name, + wxPGChoices& choices, + long value = 0 ); + + wxFlagsProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& labels = wxArrayString(), + const wxArrayInt& values = wxArrayInt(), + int value = 0 ); + + virtual ~wxFlagsProperty (); + + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int flags ) const; + virtual wxVariant ChildChanged( wxVariant& thisValue, + int childIndex, + wxVariant& childValue ) const; + virtual void RefreshChildren(); + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + + // GetChoiceSelection needs to overridden since m_choices is + // used and value is integer, but it is not index. + virtual int GetChoiceSelection() const; + + // helpers + size_t GetItemCount() const; + const wxString& GetLabel( size_t ind ) const; + +protected: + // Used to detect if choices have been changed + wxPGChoicesData* m_oldChoicesData; + + // Needed to properly mark changed sub-properties + long m_oldValue; + + // Converts string id to a relevant bit. + long IdToBit( const wxString& id ) const; + + // Creates children and sets value. + void Init(); +}; + + + +/** @class wxPGFileDialogAdapter + @ingroup classes +*/ +class wxPGFileDialogAdapter : public wxPGEditorDialogAdapter +{ +public: + virtual bool DoShowDialog( wxPropertyGrid* propGrid, + wxPGProperty* property ); +}; + + + +// Indicates first bit useable by derived properties. +#define wxPG_PROP_SHOW_FULL_FILENAME wxPG_PROP_CLASS_SPECIFIC_1 + +/** @class wxFileProperty + @ingroup classes + Like wxLongStringProperty, but the button triggers file selector instead. + + Supported special attributes: + - "Wildcard": Sets wildcard (see wxFileDialog for format details), "All + files..." is default. + - "ShowFullPath": Default 1. When 0, only the file name is shown (i.e. drive + and directory are hidden). + - "ShowRelativePath": If set, then the filename is shown relative to the + given path string. + - "InitialPath": Sets the initial path of where to look for files. + - "DialogTitle": Sets a specific title for the dir dialog. +*/ +class wxFileProperty : public wxPGProperty +{ +public: + + wxFileProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxFileProperty (); + + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual wxPGEditorDialogAdapter* GetEditorDialog() const; + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + + static wxValidator* GetClassValidator(); + virtual wxValidator* DoGetValidator() const; + + /** + Returns filename to file represented by current value. + */ + wxFileName GetFileName() const; + +protected: + wxString m_wildcard; + wxString m_basePath; // If set, then show path relative to it + wxString m_initialPath; // If set, start the file dialog here + wxString m_dlgTitle; // If set, used as title for file dialog + int m_indFilter; // index to the selected filter +}; + + + +#define wxPG_PROP_NO_ESCAPE wxPG_PROP_CLASS_SPECIFIC_1 + +/** @class wxPGLongStringDialogAdapter + @ingroup classes +*/ +class wxPGLongStringDialogAdapter : public wxPGEditorDialogAdapter +{ +public: + virtual bool DoShowDialog( wxPropertyGrid* propGrid, + wxPGProperty* property ); +}; + + +/** @class wxLongStringProperty + @ingroup classes + Like wxStringProperty, but has a button that triggers a small text + editor dialog. +*/ +class wxLongStringProperty : public wxPGProperty +{ +public: + + wxLongStringProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxLongStringProperty(); + + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + + // Shows string editor dialog. Value to be edited should be read from + // value, and if dialog is not cancelled, it should be stored back and true + // should be returned if that was the case. + virtual bool OnButtonClick( wxPropertyGrid* propgrid, wxString& value ); + + static bool DisplayEditorDialog( wxPGProperty* prop, + wxPropertyGrid* propGrid, + wxString& value ); +}; + + + + +/** @class wxDirProperty + @ingroup classes + Like wxLongStringProperty, but the button triggers dir selector instead. + + Supported special attributes: + - "DialogMessage": Sets specific message in the dir selector. +*/ +class wxDirProperty : public wxLongStringProperty +{ +public: + wxDirProperty( const wxString& name = wxPG_LABEL, + const wxString& label = wxPG_LABEL, + const wxString& value = wxEmptyString ); + virtual ~wxDirProperty(); + + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + virtual wxValidator* DoGetValidator() const; + + virtual bool OnButtonClick ( wxPropertyGrid* propGrid, wxString& value ); + +protected: + wxString m_dlgMessage; +}; + + +// wxBoolProperty specific flags +#define wxPG_PROP_USE_CHECKBOX wxPG_PROP_CLASS_SPECIFIC_1 +// DCC = Double Click Cycles +#define wxPG_PROP_USE_DCC wxPG_PROP_CLASS_SPECIFIC_2 + + + +/** @class wxArrayStringProperty + @ingroup classes + Property that manages a list of strings. +*/ +class wxArrayStringProperty : public wxPGProperty +{ +public: + wxArrayStringProperty( const wxString& label = wxPG_LABEL, + const wxString& name = wxPG_LABEL, + const wxArrayString& value = wxArrayString() ); + virtual ~wxArrayStringProperty(); + + virtual void OnSetValue(); + virtual wxString ValueToString( wxVariant& value, int argFlags = 0 ) const; + virtual bool StringToValue( wxVariant& variant, + const wxString& text, + int argFlags = 0 ) const; + virtual bool OnEvent( wxPropertyGrid* propgrid, + wxWindow* primary, wxEvent& event ); + virtual bool DoSetAttribute( const wxString& name, wxVariant& value ); + + // Implement in derived class for custom array-to-string conversion. + virtual void ConvertArrayToString(const wxArrayString& arr, + wxString* pString, + const wxUniChar& delimiter) const; + + // Shows string editor dialog. Value to be edited should be read from + // value, and if dialog is not cancelled, it should be stored back and true + // should be returned if that was the case. + virtual bool OnCustomStringEdit( wxWindow* parent, wxString& value ); + + // Helper. + virtual bool OnButtonClick( wxPropertyGrid* propgrid, + wxWindow* primary, + const wxChar* cbt ); + + // Creates wxPGArrayEditorDialog for string editing. Called in OnButtonClick. + virtual wxPGArrayEditorDialog* CreateEditorDialog(); + + enum ConversionFlags + { + Escape = 0x01, + QuoteStrings = 0x02 + }; + + /** + Generates contents for string dst based on the contents of + wxArrayString src. + */ + static void ArrayStringToString( wxString& dst, const wxArrayString& src, + wxUniChar delimiter, int flags ); + +protected: + // Previously this was to be implemented in derived class for array-to- + // string conversion. Now you should implement ConvertValueToString() + // instead. + virtual void GenerateValueAsString(); + + wxString m_display; // Cache for displayed text. + wxUniChar m_delimiter; +}; + + +// ----------------------------------------------------------------------- +// wxPGArrayEditorDialog +// ----------------------------------------------------------------------- + +#define wxAEDIALOG_STYLE \ + (wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxOK | wxCANCEL | wxCENTRE) + +class wxPGArrayEditorDialog : public wxDialog +{ +public: + wxPGArrayEditorDialog(); + virtual ~wxPGArrayEditorDialog(); + + void Init(); + + wxPGArrayEditorDialog( wxWindow *parent, + const wxString& message, + const wxString& caption, + long style = wxAEDIALOG_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize ); + + bool Create( wxWindow *parent, + const wxString& message, + const wxString& caption, + long style = wxAEDIALOG_STYLE, + const wxPoint& pos = wxDefaultPosition, + const wxSize& sz = wxDefaultSize ); + + void EnableCustomNewAction(); + + /** Set value modified by dialog. + */ + virtual void SetDialogValue( const wxVariant& value ); + + /** Return value modified by dialog. + */ + virtual wxVariant GetDialogValue() const; + + /** Override to return wxValidator to be used with the wxTextCtrl + in dialog. Note that the validator is used in the standard + wx way, ie. it immediately prevents user from entering invalid + input. + + @remarks + Dialog frees the validator. + */ + virtual wxValidator* GetTextCtrlValidator() const; + + // Returns true if array was actually modified + bool IsModified() const; + + // wxEditableListBox utilities + int GetSelection() const; + +protected: + wxEditableListBox* m_elb; + + // These are used for focus repair + wxWindow* m_elbSubPanel; + wxWindow* m_lastFocused; + + // A new item, edited by user, is pending at this index. + // It will be committed once list ctrl item editing is done. + int m_itemPendingAtIndex; + + bool m_modified; + bool m_hasCustomNewAction; + + // These must be overridden - must return true on success. + virtual wxString ArrayGet( size_t index ) = 0; + virtual size_t ArrayGetCount() = 0; + virtual bool ArrayInsert( const wxString& str, int index ) = 0; + virtual bool ArraySet( size_t index, const wxString& str ) = 0; + virtual void ArrayRemoveAt( int index ) = 0; + virtual void ArraySwap( size_t first, size_t second ) = 0; + + virtual bool OnCustomNewAction(wxString* resString); +}; + + +// ----------------------------------------------------------------------- +// wxPGArrayStringEditorDialog +// ----------------------------------------------------------------------- + +class wxPGArrayStringEditorDialog : public wxPGArrayEditorDialog +{ +public: + wxPGArrayStringEditorDialog(); + virtual ~wxPGArrayStringEditorDialog() { } + + void Init(); + + virtual void SetDialogValue( const wxVariant& value ); + virtual wxVariant GetDialogValue() const; + + void SetCustomButton( const wxString& custBtText, + wxArrayStringProperty* pcc ); + + virtual bool OnCustomNewAction(wxString* resString); + +protected: + wxArrayString m_array; + + wxArrayStringProperty* m_pCallingClass; + + virtual wxString ArrayGet( size_t index ); + virtual size_t ArrayGetCount(); + virtual bool ArrayInsert( const wxString& str, int index ); + virtual bool ArraySet( size_t index, const wxString& str ); + virtual void ArrayRemoveAt( int index ); + virtual void ArraySwap( size_t first, size_t second ); +}; + diff --git a/interface/wx/richtext/richtextbuffer.h b/interface/wx/richtext/richtextbuffer.h index 833b8400f8..b86c9bd32f 100644 --- a/interface/wx/richtext/richtextbuffer.h +++ b/interface/wx/richtext/richtextbuffer.h @@ -4886,7 +4886,7 @@ public: /** Do the loading and scaling */ - virtual bool LoadAndScaleImageCache(wxImage& image, const wxSize& sz, bool delayLoading, bool& changed); + virtual bool LoadAndScaleImageCache(wxImage& image, const wxSize& sz, wxRichTextDrawingContext& context, bool& changed); /** Gets the image state. diff --git a/interface/wx/toolbar.h b/interface/wx/toolbar.h index da12c697a0..e3a58f53e8 100644 --- a/interface/wx/toolbar.h +++ b/interface/wx/toolbar.h @@ -106,6 +106,7 @@ public: bool IsStretchableSpace() const; int GetStyle() const; wxItemKind GetKind() const; + void MakeStretchable(); bool IsEnabled() const; bool IsToggled() const; @@ -122,9 +123,21 @@ public: wxObject *GetClientData() const; + virtual bool Enable(bool enable); + virtual bool Toggle(bool toggle); + virtual bool SetToggle(bool toggle); + virtual bool SetShortHelp(const wxString& help); + virtual bool SetLongHelp(const wxString& help); + void Toggle(); + virtual void SetNormalBitmap(const wxBitmap& bmp); + virtual void SetDisabledBitmap(const wxBitmap& bmp); + virtual void SetLabel(const wxString& label); + void SetClientData(wxObject *clientData); + virtual void Detach(); virtual void Attach(wxToolBarBase *tbar); + virtual void SetDropdownMenu(wxMenu *menu); wxMenu *GetDropdownMenu() const; }; diff --git a/interface/wx/window.h b/interface/wx/window.h index 1ddd6c345e..6cdd4974c8 100644 --- a/interface/wx/window.h +++ b/interface/wx/window.h @@ -1044,7 +1044,7 @@ public: static wxPoint FromDIP(const wxPoint& pt, const wxWindow* w); /// @overload - static wxSize FromDIP(int d, const wxWindow* w); + static int FromDIP(int d, const wxWindow* w); /** @@ -1111,7 +1111,7 @@ public: static wxPoint ToDIP(const wxPoint& pt, const wxWindow* w); /// @overload - static wxSize ToDIP(int d, const wxWindow* w); + static int ToDIP(int d, const wxWindow* w); /** This functions returns the best acceptable minimal size for the window.