dialog.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/osx/dialog.h
  3. // Purpose: wxDialog class
  4. // Author: Stefan Csomor
  5. // Modified by:
  6. // Created: 1998-01-01
  7. // Copyright: (c) Stefan Csomor
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_DIALOG_H_
  11. #define _WX_DIALOG_H_
  12. #include "wx/panel.h"
  13. class WXDLLIMPEXP_FWD_CORE wxMacToolTip ;
  14. class WXDLLIMPEXP_FWD_CORE wxModalEventLoop ;
  15. // Dialog boxes
  16. class WXDLLIMPEXP_CORE wxDialog : public wxDialogBase
  17. {
  18. DECLARE_DYNAMIC_CLASS(wxDialog)
  19. public:
  20. wxDialog() { Init(); }
  21. // Constructor with no modal flag - the new convention.
  22. wxDialog(wxWindow *parent, wxWindowID id,
  23. const wxString& title,
  24. const wxPoint& pos = wxDefaultPosition,
  25. const wxSize& size = wxDefaultSize,
  26. long style = wxDEFAULT_DIALOG_STYLE,
  27. const wxString& name = wxDialogNameStr)
  28. {
  29. Init();
  30. Create(parent, id, title, pos, size, style, name);
  31. }
  32. bool Create(wxWindow *parent, wxWindowID id,
  33. const wxString& title,
  34. const wxPoint& pos = wxDefaultPosition,
  35. const wxSize& size = wxDefaultSize,
  36. long style = wxDEFAULT_DIALOG_STYLE,
  37. const wxString& name = wxDialogNameStr);
  38. virtual ~wxDialog();
  39. // virtual bool Destroy();
  40. virtual bool Show(bool show = true);
  41. // return true if we're showing the dialog modally
  42. virtual bool IsModal() const;
  43. // show the dialog modally and return the value passed to EndModal()
  44. virtual int ShowModal();
  45. virtual void ShowWindowModal();
  46. // may be called to terminate the dialog with the given return code
  47. virtual void EndModal(int retCode);
  48. static bool OSXHasModalDialogsOpen();
  49. static void OSXBeginModalDialog();
  50. static void OSXEndModalDialog();
  51. // implementation
  52. // --------------
  53. wxDialogModality GetModality() const;
  54. #if wxOSX_USE_COCOA
  55. virtual void ModalFinishedCallback(void* WXUNUSED(panel), int WXUNUSED(returnCode)) {}
  56. #endif
  57. protected:
  58. // show window modal dialog
  59. void DoShowWindowModal();
  60. // end window modal dialog.
  61. void EndWindowModal();
  62. // mac also takes command-period as cancel
  63. virtual bool IsEscapeKey(const wxKeyEvent& event);
  64. wxDialogModality m_modality;
  65. wxModalEventLoop* m_eventLoop;
  66. private:
  67. void Init();
  68. };
  69. #endif
  70. // _WX_DIALOG_H_