1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2001-09-23 20:34:14 -04:00
|
|
|
// Name: wx/msw/dialog.h
|
1998-05-20 10:12:05 -04:00
|
|
|
// Purpose: wxDialog class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
2003-03-17 05:34:04 -05:00
|
|
|
// Copyright: (c) Julian Smart
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
1998-08-07 19:52:45 -04:00
|
|
|
#ifndef _WX_DIALOG_H_
|
|
|
|
#define _WX_DIALOG_H_
|
1998-05-20 10:12:05 -04:00
|
|
|
|
|
|
|
#include "wx/panel.h"
|
|
|
|
|
2006-01-16 09:59:55 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar) wxDialogNameStr[];
|
1998-05-20 10:12:05 -04:00
|
|
|
|
2003-09-16 08:30:34 -04:00
|
|
|
class WXDLLEXPORT wxDialogModalData;
|
2002-12-04 09:11:26 -05:00
|
|
|
|
2005-03-19 07:06:56 -05:00
|
|
|
#if wxUSE_TOOLBAR && (defined(__SMARTPHONE__) || defined(__POCKETPC__))
|
|
|
|
class WXDLLEXPORT wxToolBar;
|
2006-01-16 09:59:55 -05:00
|
|
|
extern WXDLLEXPORT_DATA(const wxChar) wxToolBarNameStr[];
|
2005-03-19 07:06:56 -05:00
|
|
|
#endif
|
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
// Dialog boxes
|
1999-06-28 17:39:49 -04:00
|
|
|
class WXDLLEXPORT wxDialog : public wxDialogBase
|
1998-05-20 10:12:05 -04:00
|
|
|
{
|
1999-02-06 18:27:08 -05:00
|
|
|
public:
|
2000-10-07 16:19:10 -04:00
|
|
|
wxDialog() { Init(); }
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2004-04-21 08:45:16 -04:00
|
|
|
// full ctor
|
1999-02-06 18:27:08 -05: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 15:51:33 -05:00
|
|
|
Init();
|
|
|
|
|
|
|
|
(void)Create(parent, id, title, pos, size, style, name);
|
1999-02-06 18:27:08 -05:00
|
|
|
}
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-02-06 18:27:08 -05: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 16:59:48 -05:00
|
|
|
|
2001-09-23 20:34:14 -04:00
|
|
|
virtual ~wxDialog();
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2004-04-21 08:45:16 -04:00
|
|
|
// return true if we're showing the dialog modally
|
|
|
|
virtual bool IsModal() const { return m_modalData != NULL; }
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2004-04-21 08:45:16 -04:00
|
|
|
// show the dialog modally and return the value passed to EndModal()
|
2000-01-29 20:31:09 -05:00
|
|
|
virtual int ShowModal();
|
|
|
|
|
|
|
|
// may be called to terminate the dialog with the given return code
|
|
|
|
virtual void EndModal(int retCode);
|
|
|
|
|
2005-09-16 06:28:40 -04:00
|
|
|
|
|
|
|
// we treat dialog toolbars specially under Windows CE
|
2005-03-19 07:06:56 -05:00
|
|
|
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
|
|
|
|
// create main toolbar by calling OnCreateToolBar()
|
|
|
|
virtual wxToolBar* CreateToolBar(long style = -1,
|
|
|
|
wxWindowID winid = wxID_ANY,
|
|
|
|
const wxString& name = wxToolBarNameStr);
|
|
|
|
// return a new toolbar
|
|
|
|
virtual wxToolBar *OnCreateToolBar(long style,
|
|
|
|
wxWindowID winid,
|
|
|
|
const wxString& name );
|
|
|
|
|
|
|
|
// get the main toolbar
|
|
|
|
wxToolBar *GetToolBar() const { return m_dialogToolBar; }
|
2005-09-16 06:28:40 -04:00
|
|
|
#endif // wxUSE_TOOLBAR && __POCKETPC__
|
|
|
|
|
2005-03-19 07:06:56 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2001-09-23 20:34:14 -04:00
|
|
|
// override some base class virtuals
|
2004-08-24 06:31:41 -04:00
|
|
|
virtual bool Show(bool show = true);
|
2001-09-23 20:34:14 -04:00
|
|
|
|
2003-06-01 17:01:18 -04:00
|
|
|
virtual void Raise();
|
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// event handlers
|
1999-02-06 18:27:08 -05:00
|
|
|
void OnCharHook(wxKeyEvent& event);
|
|
|
|
void OnCloseWindow(wxCloseEvent& event);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-02-06 18:27:08 -05:00
|
|
|
// Standard buttons
|
|
|
|
void OnOK(wxCommandEvent& event);
|
|
|
|
void OnApply(wxCommandEvent& event);
|
|
|
|
void OnCancel(wxCommandEvent& event);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-02-06 18:27:08 -05:00
|
|
|
// Responds to colour changes
|
|
|
|
void OnSysColourChanged(wxSysColourChangedEvent& event);
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2005-03-14 12:15:06 -05:00
|
|
|
#ifdef __POCKETPC__
|
|
|
|
// Responds to the OK button in a PocketPC titlebar. This
|
|
|
|
// can be overridden, or you can change the id used for
|
|
|
|
// sending the event with SetAffirmativeId. Returns false
|
|
|
|
// if the event was not processed.
|
|
|
|
virtual bool DoOK();
|
|
|
|
#endif
|
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// Windows callbacks
|
2004-02-25 05:45:02 -05:00
|
|
|
WXLRESULT MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
1999-05-18 20:53:27 -04:00
|
|
|
|
2004-04-21 08:45:16 -04:00
|
|
|
// obsolete methods
|
|
|
|
// ----------------
|
|
|
|
|
|
|
|
// use the other ctor
|
|
|
|
wxDEPRECATED( wxDialog(wxWindow *parent,
|
|
|
|
const wxString& title, bool modal,
|
2004-08-24 06:31:41 -04:00
|
|
|
int x = wxDefaultCoord, int y = wxDefaultCoord, int width = 500, int height = 500,
|
2004-04-21 08:45:16 -04:00
|
|
|
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 18:27:33 -04:00
|
|
|
protected:
|
2002-09-01 20:44:24 -04: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 16:19:10 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
2004-06-22 19:20:27 -04:00
|
|
|
// end either modal or modeless dialog
|
|
|
|
void EndDialog(int rc);
|
|
|
|
|
2005-07-14 19:09:00 -04:00
|
|
|
// emulate click of a button with the given id if it's present in the dialog
|
|
|
|
//
|
|
|
|
// return true if button was "clicked" or false if we don't have it
|
|
|
|
bool EmulateButtonClickIfPresent(int id);
|
|
|
|
|
|
|
|
// handle Escape here
|
|
|
|
virtual bool MSWProcessMessage(WXMSG* pMsg);
|
|
|
|
|
1999-06-29 08:34:18 -04:00
|
|
|
private:
|
2004-01-11 11:34:05 -05:00
|
|
|
wxWindow* m_oldFocus;
|
|
|
|
bool m_endModalCalled; // allow for closing within InitDialog
|
2000-02-25 11:21:53 -05:00
|
|
|
|
2005-03-19 07:06:56 -05:00
|
|
|
#if wxUSE_TOOLBAR && defined(__POCKETPC__)
|
|
|
|
wxToolBar* m_dialogToolBar;
|
|
|
|
#endif
|
|
|
|
|
2003-09-16 08:30:34 -04:00
|
|
|
// this pointer is non-NULL only while the modal event loop is running
|
|
|
|
wxDialogModalData *m_modalData;
|
|
|
|
|
2000-10-07 16:19:10 -04:00
|
|
|
DECLARE_DYNAMIC_CLASS(wxDialog)
|
1999-02-06 18:27:08 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
2003-01-02 18:38:11 -05:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDialog)
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_DIALOG_H_
|