]> git.saurik.com Git - wxWidgets.git/blame - include/wx/msw/dialog.h
added WX_CLEAR_ARRAY() macro to delete all the elements of an array
[wxWidgets.git] / include / wx / msw / dialog.h
CommitLineData
2bda0e17
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dialog.h
3// Purpose: wxDialog class
4// Author: Julian Smart
5// Modified by:
6// Created: 01/02/97
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart and Markus Holzem
9// Licence: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
bbcdf8bc
JS
12#ifndef _WX_DIALOG_H_
13#define _WX_DIALOG_H_
2bda0e17
KB
14
15#ifdef __GNUG__
16#pragma interface "dialog.h"
17#endif
18
19#include "wx/panel.h"
20
21WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
22
23// Dialog boxes
24class WXDLLEXPORT wxDialog: public wxPanel
25{
26 DECLARE_DYNAMIC_CLASS(wxDialog)
27 protected:
28 bool m_modalShowing;
29public:
30
7b218dfa 31 wxDialog();
2bda0e17
KB
32
33 // Constructor with a modal flag, but no window id - the old convention
34 inline wxDialog(wxWindow *parent,
35 const wxString& title, bool modal,
debe6624
JS
36 int x = -1, int y= -1, int width = 500, int height = 500,
37 long style = wxDEFAULT_DIALOG_STYLE,
2bda0e17
KB
38 const wxString& name = wxDialogNameStr)
39 {
40 long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
41 Create(parent, -1, title, wxPoint(x, y), wxSize(width, height), style|modalStyle, name);
42 }
43
44 // Constructor with no modal flag - the new convention.
debe6624 45 inline wxDialog(wxWindow *parent, wxWindowID id,
2bda0e17
KB
46 const wxString& title,
47 const wxPoint& pos = wxDefaultPosition,
48 const wxSize& size = wxDefaultSize,
debe6624 49 long style = wxDEFAULT_DIALOG_STYLE,
2bda0e17
KB
50 const wxString& name = wxDialogNameStr)
51 {
52 Create(parent, id, title, pos, size, style, name);
53 }
54
debe6624 55 bool Create(wxWindow *parent, wxWindowID id,
2bda0e17
KB
56 const wxString& title, // bool modal = FALSE, // TODO make this a window style?
57 const wxPoint& pos = wxDefaultPosition,
58 const wxSize& size = wxDefaultSize,
debe6624 59 long style = wxDEFAULT_DIALOG_STYLE,
2bda0e17
KB
60 const wxString& name = wxDialogNameStr);
61
7b218dfa 62 ~wxDialog();
2bda0e17 63
7b218dfa 64 virtual bool Destroy();
4fabb575 65
7b218dfa 66 virtual void SetClientSize(int width, int height);
4fabb575 67
7b218dfa 68 virtual void GetPosition(int *x, int *y) const;
4fabb575 69
debe6624 70 bool Show(bool show);
7b218dfa 71 bool IsShown() const ;
debe6624 72 void Iconize(bool iconize);
2bda0e17
KB
73
74#if WXWIN_COMPATIBILITY
7b218dfa 75 inline bool Iconized() const { return IsIconized(); };
2bda0e17
KB
76#endif
77
7b218dfa
VZ
78 virtual bool IsIconized() const;
79 void Fit();
2bda0e17
KB
80
81 void SetTitle(const wxString& title);
7b218dfa 82 wxString GetTitle() const ;
2bda0e17 83
94b49b93 84 void OnSize(wxSizeEvent& event);
7b218dfa 85 bool OnClose();
2bda0e17
KB
86 void OnCharHook(wxKeyEvent& event);
87 void OnPaint(wxPaintEvent& event);
88 void OnCloseWindow(wxCloseEvent& event);
89
debe6624 90 void SetModal(bool flag);
2bda0e17 91
debe6624 92 virtual void Centre(int direction = wxBOTH);
7b218dfa 93 virtual bool IsModal() const { return ((GetWindowStyleFlag() & wxDIALOG_MODAL) == wxDIALOG_MODAL); }
2bda0e17
KB
94
95 // For now, same as Show(TRUE) but returns return code
7b218dfa 96 virtual int ShowModal();
2bda0e17
KB
97 virtual void EndModal(int retCode);
98
99 // Standard buttons
100 void OnOK(wxCommandEvent& event);
101 void OnApply(wxCommandEvent& event);
102 void OnCancel(wxCommandEvent& event);
103
104 // Responds to colour changes
105 void OnSysColourChanged(wxSysColourChangedEvent& event);
106
107 // IMPLEMENTATION
108 virtual long MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
109 virtual long MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam);
110 virtual bool MSWProcessMessage(WXMSG* pMsg);
111// virtual bool MSWOnEraseBkgnd(WXHDC pDC);
7b218dfa 112 virtual bool MSWOnClose();
2bda0e17 113 inline bool IsModalShowing() const { return m_modalShowing ; }
debe6624 114 virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
2bda0e17
KB
115 WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
116
dc1c4b62
VZ
117protected:
118 WXHWND m_hwndOldFocus; // the window which had focus before we were shown
119
2bda0e17
KB
120DECLARE_EVENT_TABLE()
121};
122
123#endif
bbcdf8bc 124 // _WX_DIALOG_H_