]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/private/messagetype.h
Extract conversion from wx to GtkMessageType in a separate file.
[wxWidgets.git] / include / wx / gtk / private / messagetype.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/private/msgtype.h
3 // Purpose: translate between wx and GtkMessageType
4 // Author: Vadim Zeitlin
5 // Created: 2009-09-27
6 // RCS-ID: $Id: wxhead.h,v 1.11 2009-06-29 10:23:04 zeitlin Exp $
7 // Copyright: (c) 2009 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _GTK_PRIVATE_MSGTYPE_H_
12 #define _GTK_PRIVATE_MSGTYPE_H_
13
14 #include <gtk/gtkmessagedialog.h>
15
16 namespace wxGTKImpl
17 {
18
19 // Convert the given wx style to GtkMessageType, return true if succeeded or
20 // false if failed.
21 inline bool ConvertMessageTypeFromWX(int style, GtkMessageType *type)
22 {
23 #ifdef __WXGTK210__
24 if ( gtk_check_version(2, 10, 0) == NULL && (style & wxICON_NONE))
25 *type = GTK_MESSAGE_OTHER;
26 else
27 #endif // __WXGTK210__
28 if (style & wxICON_EXCLAMATION)
29 *type = GTK_MESSAGE_WARNING;
30 else if (style & wxICON_ERROR)
31 *type = GTK_MESSAGE_ERROR;
32 else if (style & wxICON_INFORMATION)
33 *type = GTK_MESSAGE_INFO;
34 else if (style & wxICON_QUESTION)
35 *type = GTK_MESSAGE_QUESTION;
36 else
37 return false;
38
39 return true;
40 }
41
42 } // namespace wxGTKImpl
43
44 #endif // _GTK_PRIVATE_MSGTYPE_H_
45