]>
git.saurik.com Git - wxWidgets.git/blob - src/osx/artmac.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/artmac.cpp
3 // Purpose: wxArtProvider instance with native Mac stock icons
7 // Copyright: (c) wxWindows team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ---------------------------------------------------------------------------
13 // ---------------------------------------------------------------------------
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
18 #if defined(__BORLANDC__)
22 #include "wx/artprov.h"
28 #if wxOSX_USE_COCOA_OR_CARBON
30 // ----------------------------------------------------------------------------
32 // ----------------------------------------------------------------------------
34 class wxMacArtProvider
: public wxArtProvider
37 virtual wxIconBundle
CreateIconBundle(const wxArtID
& id
,
38 const wxArtClient
& client
);
41 /* static */ void wxArtProvider::InitNativeProvider()
43 wxArtProvider::Push(new wxMacArtProvider
);
46 // ----------------------------------------------------------------------------
48 // ----------------------------------------------------------------------------
50 #define CREATE_STD_ICON(iconId, xpmRc) \
52 wxIconBundle icon(_T(iconId), wxBITMAP_TYPE_ICON_RESOURCE); \
56 // Macro used in CreateBitmap to get wxICON_FOO icons:
57 #define ART_MSGBOX(artId, iconId, xpmRc) \
60 CREATE_STD_ICON(#iconId, xpmRc) \
63 static wxIconBundle
wxMacArtProvider_CreateIconBundle(const wxArtID
& id
)
65 ART_MSGBOX(wxART_ERROR
, wxICON_ERROR
, error
)
66 ART_MSGBOX(wxART_INFORMATION
, wxICON_INFORMATION
, info
)
67 ART_MSGBOX(wxART_WARNING
, wxICON_WARNING
, warning
)
68 ART_MSGBOX(wxART_QUESTION
, wxICON_QUESTION
, question
)
70 ART_MSGBOX(wxART_FOLDER
, wxICON_FOLDER
, folder
)
71 ART_MSGBOX(wxART_FOLDER_OPEN
, wxICON_FOLDER_OPEN
, folder_open
)
72 ART_MSGBOX(wxART_NORMAL_FILE
, wxICON_NORMAL_FILE
, deffile
)
73 ART_MSGBOX(wxART_EXECUTABLE_FILE
, wxICON_EXECUTABLE_FILE
, exefile
)
75 ART_MSGBOX(wxART_CDROM
, wxICON_CDROM
, cdrom
)
76 ART_MSGBOX(wxART_FLOPPY
, wxICON_FLOPPY
, floppy
)
77 ART_MSGBOX(wxART_HARDDISK
, wxICON_HARDDISK
, harddisk
)
78 ART_MSGBOX(wxART_REMOVABLE
, wxICON_REMOVABLE
, removable
)
80 ART_MSGBOX(wxART_DELETE
, wxICON_DELETE
, delete)
82 ART_MSGBOX(wxART_GO_BACK
, wxICON_GO_BACK
, back
)
83 ART_MSGBOX(wxART_GO_FORWARD
, wxICON_GO_FORWARD
, forward
)
84 ART_MSGBOX(wxART_GO_HOME
, wxICON_GO_HOME
, home
)
86 ART_MSGBOX(wxART_HELP_SETTINGS
, wxICON_HELP_SETTINGS
, htmoptns
)
87 ART_MSGBOX(wxART_HELP_PAGE
, wxICON_HELP_PAGE
, htmpage
)
89 return wxNullIconBundle
;
92 // ----------------------------------------------------------------------------
94 // ----------------------------------------------------------------------------
96 wxIconBundle
wxMacArtProvider::CreateIconBundle(const wxArtID
& id
, const wxArtClient
& client
)
98 // On the Mac folders in lists are always drawn closed, so if an open
99 // folder icon is asked for we will ask for a closed one in its place
100 if ( client
== wxART_LIST
&& id
== wxART_FOLDER_OPEN
)
101 return wxMacArtProvider_CreateIconBundle(wxART_FOLDER
);
103 return wxMacArtProvider_CreateIconBundle(id
);
107 // ----------------------------------------------------------------------------
108 // wxArtProvider::GetNativeSizeHint()
109 // ----------------------------------------------------------------------------
112 wxSize
wxArtProvider::GetNativeSizeHint(const wxArtClient
& client
)
114 if ( client
== wxART_TOOLBAR
)
116 // See http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIcons/chapter_15_section_9.html:
117 // "32 x 32 pixels is the recommended size"
118 return wxSize(32, 32);
121 return wxDefaultSize
;
124 #endif // wxOSX_USE_COCOA_CARBON