/
kDefs.h
146 lines (126 loc) · 4.02 KB
/
kDefs.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
// kX GUI
// Copyright (c) Eugene Gavrilov, 2001-2005.
// All rights reserved
/*
* This program 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; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(_kDefs_H)
#define _kDefs_H
#pragma once
// methods:
#define kMETHOD_COPY 0x1
#define kMETHOD_BLEND 0x10 // alpha
#define kMETHOD_TRANS 0x20 // with keycolor
#define kMETHOD_TILED 0x40 // 'tiled' background for kDialog
#define kMETHOD_DEFAULT 0x1000 // windows-default (not skinned)
#define kMETHOD_OWNER 0x2000 // for statics (owner-draw)
// states
#define kSTATE_CREATED 0x1
#define kSTATE_ENABLED 0x2
#define kSTATE_OVER 0x4
#define kSTATE_SELECTED 0x8
#define kSTATE_DEFAULT 0x10
#define kSTATE_MOVING 0x20
#define kSTATE_FOCUSED 0x40
#define kSTATE_DRAGGING 0x80
#define kSTATE_CHECKED 0x100
// forward class declaration
class kCLASS_TYPE kRect;
class kCLASS_TYPE kPoint;
class kCLASS_TYPE kColor;
class kCLASS_TYPE kDraw;
class kCLASS_TYPE kWindow;
class kCLASS_TYPE kKnob;
class kCLASS_TYPE kLogo;
class kCLASS_TYPE kStatic;
class kCLASS_TYPE kCheckBox;
class kCLASS_TYPE kButton;
class kCLASS_TYPE kDialog;
class kCLASS_TYPE kSlider;
class kCLASS_TYPE kResource;
class kCLASS_TYPE kSettings;
#ifdef CDC
#undef CDC
#endif
#ifndef _T
#if defined(UNICODE) || defined(_UNICODE)
#define _T(a) L ## a
#else
#define _T(a) a
#endif
#endif
#include <malloc.h>
#ifndef ATLA2WHELPER
// MFC70 compatibility
/////////////////////////////////////////////////////////////////////////////
// Global UNICODE<>ANSI translation helpers
inline LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars, UINT acp)
{
ASSERT(lpa != NULL);
ASSERT(lpw != NULL);
// verify that no illegal character present
// since lpw was allocated based on the size of lpa
// don't worry about the number of chars
lpw[0] = '\0';
MultiByteToWideChar(acp, 0, lpa, -1, lpw, nChars);
return lpw;
}
inline LPSTR WINAPI AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars, UINT acp)
{
ASSERT(lpw != NULL);
ASSERT(lpa != NULL);
// verify that no illegal character present
// since lpa was allocated based on the size of lpw
// don't worry about the number of chars
lpa[0] = '\0';
WideCharToMultiByte(acp, 0, lpw, -1, lpa, nChars, NULL, NULL);
return lpa;
}
inline LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars)
{
return AtlA2WHelper(lpw, lpa, nChars, CP_ACP);
}
inline LPSTR WINAPI AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars)
{
return AtlW2AHelper(lpa, lpw, nChars, CP_ACP);
}
#ifdef UNICODE
#define A2W(lpa) (\
((lpa) == NULL) ? NULL : (\
AtlA2WHelper((LPWSTR) alloca((lstrlenA(lpa)+1)*2), lpa, (lstrlenA(lpa)+1))))
#define W2A(lpw) (\
((lpw) == NULL) ? NULL : (\
AtlW2AHelper((LPSTR) alloca((lstrlenW(lpw)+1)*2), lpw, (lstrlenW(lpw)+1)*2)))
#else
#define A2W(a) (a)
#define W2A(a) (a)
#endif
#endif
// define Platform SDK values
#if defined(WIN32) || defined(_WIN32)
#ifndef WS_EX_LAYERED
#define WS_EX_LAYERED 0x00080000
#endif
#ifndef LWA_ALPHA
#define LWA_ALPHA 0x00000002
#endif
#ifndef TTS_BALLOON
#define TTS_BALLOON 0x40
#endif
#endif
#if defined(_MSC_VER)
// #pragma comment(lib, "kxgui.lib")
#endif
#endif