msgdlg.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/msw/msgdlg.h
  3. // Purpose: wxMessageDialog class
  4. // Author: Julian Smart
  5. // Modified by:
  6. // Created: 01/02/97
  7. // Copyright: (c) Julian Smart
  8. // Licence: wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10. #ifndef _WX_MSGBOXDLG_H_
  11. #define _WX_MSGBOXDLG_H_
  12. class WXDLLIMPEXP_CORE wxMessageDialog : public wxMessageDialogBase
  13. {
  14. public:
  15. wxMessageDialog(wxWindow *parent,
  16. const wxString& message,
  17. const wxString& caption = wxMessageBoxCaptionStr,
  18. long style = wxOK|wxCENTRE,
  19. const wxPoint& WXUNUSED(pos) = wxDefaultPosition)
  20. : wxMessageDialogBase(parent, message, caption, style)
  21. {
  22. m_hook = NULL;
  23. }
  24. virtual int ShowModal();
  25. virtual long GetEffectiveIcon() const;
  26. // implementation-specific
  27. // return the font used for the text in the message box
  28. static wxFont GetMessageFont();
  29. protected:
  30. // Override this as task dialogs are always centered on parent.
  31. virtual void DoCentre(int dir);
  32. private:
  33. // hook procedure used to adjust the message box beyond what the standard
  34. // MessageBox() function can do for us
  35. static WXLRESULT wxCALLBACK HookFunction(int code, WXWPARAM, WXLPARAM);
  36. static const struct ButtonAccessors
  37. {
  38. int id;
  39. wxString (wxMessageDialog::*getter)() const;
  40. } ms_buttons[];
  41. // replace the static text control with a text control in order to show
  42. // scrollbar (and also, incidentally, allow text selection)
  43. void ReplaceStaticWithEdit();
  44. // adjust the button labels
  45. //
  46. // this is called from HookFunction() and our HWND is valid at this moment
  47. void AdjustButtonLabels();
  48. // offset all buttons starting from the first one given by dx to the right
  49. void OffsetButtonsStartingFrom(int first, int dx);
  50. // used by ShowModal() to display a message box when task dialogs
  51. // aren't available.
  52. int ShowMessageBox();
  53. WXHANDLE m_hook; // HHOOK used to position the message box
  54. wxDECLARE_DYNAMIC_CLASS_NO_COPY(wxMessageDialog);
  55. };
  56. #endif // _WX_MSGBOXDLG_H_