dialog.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/os2/dialog.h
  3. // Purpose: wxDialog class
  4. // Author: David Webster
  5. // Modified by:
  6. // Created: 10/14/99
  7. // Copyright: (c) David Webster
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_DIALOG_H_
  11. #define _WX_DIALOG_H_
  12. #include "wx/panel.h"
  13. WXDLLIMPEXP_DATA_CORE(extern const char) wxDialogNameStr[];
  14. class WXDLLIMPEXP_FWD_CORE wxDialogModalData;
  15. //
  16. // Dialog boxes
  17. //
  18. class WXDLLIMPEXP_CORE wxDialog: public wxDialogBase
  19. {
  20. public:
  21. inline wxDialog() { Init(); }
  22. // full ctor
  23. wxDialog(wxWindow *parent, wxWindowID id,
  24. const wxString& title,
  25. const wxPoint& pos = wxDefaultPosition,
  26. const wxSize& size = wxDefaultSize,
  27. long style = wxDEFAULT_DIALOG_STYLE,
  28. const wxString& name = wxDialogNameStr)
  29. {
  30. Init();
  31. (void)Create(parent, id, title, pos, size, style, name);
  32. }
  33. bool Create( wxWindow* pParent
  34. ,wxWindowID vId
  35. ,const wxString& rsTitle
  36. ,const wxPoint& rPos = wxDefaultPosition
  37. ,const wxSize& rSize = wxDefaultSize
  38. ,long lStyle = wxDEFAULT_DIALOG_STYLE
  39. ,const wxString& rsName = wxDialogNameStr
  40. );
  41. virtual ~wxDialog();
  42. // return true if we're showing the dialog modally
  43. virtual bool IsModal() const { return m_modalData != NULL; }
  44. // show the dialog modally and return the value passed to EndModal()
  45. virtual int ShowModal();
  46. // may be called to terminate the dialog with the given return code
  47. virtual void EndModal(int retCode);
  48. // implementation only from now on
  49. // -------------------------------
  50. // override some base class virtuals
  51. virtual bool Show(bool show = true);
  52. //
  53. // Callbacks
  54. //
  55. virtual MRESULT OS2WindowProc( WXUINT uMessage
  56. ,WXWPARAM wParam
  57. ,WXLPARAM lParam
  58. );
  59. #if WXWIN_COMPATIBILITY_2_6
  60. // Constructor with a modal flag, but no window id - the old convention
  61. wxDEPRECATED( wxDialog( wxWindow* pParent
  62. ,const wxString& rsTitle
  63. ,bool bModal
  64. ,int nX = -1
  65. ,int nY = -1
  66. ,int nWidth = 500
  67. ,int nHeight = 500
  68. ,long lStyle = wxDEFAULT_DIALOG_STYLE
  69. ,const wxString& rsName = wxDialogNameStr
  70. ) );
  71. // just call Show() or ShowModal()
  72. wxDEPRECATED( void SetModal(bool bFlag) );
  73. // use IsModal()
  74. wxDEPRECATED( bool IsModalShowing() const );
  75. #endif // WXWIN_COMPATIBILITY_2_6
  76. protected:
  77. //
  78. // Common part of all ctors
  79. //
  80. void Init(void);
  81. private:
  82. wxWindow* m_pOldFocus;
  83. bool m_endModalCalled; // allow for closing within InitDialog
  84. // this pointer is non-NULL only while the modal event loop is running
  85. wxDialogModalData *m_modalData;
  86. //
  87. // While we are showing a modal dialog we disable the other windows using
  88. // this object
  89. //
  90. class wxWindowDisabler* m_pWindowDisabler;
  91. DECLARE_DYNAMIC_CLASS(wxDialog)
  92. wxDECLARE_NO_COPY_CLASS(wxDialog);
  93. }; // end of CLASS wxDialog
  94. #endif // _WX_DIALOG_H_