]> git.saurik.com Git - wxWidgets.git/commitdiff
don't use wxApp::GetStdIcon
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Mar 2002 00:21:26 +0000 (00:21 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 24 Mar 2002 00:21:26 +0000 (00:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14748 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/controls/controls.cpp
samples/drawing/drawing.cpp
samples/widgets/notebook.cpp
src/generic/logg.cpp
src/generic/msgdlgg.cpp

index 5b76022c9ffbcf5a1937a6d98241392a21599815..e4b7ae08e7f9610101d6b54fecc6a32a1396031e 100644 (file)
@@ -29,6 +29,7 @@
 #include "wx/tglbtn.h"
 #include "wx/notebook.h"
 #include "wx/imaglist.h"
+#include "wx/artprov.h"
 
 #if wxUSE_TOOLTIPS
     #include "wx/tooltip.h"
@@ -721,12 +722,12 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     panel = new wxPanel(m_notebook);
 
 #if !defined(__WXMOTIF__) && !defined(__WIN16__)  // wxStaticBitmap not working under Motif yet; and icons not allowed under WIN16.
-    wxIcon icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
+    wxIcon icon = wxArtProvider::GetIcon(wxART_INFORMATION);
     wxStaticBitmap *bmpStatic = new wxStaticBitmap(panel, -1, icon,
                                                    wxPoint(10, 10));
 
     bmpStatic = new wxStaticBitmap(panel, -1, wxNullIcon, wxPoint(50, 10));
-    bmpStatic->SetIcon(wxTheApp->GetStdIcon(wxICON_QUESTION));
+    bmpStatic->SetIcon(wxArtProvider::GetIcon(wxART_QUESTION));
 #endif // !Motif
 
     wxBitmap bitmap( 100, 100 );
@@ -751,9 +752,9 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
     }
 #endif
 
-    wxBitmap bmp1(wxTheApp->GetStdIcon(wxICON_INFORMATION)),
-             bmp2(wxTheApp->GetStdIcon(wxICON_WARNING)),
-             bmp3(wxTheApp->GetStdIcon(wxICON_QUESTION));
+    wxBitmap bmp1(wxArtProvider::GetBitmap(wxART_INFORMATION)),
+             bmp2(wxArtProvider::GetBitmap(wxART_WARNING)),
+             bmp3(wxArtProvider::GetBitmap(wxART_QUESTION));
     wxBitmapButton *bmpBtn = new wxBitmapButton
                                  (
                                   panel, -1,
index d96730ad2c8aff6472858c7e78be05073c83ed07..b8c1079ae33f309bfad89f5985c1fc08f5715b0d 100644 (file)
@@ -37,6 +37,7 @@
 
 #include "wx/colordlg.h"
 #include "wx/image.h"
+#include "wx/artprov.h"
 
 // ----------------------------------------------------------------------------
 // ressources
@@ -368,7 +369,7 @@ MyCanvas::MyCanvas(MyFrame *parent)
     m_owner = parent;
     m_show = Show_Default;
     m_smile_bmp = wxBitmap(smile_xpm);
-    m_std_icon = wxTheApp->GetStdIcon(wxICON_INFORMATION);
+    m_std_icon = wxArtProvider::GetIcon(wxART_INFORMATION);
 }
 
 void MyCanvas::DrawTestBrushes(wxDC& dc)
@@ -553,9 +554,9 @@ void MyCanvas::DrawDefault(wxDC& dc)
 
     memdc.SelectObject( wxNullBitmap );
     dc.DrawBitmap( bitmap, 10, 170 );
-    wxImage image( bitmap );
+    wxImage image = bitmap.ConvertToImage();
     image.Rescale( 60,210 );
-    bitmap = image.ConvertToBitmap();
+    bitmap = wxBitmap(image);
     dc.DrawBitmap( bitmap, 50, 170 );
 
     // test the rectangle outline drawing - there should be one pixel between
index 92d8c089d57eec0a66b9618ef40fee599e57f12a..170e535864971cf74af2171824307bff0cf02411 100644 (file)
@@ -41,6 +41,7 @@
 
 #include "wx/sizer.h"
 #include "wx/notebook.h"
+#include "wx/artprov.h"
 
 #include "widgets.h"
 
@@ -320,10 +321,11 @@ void NotebookWidgetsPage::CreateImageList()
         {
             // create a dummy image list with a few icons
             m_imageList = new wxImageList(32, 32);
-            m_imageList->Add(wxTheApp->GetStdIcon(wxICON_INFORMATION));
-            m_imageList->Add(wxTheApp->GetStdIcon(wxICON_QUESTION));
-            m_imageList->Add(wxTheApp->GetStdIcon(wxICON_WARNING));
-            m_imageList->Add(wxTheApp->GetStdIcon(wxICON_ERROR));
+            wxSize size(32, 32);
+            m_imageList->Add(wxArtProvider::GetIcon(wxART_INFORMATION, wxART_OTHER, size));
+            m_imageList->Add(wxArtProvider::GetIcon(wxART_QUESTION, wxART_OTHER, size));
+            m_imageList->Add(wxArtProvider::GetIcon(wxART_WARNING, wxART_OTHER, size));
+            m_imageList->Add(wxArtProvider::GetIcon(wxART_ERROR, wxART_OTHER, size));
         }
 
         m_notebook->SetImageList(m_imageList);
index fd60b1f97223c4937c6e0eedfbf70e46939f2009..5bff11e876758488acb9f9f9678e5fced4a8958b 100644 (file)
@@ -52,6 +52,7 @@
 #include "wx/file.h"
 #include "wx/textfile.h"
 #include "wx/statline.h"
+#include "wx/artprov.h"
 
 #ifdef  __WXMSW__
   // for OutputDebugString()
@@ -734,8 +735,19 @@ wxLogDialog::wxLogDialog(wxWindow *parent,
     sizerButtons->Add(m_btnDetails, 0, wxCENTRE | wxTOP, MARGIN/2 - 1);
 
 #ifndef __WIN16__
-    wxIcon icon = wxTheApp->GetStdIcon((int)(style & wxICON_MASK));
-    sizerAll->Add(new wxStaticBitmap(this, -1, icon), 0);
+    wxBitmap bitmap;
+    switch ( style & wxICON_MASK )
+    {
+        case wxICON_ERROR:
+            bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX); break;
+        case wxICON_INFORMATION:
+            bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX); break;
+        case wxICON_WARNING:
+            bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX); break;
+        default:
+            wxFAIL_MSG(_T("incorrect log style"));
+    }
+    sizerAll->Add(new wxStaticBitmap(this, -1, bitmap), 0);
 #endif // !Win16
 
     const wxString& message = messages.Last();
@@ -795,11 +807,11 @@ void wxLogDialog::CreateDetailsControls()
     wxImageList *imageList = new wxImageList(ICON_SIZE, ICON_SIZE);
 
     // order should be the same as in the switch below!
-    static const int icons[] =
+    static const wxChar* icons[] =
     {
-        wxICON_ERROR,
-        wxICON_EXCLAMATION,
-        wxICON_INFORMATION
+        wxART_ERROR,
+        wxART_WARNING,
+        wxART_INFORMATION
     };
 
     bool loadedIcons = TRUE;
@@ -807,19 +819,20 @@ void wxLogDialog::CreateDetailsControls()
 #ifndef __WIN16__
     for ( size_t icon = 0; icon < WXSIZEOF(icons); icon++ )
     {
-        wxBitmap bmp = wxTheApp->GetStdIcon(icons[icon]);
+        wxBitmap bmp = wxArtProvider::GetBitmap(icons[icon], wxART_MESSAGE_BOX,
+                                                wxSize(ICON_SIZE, ICON_SIZE));
 
         // This may very well fail if there are insufficient colours available.
         // Degrade gracefully.
         if ( !bmp.Ok() )
         {
+            wxLogError("FAILED fro %s:", icons[icon]);
             loadedIcons = FALSE;
 
             break;
         }
 
-        wxImage img(bmp);
-        imageList->Add(img.Rescale(ICON_SIZE, ICON_SIZE).ConvertToBitmap());
+        imageList->Add(bmp);
     }
 
     m_listctrl->SetImageList(imageList, wxIMAGE_LIST_SMALL);
index f4f383f6763991eccc4e1db452580a6284a52296..0326abef58c385f7cbd8a0a3f2dc9997c5ff051a 100644 (file)
@@ -39,6 +39,7 @@
 #include <string.h>
 
 #include "wx/generic/msgdlgg.h"
+#include "wx/artprov.h"
 
 #if wxUSE_STATLINE
   #include "wx/statline.h"
@@ -72,9 +73,22 @@ wxGenericMessageDialog::wxGenericMessageDialog( wxWindow *parent,
     // 1) icon
     if (style & wxICON_MASK)
     {
-         wxStaticBitmap *icon = new wxStaticBitmap(
-            this, -1, wxTheApp->GetStdIcon((int)(style & wxICON_MASK)));
-         icon_text->Add( icon, 0, wxCENTER );
+        wxBitmap bitmap;
+        switch ( style & wxICON_MASK )
+        {
+            case wxICON_ERROR:
+                bitmap = wxArtProvider::GetIcon(wxART_ERROR, wxART_MESSAGE_BOX); break;
+            case wxICON_INFORMATION:
+                bitmap = wxArtProvider::GetIcon(wxART_INFORMATION, wxART_MESSAGE_BOX); break;
+            case wxICON_WARNING:
+                bitmap = wxArtProvider::GetIcon(wxART_WARNING, wxART_MESSAGE_BOX); break;
+            case wxICON_QUESTION:
+                bitmap = wxArtProvider::GetIcon(wxART_QUESTION, wxART_MESSAGE_BOX); break;
+            default:
+                wxFAIL_MSG(_T("incorrect log style"));
+        }
+        wxStaticBitmap *icon = new wxStaticBitmap(this, -1, bitmap);
+        icon_text->Add( icon, 0, wxCENTER );
     }
 
     // 2) text