]>
Commit | Line | Data |
---|---|---|
dfe1eee3 VZ |
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 | ||
34138703 JS |
12 | #ifndef _WX_DIALOG_H_BASE_ |
13 | #define _WX_DIALOG_H_BASE_ | |
c801d85f | 14 | |
9f3a38fc VZ |
15 | #include "wx/defs.h" |
16 | #include "wx/panel.h" | |
17 | ||
c50f1fb9 VZ |
18 | class WXDLLEXPORT wxDialogBase : public wxPanel |
19 | { | |
dfe1eee3 VZ |
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 | ||
c50f1fb9 VZ |
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(); | |
dfe1eee3 VZ |
63 | |
64 | // the return code from modal dialog | |
65 | int m_returnCode; | |
c50f1fb9 VZ |
66 | }; |
67 | ||
2049ba38 | 68 | #if defined(__WXMSW__) |
c50f1fb9 | 69 | #include "wx/msw/dialog.h" |
2049ba38 | 70 | #elif defined(__WXMOTIF__) |
c50f1fb9 | 71 | #include "wx/motif/dialog.h" |
2049ba38 | 72 | #elif defined(__WXGTK__) |
c50f1fb9 | 73 | #include "wx/gtk/dialog.h" |
b4e76e0d | 74 | #elif defined(__WXQT__) |
c50f1fb9 | 75 | #include "wx/qt/dialog.h" |
34138703 | 76 | #elif defined(__WXMAC__) |
c50f1fb9 | 77 | #include "wx/mac/dialog.h" |
34138703 | 78 | #elif defined(__WXSTUBS__) |
c50f1fb9 | 79 | #include "wx/stubs/dialog.h" |
c801d85f KB |
80 | #endif |
81 | ||
82 | #endif | |
34138703 | 83 | // _WX_DIALOG_H_BASE_ |