1999-07-29 05:11:30 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog.h
|
|
|
|
// Purpose: wxDialog class
|
1999-10-14 22:36:24 +00:00
|
|
|
// Author: David Webster
|
1999-07-29 05:11:30 +00:00
|
|
|
// Modified by:
|
1999-10-14 22:36:24 +00:00
|
|
|
// Created: 10/14/99
|
1999-07-29 05:11:30 +00:00
|
|
|
// RCS-ID: $Id$
|
1999-10-14 22:36:24 +00:00
|
|
|
// Copyright: (c) David Webster
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1999-07-29 05:11:30 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DIALOG_H_
|
|
|
|
#define _WX_DIALOG_H_
|
|
|
|
|
|
|
|
#include "wx/panel.h"
|
|
|
|
|
1999-08-02 04:44:01 +00:00
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2003-09-21 21:54:03 +00:00
|
|
|
class WXDLLEXPORT wxDialogModalData;
|
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
1999-07-29 05:11:30 +00:00
|
|
|
// Dialog boxes
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
1999-08-02 04:44:01 +00:00
|
|
|
class WXDLLEXPORT wxDialog: public wxDialogBase
|
1999-07-29 05:11:30 +00:00
|
|
|
{
|
|
|
|
public:
|
1999-08-02 04:44:01 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
inline wxDialog() { Init(); }
|
1999-08-02 04:44:01 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
// full ctor
|
|
|
|
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)
|
1999-07-29 05:11:30 +00:00
|
|
|
{
|
2004-10-24 12:08:25 +00:00
|
|
|
Init();
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
(void)Create(parent, id, title, pos, size, style, name);
|
1999-07-29 05:11:30 +00:00
|
|
|
}
|
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
bool Create( wxWindow* pParent
|
|
|
|
,wxWindowID vId
|
|
|
|
,const wxString& rsTitle
|
|
|
|
,const wxPoint& rPos = wxDefaultPosition
|
|
|
|
,const wxSize& rSize = wxDefaultSize
|
|
|
|
,long lStyle = wxDEFAULT_DIALOG_STYLE
|
|
|
|
,const wxString& rsName = wxDialogNameStr
|
1999-08-02 04:44:01 +00:00
|
|
|
);
|
2004-10-24 12:08:25 +00:00
|
|
|
virtual ~wxDialog();
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
// return true if we're showing the dialog modally
|
|
|
|
virtual bool IsModal() const { return m_modalData != NULL; }
|
1999-10-14 22:36:24 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
// show the dialog modally and return the value passed to EndModal()
|
2002-01-07 00:44:31 +00:00
|
|
|
virtual int ShowModal();
|
|
|
|
|
|
|
|
// may be called to terminate the dialog with the given return code
|
|
|
|
virtual void EndModal(int retCode);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
// implementation only from now on
|
2001-04-18 20:46:23 +00:00
|
|
|
// -------------------------------
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
// override some base class virtuals
|
|
|
|
virtual bool Show(bool show = true);
|
2002-01-07 00:44:31 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// Event handlers
|
|
|
|
//
|
|
|
|
void OnCharHook(wxKeyEvent& rEvent);
|
|
|
|
void OnCloseWindow(wxCloseEvent& rEvent);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
1999-08-02 04:44:01 +00:00
|
|
|
// Standard buttons
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
void OnOK(wxCommandEvent& rEvent);
|
|
|
|
void OnApply(wxCommandEvent& rEvent);
|
|
|
|
void OnCancel(wxCommandEvent& rEvent);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
1999-08-02 04:44:01 +00:00
|
|
|
// Responds to colour changes
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Callbacks
|
|
|
|
//
|
|
|
|
virtual MRESULT OS2WindowProc( WXUINT uMessage
|
|
|
|
,WXWPARAM wParam
|
|
|
|
,WXLPARAM lParam
|
|
|
|
);
|
2004-10-24 12:08:25 +00:00
|
|
|
// obsolete methods
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
// Constructor with a modal flag, but no window id - the old convention
|
|
|
|
wxDEPRECATED( wxDialog( wxWindow* pParent
|
|
|
|
,const wxString& rsTitle
|
|
|
|
,bool bModal
|
|
|
|
,int nX = -1
|
|
|
|
,int nY = -1
|
|
|
|
,int nWidth = 500
|
|
|
|
,int nHeight = 500
|
|
|
|
,long lStyle = wxDEFAULT_DIALOG_STYLE
|
|
|
|
,const wxString& rsName = wxDialogNameStr
|
|
|
|
) );
|
|
|
|
|
|
|
|
// just call Show() or ShowModal()
|
|
|
|
wxDEPRECATED( void SetModal(bool bFlag) );
|
|
|
|
|
|
|
|
// use IsModal()
|
|
|
|
wxDEPRECATED( bool IsModalShowing() const );
|
2002-01-07 00:44:31 +00:00
|
|
|
|
1999-10-05 04:22:59 +00:00
|
|
|
protected:
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
2004-10-24 12:08:25 +00:00
|
|
|
// find the window to use as parent for this dialog if none has been
|
|
|
|
// specified explicitly by the user
|
|
|
|
//
|
|
|
|
// may return NULL
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
2004-10-24 12:08:25 +00:00
|
|
|
wxWindow *FindSuitableParent() const;
|
2001-04-18 20:46:23 +00:00
|
|
|
|
|
|
|
//
|
|
|
|
// Common part of all ctors
|
|
|
|
//
|
2002-01-07 00:44:31 +00:00
|
|
|
void Init(void);
|
1999-10-05 04:22:59 +00:00
|
|
|
|
2004-10-24 12:08:25 +00:00
|
|
|
// end either modal or modeless dialog
|
|
|
|
void EndDialog(int rc);
|
|
|
|
|
1999-10-05 04:22:59 +00:00
|
|
|
private:
|
2001-04-18 20:46:23 +00:00
|
|
|
wxWindow* m_pOldFocus;
|
2004-10-24 12:08:25 +00:00
|
|
|
bool m_endModalCalled; // allow for closing within InitDialog
|
1999-10-05 04:22:59 +00:00
|
|
|
|
2003-09-21 21:54:03 +00:00
|
|
|
// this pointer is non-NULL only while the modal event loop is running
|
|
|
|
wxDialogModalData *m_modalData;
|
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// While we are showing a modal dialog we disable the other windows using
|
|
|
|
// this object
|
|
|
|
//
|
|
|
|
class wxWindowDisabler* m_pWindowDisabler;
|
1999-10-05 04:22:59 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxDialog)
|
|
|
|
DECLARE_EVENT_TABLE()
|
2004-10-24 12:08:25 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDialog)
|
2001-04-18 20:46:23 +00:00
|
|
|
}; // end of CLASS wxDialog
|
|
|
|
|
|
|
|
#endif // _WX_DIALOG_H_
|
1999-07-29 05:11:30 +00:00
|
|
|
|