macos.h

Go to the documentation of this file.
00001 /* $Id: macos.h 22992 2011-10-04 20:12:02Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
00006  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
00007  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
00008  */
00009 
00012 #ifndef MACOS_H
00013 #define MACOS_H
00014 
00015 /* It would seem that to ensure backward compability we have to ensure that we have defined MAC_OS_X_VERSION_10_x everywhere */
00016 #ifndef MAC_OS_X_VERSION_10_3
00017 #define MAC_OS_X_VERSION_10_3 1030
00018 #endif
00019 
00020 #ifndef MAC_OS_X_VERSION_10_4
00021 #define MAC_OS_X_VERSION_10_4 1040
00022 #endif
00023 
00024 #ifndef MAC_OS_X_VERSION_10_5
00025 #define MAC_OS_X_VERSION_10_5 1050
00026 #endif
00027 
00028 #ifndef MAC_OS_X_VERSION_10_6
00029 #define MAC_OS_X_VERSION_10_6 1060
00030 #endif
00031 
00032 #ifndef MAC_OS_X_VERSION_10_7
00033 #define MAC_OS_X_VERSION_10_7 1070
00034 #endif
00035 
00036 #ifndef MAC_OS_X_VERSION_10_8
00037 #define MAC_OS_X_VERSION_10_8 1080
00038 #endif
00039 
00040 
00042 void ShowMacDialog(const char *title, const char *message, const char *button_label);
00043 
00044 void GetMacOSVersion(int *return_major, int *return_minor, int *return_bugfix);
00045 
00053 static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
00054 {
00055   int version_major, version_minor, version_bugfix;
00056   GetMacOSVersion(&version_major, &version_minor, &version_bugfix);
00057 
00058   if (version_major < major) return false;
00059   if (version_major == major && version_minor < minor) return false;
00060   if (version_major == major && version_minor == minor && version_bugfix < bugfix) return false;
00061 
00062   return true;
00063 }
00064 
00065 #endif /* MACOS_H */