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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
/*
* $Header: /home/dmarkle/xtrkcad-fork-cvs/xtrkcad/app/wlib/gtklib/gtkint.h,v 1.8 2009-12-12 17:16:08 m_fischer Exp $
*/
/* XTrkCad - Model Railroad CAD
* Copyright (C) 2005 Dave Bullis
*
* 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.
*/
#ifndef GTKINT_H
#define GTKINT_H
#include "wlib.h"
#include "gdk/gdk.h"
#include "gtk/gtk.h"
#define EXPORT
#ifdef WINDOWS
#define strcasecmp _stricmp
#endif
#include "dynarr.h"
extern wWin_p gtkMainW;
typedef enum {
W_MAIN, W_POPUP,
B_BUTTON, B_CANCEL, B_POPUP, B_TEXT, B_INTEGER, B_FLOAT,
B_LIST, B_DROPLIST, B_COMBOLIST,
B_RADIO, B_TOGGLE,
B_DRAW, B_MENU, B_MULTITEXT, B_MESSAGE, B_LINES,
B_MENUITEM, B_BOX,
B_BITMAP } wType_e;
typedef void (*repaintProcCallback_p)( wControl_p );
typedef void (*doneProcCallback_p)( wControl_p b );
typedef void (*setTriggerCallback_p)( wControl_p b );
#define WOBJ_COMMON \
wType_e type; \
wControl_p next; \
wControl_p synonym; \
wWin_p parent; \
wPos_t origX, origY; \
wPos_t realX, realY; \
wPos_t labelW; \
wPos_t w, h; \
long option; \
const char * labelStr; \
repaintProcCallback_p repaintProc; \
GtkWidget * widget; \
GtkWidget * label; \
doneProcCallback_p doneProc; \
void * data;
struct wWin_t {
WOBJ_COMMON
GtkWidget *gtkwin; /**< GTK window */
wPos_t lastX, lastY;
wControl_p first, last;
wWinCallBack_p winProc; /**< window procedure */
wBool_t shown; /**< visibility state */
const char * nameStr; /**< window name (not title) */
GtkWidget * menubar; /**< menubar handle (if exists) */
GdkGC * gc; /**< graphics context */
int gc_linewidth; /**< ??? */
wBool_t busy;
int modalLevel;
};
struct wControl_t {
WOBJ_COMMON
};
#define gtkIcon_bitmap (1)
#define gtkIcon_pixmap (2)
struct wIcon_t {
int gtkIconType;
wPos_t w;
wPos_t h;
wDrawColor color;
const void * bits;
};
extern char wAppName[];
extern char wConfigName[];
extern wDrawColor wDrawColorWhite;
extern wDrawColor wDrawColorBlack;
/* gtkmisc.c */
void * gtkAlloc( wWin_p, wType_e, wPos_t, wPos_t, const char *, int, void * );
void gtkComputePos( wControl_p );
void gtkAddButton( wControl_p );
int gtkAddLabel( wControl_p, const char * );
void gtkControlGetSize( wControl_p );
struct accelData_t;
struct accelData_t * gtkFindAccelKey( GdkEventKey * event );
wBool_t gtkHandleAccelKey( GdkEventKey * );
wBool_t catch_shift_ctrl_alt_keys( GtkWidget *, GdkEventKey *, void * );
void gtkSetReadonly( wControl_p, wBool_t );
wControl_p gtkGetControlFromPos( wWin_p, wPos_t, wPos_t );
void gtkSetTrigger( wControl_p, setTriggerCallback_p );
GdkPixmap * gtkMakeIcon( GtkWidget *, wIcon_p, GdkBitmap ** );
char * gtkConvertInput( const char * );
char * gtkConvertOutput( const char * );
/* gtkwindow.c */
void gtkDoModal( wWin_p, wBool_t );
/* gtkhelp.c */
void load_into_view( char *, int );
void gtkAddHelpString( GtkWidget *, const char * );
void gtkHelpHideBalloon( void );
/* gtksimple.c */
void gtkDrawBox( wWin_p, wBoxType_e, wPos_t, wPos_t, wPos_t, wPos_t );
void gtkLineShow( wLine_p, wBool_t );
/* gktlist.c */
void gtkListShow( wList_p, wBool_t );
void gtkListSetPos( wList_p );
void gtkListActive( wList_p, wBool_t );
void gtkDropListPos( wList_p );
/* gtktext.c */
void gtkTextFreeze( wText_p );
void gtkTextThaw( wText_p );
/* gtkfont.c */
const char * gtkFontTranslate( wFont_p );
PangoLayout *gtkFontCreatePangoLayout( GtkWidget *, void *cairo,
wFont_p, wFontSize_t, const char *,
int *, int *, int *, int * );
/* gtkbutton.c */
void gtkButtonDoAction( wButton_p );
void gtkSetLabel( GtkWidget*, long, const char *, GtkLabel**, GtkWidget** );
/* gtkcolor.c */
void gtkGetColorMap( void );
GdkColor * gtkGetColor( wDrawColor, wBool_t );
int gtkGetColorChar( wDrawColor );
void gtkPrintColorMap( FILE *, int, int );
int gtkMapPixel( long );
/* psprint.c */
typedef struct {
wIndex_t cmdOrFile;
FILE * f;
} wPrinterStream_t;
typedef wPrinterStream_t * wPrinterStream_p;
wPrinterStream_p wPrinterOpen( void );
void wPrinterWrite( wPrinterStream_p p, char * buff, int siz );
void wPrinterClose( wPrinterStream_p );
void psPrintLine( wPos_t, wPos_t, wPos_t, wPos_t,
wDrawWidth, wDrawLineType_e, wDrawColor, wDrawOpts );
void psPrintArc( wPos_t, wPos_t, wPos_t, double, double, int,
wDrawWidth, wDrawLineType_e, wDrawColor, wDrawOpts );
void psPrintString( wPos_t x, wPos_t y, double a, char * s,
wFont_p fp, double fs, wDrawColor color, wDrawOpts opts );
void psPrintFillRectangle( wPos_t, wPos_t, wPos_t, wPos_t, wDrawColor, wDrawOpts );
void psPrintFillPolygon( wPos_t [][2], int, wDrawColor, wDrawOpts );
void psPrintFillCircle( wPos_t, wPos_t, wPos_t, wDrawColor, wDrawOpts );
#endif
|