src/win32.h
author rubidium
Fri, 18 Jul 2008 12:20:31 +0000
changeset 11171 04fc8e49df1b
parent 6577 ee768d653dd0
permissions -rw-r--r--
(svn r13729) -Fix: assumption that non-north tiles of a house do not have the 1x1 building bit set was flawed with some NewGRFs. This caused the amount of houses to differ, which causes the town radii to differ, which causes desyncs when towns are expanded.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2183
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2183
diff changeset
     2
6443
b8f06d8eb7be (svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents: 5726
diff changeset
     3
/** @file win32.h declarations of functions for MS windows systems */
b8f06d8eb7be (svn r8853) -Cleanup: doxygen changes. Correct forgotten c files to cpp files with the @file tag as well as a few general comments style
belugas
parents: 5726
diff changeset
     4
2183
6fba9150225b (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
     5
#ifndef WIN32_H
6fba9150225b (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
     6
#define WIN32_H
6fba9150225b (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
     7
5304
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
     8
#include <windows.h>
2207
40c928fbde8a (svn r2725) Move MyShowCursor() back into win32.c, it fits better there
tron
parents: 2186
diff changeset
     9
bool MyShowCursor(bool show);
40c928fbde8a (svn r2725) Move MyShowCursor() back into win32.c, it fits better there
tron
parents: 2186
diff changeset
    10
2183
6fba9150225b (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
    11
typedef void (*Function)(int);
5168
10a8dc9788d7 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    12
bool LoadLibraryList(Function proc[], const char *dll);
10a8dc9788d7 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    13
5218
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    14
char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen);
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    15
wchar_t *convert_to_fs(const char *name, wchar_t *utf16_buf, size_t buflen);
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    16
5312
884ebccbd847 (svn r7468) -Codechange: [win32] Add some comments to MB/WIDE_TO_WIDE/MB_[BUFFER] macros and
Darkvater
parents: 5304
diff changeset
    17
/* Function shortcuts for UTF-8 <> UNICODE conversion. When unicode is not
884ebccbd847 (svn r7468) -Codechange: [win32] Add some comments to MB/WIDE_TO_WIDE/MB_[BUFFER] macros and
Darkvater
parents: 5304
diff changeset
    18
 * defined these macros return the string passed to them, with UNICODE
884ebccbd847 (svn r7468) -Codechange: [win32] Add some comments to MB/WIDE_TO_WIDE/MB_[BUFFER] macros and
Darkvater
parents: 5304
diff changeset
    19
 * they return a pointer to the converted string. The only difference between
884ebccbd847 (svn r7468) -Codechange: [win32] Add some comments to MB/WIDE_TO_WIDE/MB_[BUFFER] macros and
Darkvater
parents: 5304
diff changeset
    20
 * XX_TO_YY and XX_TO_YY_BUFFER is that with the buffer variant you can
884ebccbd847 (svn r7468) -Codechange: [win32] Add some comments to MB/WIDE_TO_WIDE/MB_[BUFFER] macros and
Darkvater
parents: 5304
diff changeset
    21
 * specify where to put the converted string (and how long it can be). Without
884ebccbd847 (svn r7468) -Codechange: [win32] Add some comments to MB/WIDE_TO_WIDE/MB_[BUFFER] macros and
Darkvater
parents: 5304
diff changeset
    22
 * the buffer and internal buffer is used, of max 512 characters */
5168
10a8dc9788d7 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    23
#if defined(UNICODE)
5218
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    24
# define MB_TO_WIDE(str) OTTD2FS(str)
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    25
# define MB_TO_WIDE_BUFFER(str, buffer, buflen) convert_to_fs(str, buffer, buflen)
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    26
# define WIDE_TO_MB(str) FS2OTTD(str)
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    27
# define WIDE_TO_MB_BUFFER(str, buffer, buflen) convert_from_fs(str, buffer, buflen)
5168
10a8dc9788d7 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    28
#else
6577
ee768d653dd0 (svn r9055) -Codechange: Change windows unicode handling and allow a pure non-unicode build to function. Win9x binaries will be possible with mingw/nightly system.
Darkvater
parents: 6443
diff changeset
    29
extern uint _codepage; // local code-page in the system @see win32_v.cpp:WM_INPUTLANGCHANGE
5218
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    30
# define MB_TO_WIDE(str) (str)
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    31
# define MB_TO_WIDE_BUFFER(str, buffer, buflen) (str)
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    32
# define WIDE_TO_MB(str) (str)
aae5f36a5256 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    33
# define WIDE_TO_MB_BUFFER(str, buffer, buflen) (str)
5168
10a8dc9788d7 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    34
#endif
2183
6fba9150225b (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
    35
5304
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    36
/* Override SHGetFolderPath with our custom implementation */
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    37
#if defined(SHGetFolderPath)
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    38
#undef SHGetFolderPath
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    39
#endif
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    40
#define SHGetFolderPath OTTDSHGetFolderPath
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    41
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    42
HRESULT OTTDSHGetFolderPath(HWND, int, HANDLE, DWORD, LPTSTR);
50daae4d7d38 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    43
5222
4f4cfb2e248e (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    44
#if defined(__MINGW32__)
4f4cfb2e248e (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    45
#define SHGFP_TYPE_CURRENT 0
4f4cfb2e248e (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    46
#endif /* __MINGW32__ */
4f4cfb2e248e (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    47
2436
177cb6a8339f (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2207
diff changeset
    48
#endif /* WIN32_H */