1998-05-20 10:12:05 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: dialog.h
|
|
|
|
// Purpose: wxDialog class
|
|
|
|
// Author: Julian Smart
|
|
|
|
// Modified by:
|
|
|
|
// Created: 01/02/97
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Julian Smart and Markus Holzem
|
1999-02-14 16:59:48 -05:00
|
|
|
// Licence: wxWindows license
|
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
|
|
|
|
|
|
|
#ifdef __GNUG__
|
1999-02-06 18:27:08 -05:00
|
|
|
#pragma interface "dialog.h"
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/panel.h"
|
|
|
|
|
1999-06-10 14:12:13 -04:00
|
|
|
WXDLLEXPORT_DATA(extern const wxChar*) wxDialogNameStr;
|
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
|
|
|
|
1999-02-06 18:27:08 -05:00
|
|
|
// Constructor with a modal flag, but no window id - the old convention
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
long modalStyle = modal ? wxDIALOG_MODAL : wxDIALOG_MODELESS ;
|
|
|
|
Create(parent, -1, title, wxPoint(x, y), wxSize(width, height),
|
|
|
|
style | modalStyle, name);
|
|
|
|
}
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1999-02-06 18:27:08 -05:00
|
|
|
// Constructor with no modal flag - the new convention.
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
Create(parent, id, title, pos, size, style, name);
|
|
|
|
}
|
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
|
|
|
|
1999-02-06 18:27:08 -05:00
|
|
|
~wxDialog();
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// override some base class virtuals
|
1999-02-06 18:27:08 -05:00
|
|
|
virtual bool Destroy();
|
2000-01-29 20:31:09 -05:00
|
|
|
virtual bool Show(bool show);
|
|
|
|
virtual void Iconize(bool iconize);
|
|
|
|
virtual bool IsIconized() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
virtual bool IsTopLevel() const { return TRUE; }
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
void SetModal(bool flag);
|
|
|
|
virtual bool IsModal() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// For now, same as Show(TRUE) but returns return code
|
|
|
|
virtual int ShowModal();
|
|
|
|
|
|
|
|
// may be called to terminate the dialog with the given return code
|
|
|
|
virtual void EndModal(int retCode);
|
|
|
|
|
|
|
|
// returns TRUE if we're in a modal loop
|
|
|
|
bool IsModalShowing() const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1998-05-20 10:12:05 -04:00
|
|
|
#if WXWIN_COMPATIBILITY
|
1999-02-06 18:27:08 -05:00
|
|
|
bool Iconized() const { return IsIconized(); };
|
1998-05-20 10:12:05 -04:00
|
|
|
#endif
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// implementation only from now on
|
|
|
|
// -------------------------------
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// event handlers
|
1999-02-06 18:27:08 -05:00
|
|
|
bool OnClose();
|
|
|
|
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
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// Windows callbacks
|
1999-05-18 20:53:27 -04:00
|
|
|
long MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
#if wxUSE_CTL3D
|
1999-02-06 18:27:08 -05:00
|
|
|
virtual WXHBRUSH OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor,
|
|
|
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
2000-01-29 20:31:09 -05:00
|
|
|
#endif // wxUSE_CTL3D
|
1999-02-14 16:59:48 -05:00
|
|
|
|
1998-08-07 18:27:33 -04:00
|
|
|
protected:
|
2000-01-29 20:31:09 -05:00
|
|
|
// override more base class virtuals
|
|
|
|
virtual void DoSetClientSize(int width, int height);
|
|
|
|
virtual void DoGetPosition(int *x, int *y) const;
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-01-29 20:31:09 -05:00
|
|
|
// show modal dialog and enter modal loop
|
|
|
|
void DoShowModal();
|
1999-02-14 16:59:48 -05:00
|
|
|
|
2000-10-07 16:19:10 -04:00
|
|
|
// common part of all ctors
|
|
|
|
void Init();
|
|
|
|
|
1999-06-29 08:34:18 -04:00
|
|
|
private:
|
2000-02-25 11:21:53 -05:00
|
|
|
wxWindow *m_oldFocus;
|
|
|
|
|
2000-10-07 16:19:10 -04:00
|
|
|
// while we are showing a modal dialog we disable the other windows using
|
|
|
|
// this object
|
|
|
|
class wxWindowDisabler *m_windowDisabler;
|
|
|
|
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxDialog)
|
1999-02-06 18:27:08 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
1998-05-20 10:12:05 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
1998-08-07 19:52:45 -04:00
|
|
|
// _WX_DIALOG_H_
|