win32.h

Go to the documentation of this file.
00001 /* $Id: win32.h 25170 2013-04-08 20:59:42Z 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 WIN32_H
00013 #define WIN32_H
00014 
00015 #include <windows.h>
00016 bool MyShowCursor(bool show, bool toggle = false);
00017 
00018 typedef void (*Function)(int);
00019 bool LoadLibraryList(Function proc[], const char *dll);
00020 
00021 char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen);
00022 wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen);
00023 
00024 /* Function shortcuts for UTF-8 <> UNICODE conversion. When unicode is not
00025  * defined these macros return the string passed to them, with UNICODE
00026  * they return a pointer to the converted string. The only difference between
00027  * XX_TO_YY and XX_TO_YY_BUFFER is that with the buffer variant you can
00028  * specify where to put the converted string (and how long it can be). Without
00029  * the buffer and internal buffer is used, of max 512 characters */
00030 #if defined(UNICODE)
00031 # define MB_TO_WIDE(str) OTTD2FS(str)
00032 # define MB_TO_WIDE_BUFFER(str, buffer, buflen) convert_to_fs(str, buffer, buflen)
00033 # define WIDE_TO_MB(str) FS2OTTD(str)
00034 # define WIDE_TO_MB_BUFFER(str, buffer, buflen) convert_from_fs(str, buffer, buflen)
00035 #else
00036 extern uint _codepage; // local code-page in the system @see win32_v.cpp:WM_INPUTLANGCHANGE
00037 # define MB_TO_WIDE(str) (str)
00038 # define MB_TO_WIDE_BUFFER(str, buffer, buflen) (str)
00039 # define WIDE_TO_MB(str) (str)
00040 # define WIDE_TO_MB_BUFFER(str, buffer, buflen) (str)
00041 #endif
00042 
00043 HRESULT OTTDSHGetFolderPath(HWND, int, HANDLE, DWORD, LPTSTR);
00044 
00045 #if defined(__MINGW32__)
00046 #define SHGFP_TYPE_CURRENT 0
00047 #endif /* __MINGW32__ */
00048 
00049 #endif /* WIN32_H */