1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog.h
|
|
|
|
// Purpose: wxDialog class
|
1999-10-14 18:36:24 -04:00
|
|
|
// Author: David Webster
|
1999-07-29 01:11:30 -04:00
|
|
|
// Modified by:
|
1999-10-14 18:36:24 -04:00
|
|
|
// Created: 10/14/99
|
1999-07-29 01:11:30 -04:00
|
|
|
// RCS-ID: $Id$
|
1999-10-14 18:36:24 -04:00
|
|
|
// Copyright: (c) David Webster
|
|
|
|
// Licence: wxWindows licence
|
1999-07-29 01:11:30 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_DIALOG_H_
|
|
|
|
#define _WX_DIALOG_H_
|
|
|
|
|
|
|
|
#include "wx/panel.h"
|
|
|
|
|
1999-08-02 00:44:01 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const char*) wxDialogNameStr;
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2003-09-21 17:54:03 -04:00
|
|
|
class WXDLLEXPORT wxDialogModalData;
|
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
1999-07-29 01:11:30 -04:00
|
|
|
// Dialog boxes
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
1999-08-02 00:44:01 -04:00
|
|
|
class WXDLLEXPORT wxDialog: public wxDialogBase
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
|
|
|
public:
|
1999-08-02 00:44:01 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
inline wxDialog() { Init(); }
|
1999-08-02 00:44:01 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
1999-08-02 00:44:01 -04:00
|
|
|
// Constructor with a modal flag, but no window id - the old convention
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
inline 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
|
1999-08-02 00:44:01 -04:00
|
|
|
)
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
2001-04-18 16:46:23 -04:00
|
|
|
long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
|
|
|
|
|
|
|
|
Create( pParent
|
|
|
|
,-1
|
|
|
|
,rsTitle
|
|
|
|
,wxPoint(nX, nY)
|
|
|
|
,wxSize(nWidth, nHeight)
|
|
|
|
,lStyle | lModalStyle
|
|
|
|
,rsName
|
|
|
|
);
|
1999-07-29 01:11:30 -04:00
|
|
|
}
|
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
1999-07-29 01:11:30 -04:00
|
|
|
// Constructor with no modal flag - the new convention.
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
inline wxDialog( 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 00:44:01 -04:00
|
|
|
)
|
1999-07-29 01:11:30 -04:00
|
|
|
{
|
2001-04-18 16:46:23 -04:00
|
|
|
Create( pParent
|
|
|
|
,vId
|
|
|
|
,rsTitle
|
|
|
|
,rPos
|
|
|
|
,rSize
|
|
|
|
,lStyle
|
|
|
|
,rsName
|
|
|
|
);
|
1999-07-29 01:11:30 -04:00
|
|
|
}
|
|
|
|
|
2001-04-18 16:46:23 -04: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 00:44:01 -04:00
|
|
|
);
|
1999-07-29 01:11:30 -04:00
|
|
|
~wxDialog();
|
|
|
|
|
2002-01-06 19:44:31 -05:00
|
|
|
void SetModal(bool bFlag);
|
2001-04-18 16:46:23 -04:00
|
|
|
virtual bool IsModal(void) const;
|
1999-10-14 18:36:24 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
// For now, same as Show(TRUE) but returns return code
|
2002-01-06 19:44:31 -05:00
|
|
|
virtual int ShowModal();
|
|
|
|
|
|
|
|
// may be called to terminate the dialog with the given return code
|
|
|
|
virtual void EndModal(int retCode);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Returns TRUE if we're in a modal loop
|
|
|
|
//
|
2002-01-06 19:44:31 -05:00
|
|
|
bool IsModalShowing() const;
|
1999-10-14 18:36:24 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
//
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2002-01-06 19:44:31 -05:00
|
|
|
//
|
|
|
|
// Override some base class virtuals
|
|
|
|
//
|
|
|
|
virtual bool Show(bool bShow);
|
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Event handlers
|
|
|
|
//
|
|
|
|
void OnCharHook(wxKeyEvent& rEvent);
|
|
|
|
void OnCloseWindow(wxCloseEvent& rEvent);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
1999-08-02 00:44:01 -04:00
|
|
|
// Standard buttons
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
void OnOK(wxCommandEvent& rEvent);
|
|
|
|
void OnApply(wxCommandEvent& rEvent);
|
|
|
|
void OnCancel(wxCommandEvent& rEvent);
|
1999-07-29 01:11:30 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
1999-08-02 00:44:01 -04:00
|
|
|
// Responds to colour changes
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& rEvent);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Callbacks
|
|
|
|
//
|
|
|
|
virtual MRESULT OS2WindowProc( WXUINT uMessage
|
|
|
|
,WXWPARAM wParam
|
|
|
|
,WXLPARAM lParam
|
|
|
|
);
|
2002-01-06 19:44:31 -05:00
|
|
|
|
1999-10-05 00:22:59 -04:00
|
|
|
protected:
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// Show modal dialog and enter modal loop
|
|
|
|
//
|
|
|
|
void DoShowModal(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Common part of all ctors
|
|
|
|
//
|
2002-01-06 19:44:31 -05:00
|
|
|
void Init(void);
|
1999-10-05 00:22:59 -04:00
|
|
|
|
|
|
|
private:
|
2001-04-18 16:46:23 -04:00
|
|
|
wxWindow* m_pOldFocus;
|
1999-10-05 00:22:59 -04:00
|
|
|
|
2003-09-21 17:54:03 -04:00
|
|
|
// this pointer is non-NULL only while the modal event loop is running
|
|
|
|
wxDialogModalData *m_modalData;
|
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
//
|
|
|
|
// While we are showing a modal dialog we disable the other windows using
|
|
|
|
// this object
|
|
|
|
//
|
|
|
|
class wxWindowDisabler* m_pWindowDisabler;
|
1999-10-05 00:22:59 -04:00
|
|
|
|
2001-04-18 16:46:23 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxDialog)
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
}; // end of CLASS wxDialog
|
|
|
|
|
|
|
|
#endif // _WX_DIALOG_H_
|
1999-07-29 01:11:30 -04:00
|
|
|
|