# macos.h

    00001 /* $Id: macos.h 11521 2007-11-25 14:43:16Z egladil $ */
    00002
    00003 #ifndef MACOS_H
    00004 #define MACOS_H
    00005
    00006 /*
    00007  * Functions to show the popup window
    00008  * use ShowMacDialog when you want to control title, message and text on the button
    00009  * ShowMacAssertDialog is used by assert
    00010  * ShowMacErrorDialog should be used when an unrecoverable error shows up. It only contains the title, which will should tell what went wrong
    00011  * the function then adds text that tells the user to update and then report the bug if it's present in the newest version
    00012  * It also quits in a nice way since we call it when we know something happened that will crash OpenTTD (like a needed pointer turns out to be NULL or similar)
    00013  */
    00014 void ShowMacDialog ( const char *title, const char *message, const char *buttonLabel );
    00015 void ShowMacAssertDialog ( const char *function, const char *file, const int line, const char *expression );
    00016 void ShowMacErrorDialog(const char *error);
    00017
    00018 // Since MacOS X users will never see an assert unless they started the game from a terminal
    00019 // we're using a custom assert(e) macro.
    00020 #undef assert
    00021
    00022 #ifdef NDEBUG
    00023 #define assert(e)       ((void)0)
    00024 #else
    00025
    00026 #define assert(e) \
    00027     (__builtin_expect(!(e), 0) ? ShowMacAssertDialog ( __func__, __FILE__, __LINE__, #e ): (void)0 )
    00028 #endif
    00029
    00030
    00031
    00036 long GetMacOSVersionMajor();
    00037
    00042 long GetMacOSVersionMinor();
    00043
    00048 long GetMacOSVersionBugfix();
    00049
    00057 static inline bool MacOSVersionIsAtLeast(long major, long minor, long bugfix)
    00058 {
    00059   long maj = GetMacOSVersionMajor();
    00060   long min = GetMacOSVersionMinor();
    00061   long bf = GetMacOSVersionBugfix();
    00062
    00063   if (maj < major) return false;
    00064   if (maj == major && min < minor) return false;
    00065   if (maj == major && min == minor && bf < bugfix) return false;
    00066
    00067   return true;
    00068 }
    00069
    00070 #endif /* MACOS_H */