// Created: 2004-09-25
// RCS-ID: $Id$
// Copyright: (c) Jaakko Salli
-// Licence: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifndef _WX_PROPGRID_PROPGRID_H_
#define _WX_PROPGRID_PROPGRID_H_
+#include "wx/defs.h"
+
#if wxUSE_PROPGRID
#include "wx/thread.h"
#include "wx/dcclient.h"
+#include "wx/control.h"
#include "wx/scrolwin.h"
#include "wx/tooltip.h"
#include "wx/datetime.h"
class wxPGComboBox;
+#if wxUSE_STATUSBAR
+class WXDLLIMPEXP_FWD_CORE wxStatusBar;
+#endif
+
// -----------------------------------------------------------------------
// Global variables
// -----------------------------------------------------------------------
*/
wxPG_VFB_MARK_CELL = 0x04,
-/** Display customizable text message explaining the situation.
+/**
+ 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 behavior is to display the text on
+ the top-level frame's status bar, if present, and otherwise
+ using wxMessageBox.
*/
wxPG_VFB_SHOW_MESSAGE = 0x08,
+/**
+ Similar to wxPG_VFB_SHOW_MESSAGE, except always displays the
+ message using wxMessageBox.
+*/
+wxPG_VFB_SHOW_MESSAGEBOX = 0x10,
+
+/**
+ 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).
+*/
+wxPG_VFB_SHOW_MESSAGE_ON_STATUSBAR = 0x20,
+
/** Defaults. */
-wxPG_VFB_DEFAULT = wxPG_VFB_STAY_IN_PROPERTY|wxPG_VFB_BEEP,
+wxPG_VFB_DEFAULT = wxPG_VFB_MARK_CELL |
+ wxPG_VFB_SHOW_MESSAGEBOX,
/** Only used internally. */
wxPG_VFB_UNDEFINED = 0x80
{
friend class wxPropertyGrid;
public:
+ wxPGValidationInfo()
+ {
+ m_failureBehavior = 0;
+ m_isFailing = false;
+ }
+
+ ~wxPGValidationInfo()
+ {
+ }
+
/**
@return Returns failure behavior which is a combination of
@ref propgrid_vfbflags.
/** Validation failure behavior. Use wxPG_VFB_XXX flags.
*/
wxPGVFBFlags m_failureBehavior;
+
+ // True when validation is currently failing.
+ bool m_isFailing;
};
// -----------------------------------------------------------------------
@library{wxpropgrid}
@category{propgrid}
*/
-class WXDLLIMPEXP_PROPGRID
- wxPropertyGrid : public wxScrolledWindow, public wxPropertyGridInterface
+class WXDLLIMPEXP_PROPGRID wxPropertyGrid : public wxControl,
+ public wxScrollHelper,
+ public wxPropertyGridInterface
{
friend class wxPropertyGridEvent;
friend class wxPropertyGridPageState;
#endif
/** The default constructor. The styles to be used are styles valid for
- the wxWindow and wxScrolledWindow.
+ the wxWindow.
@see @link wndflags Additional Window Styles @endlink
*/
/**
Centers the splitter.
-
+
@param enableAutoResizing
If @true, automatic column resizing is enabled (only applicapple
if window style wxPG_SPLITTER_AUTO_CENTER is used).
@param pt
Coordinates in the virtual grid space. You may need to use
- wxScrolledWindow::CalcScrolledPosition() for translating
+ wxScrolled<T>::CalcScrolledPosition() for translating
wxPropertyGrid client coordinates into something this member
function can use.
*/
// Events from editor controls are forward to this function
void HandleCustomEditorEvent( wxEvent &event );
- /**
- Generates contents for string dst based on the contents of
- wxArrayString src.
-
- Format will be "(preDelim)str1(postDelim) (preDelim)str2(postDelim) and
- so on. Set flags to 1 inorder to convert backslashes to double-back-
- slashes and "(preDelims)"'s to "(preDelims)".
- */
- static void ArrayStringToString( wxString& dst, const wxArrayString& src,
- wxChar preDelim, wxChar postDelim,
- int flags );
-
// Mostly useful for page switching.
void SwitchState( wxPropertyGridPageState* pNewState );
m_validationInfo.m_failureMessage.clear();
}
- /** Override in derived class to display error messages in custom manner
+ /**
+ Override in derived class to display error messages in custom manner
(these message usually only result from validation failure).
+
+ @remarks 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).
+
+ @see DoHidePropertyError()
*/
virtual void DoShowPropertyError( wxPGProperty* property,
const wxString& msg );
+ /**
+ Override in derived class to hide an error displayed by
+ DoShowPropertyError().
+
+ @see DoShowPropertyError()
+ */
+ virtual void DoHidePropertyError( wxPGProperty* property );
+
+#if wxUSE_STATUSBAR
+ /**
+ Return wxStatusBar that is used by this wxPropertyGrid. You can
+ reimplement this member function in derived class to override
+ the default behavior of using the top-level wxFrame's status
+ bar, if any.
+ */
+ virtual wxStatusBar* GetStatusBar();
+#endif
+
/** Override to customize property validation failure behavior.
@param invalidValue
Value which failed in validation.
virtual void Refresh( bool eraseBackground = true,
const wxRect *rect = (const wxRect *) NULL );
virtual bool SetFont( const wxFont& font );
-#if wxPG_SUPPORT_TOOLTIPS
- void SetToolTip( const wxString& tipString );
-#endif
virtual void Freeze();
virtual void SetExtraStyle( long exStyle );
virtual void Thaw();
/** Current cursor id. */
int m_curcursor;
- /**
- This captionFont is made equal to the font of the wxScrolledWindow.
-
- As extra the bold face is set on it when this is wanted by the user
- (see flags)
- */
+ // Caption font. Same as normal font plus bold style.
wxFont m_captionFont;
int m_fontHeight; // Height of the font.
unsigned char m_keyComboConsumed;
/** 1 if in DoPropertyChanged() */
- unsigned char m_inDoPropertyChanged;
+ bool m_inDoPropertyChanged;
/** 1 if in CommitChangesFromEditor() */
- unsigned char m_inCommitChangesFromEditor;
+ bool m_inCommitChangesFromEditor;
/** 1 if in DoSelectProperty() */
- unsigned char m_inDoSelectProperty;
+ bool m_inDoSelectProperty;
+
+ bool m_inOnValidationFailure;
wxPGVFBFlags m_permanentValidationFailureBehavior; // Set by app
void CorrectEditorWidgetPosY();
int DoDrawItems( wxDC& dc,
- const wxRect* drawRect,
+ const wxRect* itemsRect,
bool isBuffered ) const;
/** Draws an expand/collapse (ie. +/-) button.
void DrawItems( wxDC& dc,
unsigned int topItemY,
unsigned int bottomItemY,
- const wxRect* drawRect = NULL );
+ const wxRect* itemsRect = NULL );
// Translate wxKeyEvent to wxPG_ACTION_XXX
int KeyEventToActions(wxKeyEvent &event, int* pSecond) const;