]> git.saurik.com Git - wxWidgets.git/blob - include/wx/dialog.h
1. wxWindow::Centre() hopefully fixed
[wxWidgets.git] / include / wx / dialog.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/dialog.h
3 // Purpose: wxDialogBase class
4 // Author: Vadim Zeitlin
5 // Modified by:
6 // Created: 29.06.99
7 // RCS-ID: $Id$
8 // Copyright: (c) Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DIALOG_H_BASE_
13 #define _WX_DIALOG_H_BASE_
14
15 #include "wx/defs.h"
16 #include "wx/panel.h"
17
18 class WXDLLEXPORT wxDialogBase : public wxPanel
19 {
20 public:
21 // the modal dialogs have a return code - usually the id of the last
22 // pressed button
23 void SetReturnCode(int returnCode) { m_returnCode = returnCode; }
24 int GetReturnCode() const { return m_returnCode; }
25
26 protected:
27 // functions to help with dialog layout
28 // ------------------------------------
29
30 // constants used in dialog layout
31 static const long LAYOUT_X_MARGIN;
32 static const long LAYOUT_Y_MARGIN;
33 static const long MARGIN_BETWEEN_BUTTONS;
34
35 // Split the message in lines putting them into the array and calculating
36 // the maximum line width/height which is returned as wxSize.
37 wxSize SplitTextMessage(const wxString& message, wxArrayString *lines);
38
39 // Creates the (possibly multiline) message, assuming each line has the
40 // size sizeText (which can be retrieved from SplitTextMessage). Returns
41 // the bottom border of the multiline text zone.
42 long CreateTextMessage(const wxArrayString& lines,
43 const wxPoint& posText,
44 const wxSize& sizeText);
45
46 // Returns the preferred size for the buttons in the dialog
47 wxSize GetStandardButtonSize(bool hasCancel = TRUE);
48
49 // Create the standard [Ok] and [Cancel] (if hasCancel) buttons centering
50 // them with respect to the dialog width wDialog at vertical position y.
51 // wButton and hButton is the size of the button (which can be retrieved
52 // from GetStandardButtonSize)
53 void CreateStandardButtons(long wDialog,
54 long y,
55 long wButton,
56 long hButton,
57 bool hasCancel = TRUE);
58
59 // Returns the standard height of single line text ctrl (it's not the same
60 // as the height of just text which may be retrieved from
61 // wxGetCharHeight())
62 long GetStandardTextHeight();
63
64 // the return code from modal dialog
65 int m_returnCode;
66 };
67
68 #if defined(__WXMSW__)
69 #include "wx/msw/dialog.h"
70 #elif defined(__WXMOTIF__)
71 #include "wx/motif/dialog.h"
72 #elif defined(__WXGTK__)
73 #include "wx/gtk/dialog.h"
74 #elif defined(__WXQT__)
75 #include "wx/qt/dialog.h"
76 #elif defined(__WXMAC__)
77 #include "wx/mac/dialog.h"
78 #elif defined(__WXPM__)
79 #include "wx/os2/dialog.h"
80 #elif defined(__WXSTUBS__)
81 #include "wx/stubs/dialog.h"
82 #endif
83
84 #endif
85 // _WX_DIALOG_H_BASE_