+ wxDIALOG_ADAPTATION_MODE_DEFAULT = 0, // use global adaptation enabled status
+ wxDIALOG_ADAPTATION_MODE_ENABLED = 1, // enable this dialog overriding global status
+ wxDIALOG_ADAPTATION_MODE_DISABLED = 2 // disable this dialog overriding global status
+};
+
+enum wxDialogModality
+{
+ wxDIALOG_MODALITY_NONE = 0,
+ wxDIALOG_MODALITY_WINDOW_MODAL = 1,
+ wxDIALOG_MODALITY_APP_MODAL = 2
+};
+
+extern WXDLLIMPEXP_DATA_CORE(const char) wxDialogNameStr[];
+
+class WXDLLIMPEXP_CORE wxDialogBase : public wxTopLevelWindow
+{
+public:
+ wxDialogBase() { Init(); }
+ virtual ~wxDialogBase() { }
+
+ // define public wxDialog methods to be implemented by the derived classes
+ virtual int ShowModal() = 0;
+ virtual void EndModal(int retCode) = 0;
+ virtual bool IsModal() const = 0;
+ // show the dialog frame-modally (needs a parent), using app-modal
+ // dialogs on platforms that don't support it
+ virtual void ShowWindowModal () ;
+ virtual void SendWindowModalDialogEvent ( wxEventType type );
+
+ // Modal dialogs have a return code - usually the id of the last
+ // pressed button
+ void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
+ int GetReturnCode() const { return m_returnCode; }
+
+ // Set the identifier for the affirmative button: this button will close
+ // the dialog after validating data and calling TransferDataFromWindow()
+ void SetAffirmativeId(int affirmativeId);
+ int GetAffirmativeId() const { return m_affirmativeId; }
+
+ // Set identifier for Esc key translation: the button with this id will
+ // close the dialog without doing anything else; special value wxID_NONE
+ // means to not handle Esc at all while wxID_ANY means to map Esc to
+ // wxID_CANCEL if present and GetAffirmativeId() otherwise
+ void SetEscapeId(int escapeId);
+ int GetEscapeId() const { return m_escapeId; }
+
+ // Find the parent to use for modal dialog: try to use the specified parent
+ // but fall back to the current active window or main application window as
+ // last resort if it is unsuitable.
+ //
+ // As this function is often called from the ctor, the window style may be
+ // not set yet and hence must be passed explicitly to it so that we could
+ // check whether it contains wxDIALOG_NO_PARENT bit.
+ //
+ // This function always returns a valid top level window or NULL.
+ wxWindow *GetParentForModalDialog(wxWindow *parent, long style) const;
+
+ // This overload can only be used for already initialized windows, i.e. not
+ // from the ctor. It uses the current window parent and style.
+ wxWindow *GetParentForModalDialog() const
+ {
+ return GetParentForModalDialog(GetParent(), GetWindowStyle());
+ }
+
+#if wxUSE_STATTEXT // && wxUSE_TEXTCTRL
+ // splits text up at newlines and places the
+ // lines into a vertical wxBoxSizer
+ wxSizer *CreateTextSizer( const wxString &message );
+#endif // wxUSE_STATTEXT // && wxUSE_TEXTCTRL
+
+ // returns a horizontal wxBoxSizer containing the given buttons
+ //
+ // notice that the returned sizer can be NULL if no buttons are put in the
+ // sizer (this mostly happens under smart phones and other atypical
+ // platforms which have hardware buttons replacing OK/Cancel and such)
+ wxSizer *CreateButtonSizer(long flags);
+
+ // returns the sizer containing CreateButtonSizer() below a separating
+ // static line for the platforms which use static lines for items
+ // separation (i.e. not Mac)
+ wxSizer *CreateSeparatedButtonSizer(long flags);
+
+#if wxUSE_BUTTON
+ wxStdDialogButtonSizer *CreateStdDialogButtonSizer( long flags );
+#endif // wxUSE_BUTTON
+
+ // Do layout adaptation
+ virtual bool DoLayoutAdaptation();
+
+ // Can we do layout adaptation?
+ virtual bool CanDoLayoutAdaptation();
+
+ // Returns a content window if there is one. This can be used by the layout adapter, for
+ // example to make the pages of a book control into scrolling windows
+ virtual wxWindow* GetContentWindow() const { return NULL; }
+
+ // Add an id to the list of main button identifiers that should be in the button sizer
+ void AddMainButtonId(wxWindowID id) { m_mainButtonIds.Add((int) id); }
+ wxArrayInt& GetMainButtonIds() { return m_mainButtonIds; }
+
+ // Is this id in the main button id array?
+ bool IsMainButtonId(wxWindowID id) const { return (m_mainButtonIds.Index((int) id) != wxNOT_FOUND); }
+
+ // Level of adaptation, from none (Level 0) to full (Level 3). To disable adaptation,
+ // set level 0, for example in your dialog constructor. You might
+ // do this if you know that you are displaying on a large screen and you don't want the
+ // dialog changed.
+ void SetLayoutAdaptationLevel(int level) { m_layoutAdaptationLevel = level; }
+ int GetLayoutAdaptationLevel() const { return m_layoutAdaptationLevel; }
+
+ /// Override global adaptation enabled/disabled status
+ void SetLayoutAdaptationMode(wxDialogLayoutAdaptationMode mode) { m_layoutAdaptationMode = mode; }
+ wxDialogLayoutAdaptationMode GetLayoutAdaptationMode() const { return m_layoutAdaptationMode; }
+
+ // Returns true if the adaptation has been done
+ void SetLayoutAdaptationDone(bool adaptationDone) { m_layoutAdaptationDone = adaptationDone; }
+ bool GetLayoutAdaptationDone() const { return m_layoutAdaptationDone; }
+
+ // Set layout adapter class, returning old adapter
+ static wxDialogLayoutAdapter* SetLayoutAdapter(wxDialogLayoutAdapter* adapter);
+ static wxDialogLayoutAdapter* GetLayoutAdapter() { return sm_layoutAdapter; }
+
+ // Global switch for layout adaptation
+ static bool IsLayoutAdaptationEnabled() { return sm_layoutAdaptation; }
+ static void EnableLayoutAdaptation(bool enable) { sm_layoutAdaptation = enable; }
+
+ // modality kind
+ virtual wxDialogModality GetModality() const;