]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/notifmsgg.cpp
Added ability to switch off more components of the size page UI
[wxWidgets.git] / src / generic / notifmsgg.cpp
index 4bc3ecf1aefe17623c13c5070e1143610afc7fdc..fe90a69f450a0ff95b04bb1b4811478800b476d5 100644 (file)
     #define wxUSE_LIBHILDON 0
 #endif
 
-#if wxUSE_NOTIFICATION_MESSAGE && !wxUSE_LIBHILDON
+#ifndef wxUSE_LIBHILDON2
+    #define wxUSE_LIBHILDON2 0
+#endif
+
+#if wxUSE_NOTIFICATION_MESSAGE && (!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2)
 
 #ifndef WX_PRECOMP
     #include "wx/dialog.h"
     #include "wx/timer.h"
+    #include "wx/sizer.h"
+    #include "wx/statbmp.h"
 #endif //WX_PRECOMP
 
+#include "wx/artprov.h"
+
 // even if the platform has the native implementation, we still normally want
 // to use the generic one (unless it's totally unsuitable for the target UI as
 // is the case of Hildon) because it may provide more features, so include
@@ -52,11 +60,13 @@ class wxNotificationMessageDialog : public wxDialog
 public:
     wxNotificationMessageDialog(wxWindow *parent,
                                 const wxString& text,
-                                int timeout);
+                                int timeout,
+                                int flags);
 
     void Set(wxWindow *parent,
              const wxString& text,
-             int timeout);
+             int timeout,
+             int flags);
 
     bool IsAutomatic() const { return m_timer.IsRunning(); }
     void SetDeleteOnHide() { m_deleteOnHide = true; }
@@ -75,7 +85,7 @@ private:
 
 
     DECLARE_EVENT_TABLE()
-    DECLARE_NO_COPY_CLASS(wxNotificationMessageDialog)
+    wxDECLARE_NO_COPY_CLASS(wxNotificationMessageDialog);
 };
 
 // ============================================================================
@@ -90,7 +100,8 @@ END_EVENT_TABLE()
 
 wxNotificationMessageDialog::wxNotificationMessageDialog(wxWindow *parent,
                                                          const wxString& text,
-                                                         int timeout)
+                                                         int timeout,
+                                                         int flags)
                            : wxDialog(parent, wxID_ANY, _("Notice"),
                                       wxDefaultPosition, wxDefaultSize,
                                       0 /* no caption, no border styles */),
@@ -98,16 +109,29 @@ wxNotificationMessageDialog::wxNotificationMessageDialog(wxWindow *parent,
 {
     m_deleteOnHide = false;
 
-    Set(parent, text, timeout);
+    Set(parent, text, timeout, flags);
 }
 
 void
 wxNotificationMessageDialog::Set(wxWindow * WXUNUSED(parent),
                                  const wxString& text,
-                                 int timeout)
+                                 int timeout,
+                                 int flags)
 {
-    wxSizer *sizer = CreateTextSizer(text);
-    SetSizerAndFit(sizer);
+    wxSizer * const sizerTop = new wxBoxSizer(wxHORIZONTAL);
+    if ( flags & wxICON_MASK )
+    {
+        sizerTop->Add(new wxStaticBitmap
+                          (
+                            this,
+                            wxID_ANY,
+                            wxArtProvider::GetMessageBoxIcon(flags)
+                          ),
+                      wxSizerFlags().Centre().Border());
+    }
+
+    sizerTop->Add(CreateTextSizer(text), wxSizerFlags(1).Border());
+    SetSizerAndFit(sizerTop);
 
     if ( timeout != wxGenericNotificationMessage::Timeout_Never )
     {
@@ -194,12 +218,13 @@ bool wxGenericNotificationMessage::Show(int timeout)
                        (
                         GetParent(),
                         GetFullMessage(),
-                        timeout
+                        timeout,
+                        GetFlags()
                        );
     }
     else // update the existing dialog
     {
-        m_dialog->Set(GetParent(), GetFullMessage(), timeout);
+        m_dialog->Set(GetParent(), GetFullMessage(), timeout, GetFlags());
     }
 
     m_dialog->Show();
@@ -217,4 +242,4 @@ bool wxGenericNotificationMessage::Close()
     return true;
 }
 
-#endif // wxUSE_NOTIFICATION_MESSAGE && !wxUSE_LIBHILDON
+#endif // wxUSE_NOTIFICATION_MESSAGE && (!wxUSE_LIBHILDON || !wxUSE_LIBHILDON2)