]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/artmsw.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/artmsw.cpp
3 // Purpose: stock wxArtProvider instance with native MSW stock icons
4 // Author: Vaclav Slavik
8 // Copyright: (c) Vaclav Slavik, 2008
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ---------------------------------------------------------------------------
14 // ---------------------------------------------------------------------------
16 // For compilers that support precompilation, includes "wx.h".
17 #include "wx/wxprec.h"
19 #if defined(__BORLANDC__)
23 #include "wx/artprov.h"
24 #include "wx/msw/wrapwin.h"
27 // ----------------------------------------------------------------------------
28 // wxWindowsArtProvider
29 // ----------------------------------------------------------------------------
31 class wxWindowsArtProvider
: public wxArtProvider
34 virtual wxBitmap
CreateBitmap(const wxArtID
& id
, const wxArtClient
& client
,
38 static wxBitmap
CreateFromStdIcon(const char *iconName
)
40 wxIcon
icon(iconName
);
42 bmp
.CopyFromIcon(icon
);
46 wxBitmap
wxWindowsArtProvider::CreateBitmap(const wxArtID
& id
,
47 const wxArtClient
& WXUNUSED(client
),
48 const wxSize
& WXUNUSED(size
))
50 // handle message box icons specially (wxIcon ctor treat these names
51 // as special cases via wxICOResourceHandler::LoadIcon):
52 if ( id
== wxART_ERROR
)
53 return CreateFromStdIcon("wxICON_ERROR");
54 else if ( id
== wxART_INFORMATION
)
55 return CreateFromStdIcon("wxICON_INFORMATION");
56 else if ( id
== wxART_WARNING
)
57 return CreateFromStdIcon("wxICON_WARNING");
58 else if ( id
== wxART_QUESTION
)
59 return CreateFromStdIcon("wxICON_QUESTION");
61 // for anything else, fall back to generic provider:
65 // ----------------------------------------------------------------------------
66 // wxArtProvider::InitNativeProvider()
67 // ----------------------------------------------------------------------------
69 /*static*/ void wxArtProvider::InitNativeProvider()
71 Push(new wxWindowsArtProvider
);
74 // ----------------------------------------------------------------------------
75 // wxArtProvider::GetNativeSizeHint()
76 // ----------------------------------------------------------------------------
79 wxSize
wxArtProvider::GetNativeSizeHint(const wxArtClient
& client
)
81 if ( client
== wxART_TOOLBAR
)
83 return wxSize(24, 24);
85 else if ( client
== wxART_MENU
)
87 return wxSize(16, 16);
89 else if ( client
== wxART_FRAME_ICON
)
91 return wxSize(::GetSystemMetrics(SM_CXSMICON
),
92 ::GetSystemMetrics(SM_CYSMICON
));
94 else if ( client
== wxART_CMN_DIALOG
||
95 client
== wxART_MESSAGE_BOX
)
97 return wxSize(::GetSystemMetrics(SM_CXICON
),
98 ::GetSystemMetrics(SM_CYICON
));
100 else if (client
== wxART_BUTTON
)
102 return wxSize(16, 16);
105 return wxDefaultSize
;