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
|
|
|
|
// 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
|
|
|
|
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
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
1999-08-02 04:44:01 +00:00
|
|
|
// Constructor with a modal flag, but no window id - the old convention
|
2001-04-18 20:46:23 +00: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 04:44:01 +00:00
|
|
|
)
|
1999-07-29 05:11:30 +00:00
|
|
|
{
|
2001-04-18 20:46:23 +00:00
|
|
|
long lModalStyle = lStyle ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
|
|
|
|
|
2001-10-22 05:11:09 +00:00
|
|
|
bModal = FALSE;
|
2001-04-18 20:46:23 +00:00
|
|
|
Create( pParent
|
|
|
|
,-1
|
|
|
|
,rsTitle
|
|
|
|
,wxPoint(nX, nY)
|
|
|
|
,wxSize(nWidth, nHeight)
|
|
|
|
,lStyle | lModalStyle
|
|
|
|
,rsName
|
|
|
|
);
|
1999-07-29 05:11:30 +00:00
|
|
|
}
|
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
1999-07-29 05:11:30 +00:00
|
|
|
// Constructor with no modal flag - the new convention.
|
2001-04-18 20:46:23 +00: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 04:44:01 +00:00
|
|
|
)
|
1999-07-29 05:11:30 +00:00
|
|
|
{
|
2001-04-18 20:46:23 +00:00
|
|
|
Create( pParent
|
|
|
|
,vId
|
|
|
|
,rsTitle
|
|
|
|
,rPos
|
|
|
|
,rSize
|
|
|
|
,lStyle
|
|
|
|
,rsName
|
|
|
|
);
|
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
|
|
|
);
|
1999-07-29 05:11:30 +00:00
|
|
|
~wxDialog();
|
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
virtual bool Destroy(void);
|
|
|
|
virtual bool Show(bool bShow);
|
|
|
|
virtual void Iconize(bool bIconize);
|
|
|
|
virtual bool IsIconized(void) const;
|
|
|
|
|
|
|
|
virtual bool IsTopLevel(void) const { return TRUE; }
|
1999-10-14 22:36:24 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
void SetModal(bool bFlag);
|
|
|
|
virtual bool IsModal(void) const;
|
1999-10-14 22:36:24 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// For now, same as Show(TRUE) but returns return code
|
|
|
|
//
|
|
|
|
virtual int ShowModal(void);
|
|
|
|
virtual void EndModal(int nRetCode);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// Returns TRUE if we're in a modal loop
|
|
|
|
//
|
|
|
|
bool IsModalShowing() const;
|
1999-08-02 16:39:18 +00:00
|
|
|
|
1999-10-14 22:36:24 +00:00
|
|
|
#if WXWIN_COMPATIBILITY
|
|
|
|
bool Iconized() const { return IsIconized(); };
|
|
|
|
#endif
|
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// Implementation only from now on
|
|
|
|
// -------------------------------
|
|
|
|
//
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// Event handlers
|
|
|
|
//
|
|
|
|
bool OnClose(void);
|
|
|
|
void OnCharHook(wxKeyEvent& rEvent);
|
|
|
|
void OnCloseWindow(wxCloseEvent& rEvent);
|
1999-07-29 05:11:30 +00:00
|
|
|
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// May be called to terminate the dialog with the given return code
|
|
|
|
//
|
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
|
|
|
|
);
|
1999-10-05 04:22:59 +00:00
|
|
|
protected:
|
2001-04-18 20:46:23 +00:00
|
|
|
//
|
|
|
|
// Override more base class virtuals
|
|
|
|
//
|
|
|
|
virtual void DoSetClientSize( int nWidth
|
|
|
|
,int nHeight
|
|
|
|
);
|
|
|
|
virtual void DoGetPosition( int* pnX
|
|
|
|
,int* pnY
|
|
|
|
) const;
|
|
|
|
//
|
|
|
|
// Show modal dialog and enter modal loop
|
|
|
|
//
|
|
|
|
void DoShowModal(void);
|
|
|
|
|
|
|
|
//
|
|
|
|
// Common part of all ctors
|
|
|
|
//
|
|
|
|
void Init();
|
1999-10-05 04:22:59 +00:00
|
|
|
|
|
|
|
private:
|
2001-04-18 20:46:23 +00:00
|
|
|
wxWindow* m_pOldFocus;
|
1999-10-05 04:22:59 +00:00
|
|
|
|
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()
|
|
|
|
}; // end of CLASS wxDialog
|
|
|
|
|
|
|
|
#endif // _WX_DIALOG_H_
|
1999-07-29 05:11:30 +00:00
|
|
|
|