src/win32.h
author rubidium
Thu, 18 Dec 2008 12:23:08 +0000
changeset 10436 8d3a9fbe8f19
parent 6251 2ad87f850eb9
permissions -rw-r--r--
(svn r14689) -Change: make configure die on commonly made user mistakes, like not having SDL development files or zlib headers installed; you can still compile a dedicated server or a binary without zlib, but you have to explicitly force it.
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2183
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2183
diff changeset
     2
6117
6507b2a7e71d (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: 5475
diff changeset
     3
/** @file win32.h declarations of functions for MS windows systems */
6507b2a7e71d (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: 5475
diff changeset
     4
2183
b88b90aba8bc (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
     5
#ifndef WIN32_H
b88b90aba8bc (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
     6
#define WIN32_H
b88b90aba8bc (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
     7
5304
288359176ea1 (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
be1ef1e1fc58 (svn r2725) Move MyShowCursor() back into win32.c, it fits better there
tron
parents: 2186
diff changeset
     9
bool MyShowCursor(bool show);
be1ef1e1fc58 (svn r2725) Move MyShowCursor() back into win32.c, it fits better there
tron
parents: 2186
diff changeset
    10
2183
b88b90aba8bc (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
e206899169c4 (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);
e206899169c4 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    13
5218
bde1f7566777 (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);
bde1f7566777 (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);
bde1f7566777 (svn r7333) -Codechange: [win32] Extend the OTTD2FS and FS2OTTD functions to also accept conversions
Darkvater
parents: 5168
diff changeset
    16
5312
ce01037b54f1 (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
ce01037b54f1 (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
ce01037b54f1 (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
ce01037b54f1 (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
ce01037b54f1 (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
ce01037b54f1 (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
e206899169c4 (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
bde1f7566777 (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)
bde1f7566777 (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)
bde1f7566777 (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)
bde1f7566777 (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
e206899169c4 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    28
#else
6251
2ad87f850eb9 (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: 6117
diff changeset
    29
extern uint _codepage; // local code-page in the system @see win32_v.cpp:WM_INPUTLANGCHANGE
5218
bde1f7566777 (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)
bde1f7566777 (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)
bde1f7566777 (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)
bde1f7566777 (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
e206899169c4 (svn r7278) -Codechange: [win32] Add UNICODE support so it should compile on OS's using UNICODE
Darkvater
parents: 2436
diff changeset
    34
#endif
2183
b88b90aba8bc (svn r2697) Make compiling with SDL on Windows work again (missing #includes) and fix some warnings
tron
parents:
diff changeset
    35
5304
288359176ea1 (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 */
288359176ea1 (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)
288359176ea1 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    38
#undef SHGetFolderPath
288359176ea1 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    39
#endif
288359176ea1 (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
288359176ea1 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    41
288359176ea1 (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);
288359176ea1 (svn r7460) -Fix (r7337): [win32] If the underlying OS didn't have support for SHGetFolderPath the
Darkvater
parents: 5222
diff changeset
    43
5222
66a48f112460 (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    44
#if defined(__MINGW32__)
66a48f112460 (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
66a48f112460 (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    46
#endif /* __MINGW32__ */
66a48f112460 (svn r7337) -Feature: [win32] Add font selection by specifying a font-name, ala Fontconfig. Pretty
Darkvater
parents: 5218
diff changeset
    47
2436
7d5df545bd5d (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 */