1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-09-24 00:34:14 +00:00
|
|
|
// Name: wx/msw/dialog.h
|
1998-05-20 14:12:05 +00:00
|
|
|
// Purpose: wxDialog class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 10:34:04 +00:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 14:12:05 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 23:52:45 +00:00
|
|
|
#ifndef _WX_DIALOG_H_
|
|
|
|
#define _WX_DIALOG_H_
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-08-09 12:38:21 +00:00
|
|
|
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
|
1999-02-06 23:27:08 +00:00
|
|
|
#pragma interface "dialog.h"
|
1998-05-20 14:12:05 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/panel.h"
|
|
|
|
|
1999-06-10 18:12:13 +00:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
|
1998-05-20 14:12:05 +00:00
|
|
|
|
2003-09-16 12:30:34 +00:00
|
|
|
class WXDLLEXPORT wxDialogModalData;
|
2002-12-04 14:11:26 +00:00
|
|
|
|
1998-05-20 14:12:05 +00:00
|
|
|
// Dialog boxes
|
1999-06-28 21:39:49 +00:00
|
|
|
class WXDLLEXPORT wxDialog : public wxDialogBase
|
1998-05-20 14:12:05 +00:00
|
|
|
{
|
1999-02-06 23:27:08 +00:00
|
|
|
public:
|
2000-10-07 20:19:10 +00:00
|
|
|
wxDialog() { Init(); }
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2004-04-21 12:45:16 +00:00
|
|
|
// full ctor
|
1999-02-06 23:27:08 +00:00
|
|
|
wxDialog(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = wxDialogNameStr)
|
|
|
|
{
|
2004-02-05 20:51:33 +00:00
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create(parent, id, title, pos, size, style, name);
|
1999-02-06 23:27:08 +00:00
|
|
|
}
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-02-06 23:27:08 +00:00
|
|
|
bool Create(wxWindow *parent, wxWindowID id,
|
|
|
|
const wxString& title,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = wxDialogNameStr);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2001-09-24 00:34:14 +00:00
|
|
|
virtual ~wxDialog();
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2004-04-21 12:45:16 +00:00
|
|
|
// return true if we're showing the dialog modally
|
|
|
|
virtual bool IsModal() const { return m_modalData != NULL; }
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2004-04-21 12:45:16 +00:00
|
|
|
// show the dialog modally and return the value passed to EndModal()
|
2000-01-30 01:31:09 +00:00
|
|
|
virtual int ShowModal();
|
|
|
|
|
|
|
|
// may be called to terminate the dialog with the given return code
|
|
|
|
virtual void EndModal(int retCode);
|
|
|
|
|
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2001-09-24 00:34:14 +00:00
|
|
|
// override some base class virtuals
|
2002-02-01 12:21:40 +00:00
|
|
|
virtual bool Show(bool show = TRUE);
|
2001-09-24 00:34:14 +00:00
|
|
|
|
2003-06-01 21:01:18 +00:00
|
|
|
virtual void Raise();
|
|
|
|
|
2000-01-30 01:31:09 +00:00
|
|
|
// event handlers
|
1999-02-06 23:27:08 +00:00
|
|
|
void OnCharHook(wxKeyEvent& event);
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-02-06 23:27:08 +00:00
|
|
|
// Standard buttons
|
|
|
|
void OnOK(wxCommandEvent& event);
|
|
|
|
void OnApply(wxCommandEvent& event);
|
|
|
|
void OnCancel(wxCommandEvent& event);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
1999-02-06 23:27:08 +00:00
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2000-01-30 01:31:09 +00:00
|
|
|
// Windows callbacks
|
2004-02-25 10:45:02 +00:00
|
|
|
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
1999-05-19 00:53:27 +00:00
|
|
|
|
2000-01-30 01:31:09 +00:00
|
|
|
#if wxUSE_CTL3D
|
1999-02-06 23:27:08 +00:00
|
|
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
|
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
2000-01-30 01:31:09 +00:00
|
|
|
#endif // wxUSE_CTL3D
|
1999-02-14 21:59:48 +00:00
|
|
|
|
2004-04-21 12:45:16 +00:00
|
|
|
// obsolete methods
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
// use the other ctor
|
|
|
|
wxDEPRECATED( wxDialog(wxWindow *parent,
|
|
|
|
const wxString& title, bool modal,
|
|
|
|
int x = -1, int y= -1, int width = 500, int height = 500,
|
|
|
|
long style = wxDEFAULT_DIALOG_STYLE,
|
|
|
|
const wxString& name = wxDialogNameStr) );
|
|
|
|
|
|
|
|
// just call Show() or ShowModal()
|
|
|
|
wxDEPRECATED( void SetModal(bool flag) );
|
|
|
|
|
|
|
|
// use IsModal()
|
|
|
|
wxDEPRECATED( bool IsModalShowing() const );
|
|
|
|
|
1998-08-07 22:27:33 +00:00
|
|
|
protected:
|
2002-09-02 00:44:24 +00:00
|
|
|
// find the window to use as parent for this dialog if none has been
|
|
|
|
// specified explicitly by the user
|
|
|
|
//
|
|
|
|
// may return NULL
|
|
|
|
wxWindow *FindSuitableParent() const;
|
|
|
|
|
2000-10-07 20:19:10 +00:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2004-06-22 23:20:27 +00:00
|
|
|
// end either modal or modeless dialog
|
|
|
|
void EndDialog(int rc);
|
|
|
|
|
1999-06-29 12:34:18 +00:00
|
|
|
private:
|
2004-01-11 16:34:05 +00:00
|
|
|
wxWindow* m_oldFocus;
|
|
|
|
bool m_endModalCalled; // allow for closing within InitDialog
|
2000-02-25 16:21:53 +00:00
|
|
|
|
2003-09-16 12:30:34 +00:00
|
|
|
// this pointer is non-NULL only while the modal event loop is running
|
|
|
|
wxDialogModalData *m_modalData;
|
|
|
|
|
2000-10-07 20:19:10 +00:00
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxDialog)
|
1999-02-06 23:27:08 +00:00
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 23:38:11 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDialog)
|
1998-05-20 14:12:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 23:52:45 +00:00
|
|
|
// _WX_DIALOG_H_
|