summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/gtk2/src/gtk+/gtk/gtkspinbutton.inc
blob: 9d30d3923ea7d890c90a2801e4e5e74e7e1120d1 (plain)
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
// included by gtk2.pas

{$IFDEF read_forward_definitions}
{$ENDIF read_forward_definitions}

//------------------------------------------------------------------------------

{$IFDEF read_interface_types}
   PGtkSpinButtonUpdatePolicy = ^TGtkSpinButtonUpdatePolicy;
   TGtkSpinButtonUpdatePolicy = (
     GTK_UPDATE_ALWAYS,
     GTK_UPDATE_IF_VALID
   );

   PGtkSpinType = ^TGtkSpinType;
   TGtkSpinType = (
     GTK_SPIN_STEP_FORWARD,
     GTK_SPIN_STEP_BACKWARD,
     GTK_SPIN_PAGE_FORWARD,
     GTK_SPIN_PAGE_BACKWARD,
     GTK_SPIN_HOME,
     GTK_SPIN_END,
     GTK_SPIN_USER_DEFINED
   );

{ valid: GTK_ARROW_UP=0, GTK_ARROW_DOWN=1 or 2=NONE/BOTH  }
   PGtkSpinButton = ^TGtkSpinButton;
   TGtkSpinButton = record
        entry : TGtkEntry;
        adjustment : PGtkAdjustment;
        panel : PGdkWindow;
        timer : guint32;
        climb_rate : gdouble;
        timer_step : gdouble;
        update_policy : TGtkSpinButtonUpdatePolicy;
        flag0 : longint;
     end;

{ Action signals for keybindings, do not connect to these  }
{ Padding for future expansion  }
   PGtkSpinButtonClass = ^TGtkSpinButtonClass;
   TGtkSpinButtonClass = record
        parent_class : TGtkEntryClass;
        input : function (spin_button:PGtkSpinButton; new_value:Pgdouble):gint; cdecl;
        output : function (spin_button:PGtkSpinButton):gint; cdecl;
        value_changed : procedure (spin_button:PGtkSpinButton); cdecl;
        change_value : procedure (spin_button:PGtkSpinButton; scroll:TGtkScrollType); cdecl;
        _gtk_reserved1 : procedure ; cdecl;
        _gtk_reserved2 : procedure ; cdecl;
        _gtk_reserved3 : procedure ; cdecl;
        _gtk_reserved4 : procedure ; cdecl;
     end;

{$ENDIF read_interface_types}

//------------------------------------------------------------------------------

{$IFDEF read_interface_rest}
const
   GTK_INPUT_ERROR = -(1);

   bm_TGtkSpinButton_in_child = $3;
   bp_TGtkSpinButton_in_child = 0;
   bm_TGtkSpinButton_click_child = $C;
   bp_TGtkSpinButton_click_child = 2;
   bm_TGtkSpinButton_button = $30;
   bp_TGtkSpinButton_button = 4;
   bm_TGtkSpinButton_need_timer = $40;
   bp_TGtkSpinButton_need_timer = 6;
   bm_TGtkSpinButton_timer_calls = $380;
   bp_TGtkSpinButton_timer_calls = 7;
   bm_TGtkSpinButton_digits = $FFC00;
   bp_TGtkSpinButton_digits = 10;
   bm_TGtkSpinButton_numeric = $100000;
   bp_TGtkSpinButton_numeric = 20;
   bm_TGtkSpinButton_wrap = $200000;
   bp_TGtkSpinButton_wrap = 21;
   bm_TGtkSpinButton_snap_to_ticks = $400000;
   bp_TGtkSpinButton_snap_to_ticks = 22;


function GTK_TYPE_SPIN_BUTTON : GType;
function GTK_SPIN_BUTTON(obj: pointer) : PGtkSpinButton;
function GTK_SPIN_BUTTON_CLASS(klass: pointer) : PGtkSpinButtonClass;
function GTK_IS_SPIN_BUTTON(obj: pointer) : boolean;
function GTK_IS_SPIN_BUTTON_CLASS(klass: pointer) : boolean;
function GTK_SPIN_BUTTON_GET_CLASS(obj: pointer) : PGtkSpinButtonClass;


function in_child(var a : TGtkSpinButton) : guint; overload;
procedure set_in_child(var a : TGtkSpinButton; __in_child : guint); overload;
function click_child(var a : TGtkSpinButton) : guint; overload;
procedure set_click_child(var a : TGtkSpinButton; __click_child : guint); overload;
function button(var a : TGtkSpinButton) : guint; overload;
procedure set_button(var a : TGtkSpinButton; __button : guint); overload;
function need_timer(var a : TGtkSpinButton) : guint; overload;
procedure set_need_timer(var a : TGtkSpinButton; __need_timer : guint); overload;
function timer_calls(var a : TGtkSpinButton) : guint;
procedure set_timer_calls(var a : TGtkSpinButton; __timer_calls : guint);
function digits(var a : TGtkSpinButton) : guint;
procedure set_digits(var a : TGtkSpinButton; __digits : guint);
function numeric(var a : TGtkSpinButton) : guint;
procedure set_numeric(var a : TGtkSpinButton; __numeric : guint);
function wrap(var a : TGtkSpinButton) : guint; overload;
procedure set_wrap(var a : TGtkSpinButton; __wrap : guint); overload;
function snap_to_ticks(var a : TGtkSpinButton) : guint;
procedure set_snap_to_ticks(var a : TGtkSpinButton; __snap_to_ticks : guint);

function gtk_spin_button_get_type:TGtkType; cdecl; external gtklib;
procedure gtk_spin_button_configure(spin_button:PGtkSpinButton; adjustment:PGtkAdjustment; climb_rate:gdouble; digits:guint); cdecl; external gtklib;
function gtk_spin_button_new(adjustment:PGtkAdjustment; climb_rate:gdouble; digits:guint):PGtkWidget; cdecl; external gtklib;
function gtk_spin_button_new_with_range(min:gdouble; max:gdouble; step:gdouble):PGtkWidget; cdecl; external gtklib;
procedure gtk_spin_button_set_adjustment(spin_button:PGtkSpinButton; adjustment:PGtkAdjustment); cdecl; external gtklib;
function gtk_spin_button_get_adjustment(spin_button:PGtkSpinButton):PGtkAdjustment; cdecl; external gtklib;
procedure gtk_spin_button_set_digits(spin_button:PGtkSpinButton; digits:guint); cdecl; external gtklib;
function gtk_spin_button_get_digits(spin_button:PGtkSpinButton):guint; cdecl; external gtklib;
procedure gtk_spin_button_set_increments(spin_button:PGtkSpinButton; step:gdouble; page:gdouble); cdecl; external gtklib;
procedure gtk_spin_button_get_increments(spin_button:PGtkSpinButton; step:Pgdouble; page:Pgdouble); cdecl; external gtklib;
procedure gtk_spin_button_set_range(spin_button:PGtkSpinButton; min:gdouble; max:gdouble); cdecl; external gtklib;
procedure gtk_spin_button_get_range(spin_button:PGtkSpinButton; min:Pgdouble; max:Pgdouble); cdecl; external gtklib;
function gtk_spin_button_get_value(spin_button:PGtkSpinButton):gdouble; cdecl; external gtklib;
function gtk_spin_button_get_value_as_int(spin_button:PGtkSpinButton):gint; cdecl; external gtklib;
procedure gtk_spin_button_set_value(spin_button:PGtkSpinButton; value:gdouble); cdecl; external gtklib;
procedure gtk_spin_button_set_update_policy(spin_button:PGtkSpinButton; policy:TGtkSpinButtonUpdatePolicy); cdecl; external gtklib;
function gtk_spin_button_get_update_policy(spin_button:PGtkSpinButton):TGtkSpinButtonUpdatePolicy; cdecl; external gtklib;
procedure gtk_spin_button_set_numeric(spin_button:PGtkSpinButton; numeric:gboolean); cdecl; external gtklib;
function gtk_spin_button_get_numeric(spin_button:PGtkSpinButton):gboolean; cdecl; external gtklib;
procedure gtk_spin_button_spin(spin_button:PGtkSpinButton; direction:TGtkSpinType; increment:gdouble); cdecl; external gtklib;
procedure gtk_spin_button_set_wrap(spin_button:PGtkSpinButton; wrap:gboolean); cdecl; external gtklib;
function gtk_spin_button_get_wrap(spin_button:PGtkSpinButton):gboolean; cdecl; external gtklib;
procedure gtk_spin_button_set_snap_to_ticks(spin_button:PGtkSpinButton; snap_to_ticks:gboolean); cdecl; external gtklib;
function gtk_spin_button_get_snap_to_ticks(spin_button:PGtkSpinButton):gboolean; cdecl; external gtklib;
procedure gtk_spin_button_update(spin_button:PGtkSpinButton); cdecl; external gtklib;

{$ifndef GTK_DISABLE_DEPRECATED}
function gtk_spin_button_get_value_as_float(spin_button:PGtkSpinButton):gdouble;
{$endif}

{$ENDIF read_interface_rest}

//------------------------------------------------------------------------------

{$IFDEF read_implementation}
function GTK_TYPE_SPIN_BUTTON : GType;
begin
   GTK_TYPE_SPIN_BUTTON:=gtk_spin_button_get_type;
end;

function GTK_SPIN_BUTTON(obj: pointer) : PGtkSpinButton;
begin
   GTK_SPIN_BUTTON:=PGtkSpinButton(GTK_CHECK_CAST(obj,GTK_TYPE_SPIN_BUTTON));
end;

function GTK_SPIN_BUTTON_CLASS(klass: pointer) : PGtkSpinButtonClass;
begin
   GTK_SPIN_BUTTON_CLASS:=PGtkSpinButtonClass(GTK_CHECK_CLASS_CAST(klass,GTK_TYPE_SPIN_BUTTON));
end;

function GTK_IS_SPIN_BUTTON(obj: pointer) : boolean;
begin
   GTK_IS_SPIN_BUTTON:=GTK_CHECK_TYPE(obj,GTK_TYPE_SPIN_BUTTON);
end;

function GTK_IS_SPIN_BUTTON_CLASS(klass: pointer) : boolean;
begin
   GTK_IS_SPIN_BUTTON_CLASS:=GTK_CHECK_CLASS_TYPE(klass,GTK_TYPE_SPIN_BUTTON);
end;

function GTK_SPIN_BUTTON_GET_CLASS(obj: pointer) : PGtkSpinButtonClass;
begin
   GTK_SPIN_BUTTON_GET_CLASS:=PGtkSpinButtonClass(GTK_CHECK_GET_CLASS(obj,GTK_TYPE_SPIN_BUTTON));
end;

function in_child(var a : TGtkSpinButton) : guint;
begin
   in_child:=(a.flag0 and bm_TGtkSpinButton_in_child) shr bp_TGtkSpinButton_in_child;
end;

procedure set_in_child(var a : TGtkSpinButton; __in_child : guint);
begin
   a.flag0:=a.flag0 or ((__in_child shl bp_TGtkSpinButton_in_child) and bm_TGtkSpinButton_in_child);
end;

function click_child(var a : TGtkSpinButton) : guint;
begin
   click_child:=(a.flag0 and bm_TGtkSpinButton_click_child) shr bp_TGtkSpinButton_click_child;
end;

procedure set_click_child(var a : TGtkSpinButton; __click_child : guint);
begin
   a.flag0:=a.flag0 or ((__click_child shl bp_TGtkSpinButton_click_child) and bm_TGtkSpinButton_click_child);
end;

function button(var a : TGtkSpinButton) : guint;
begin
   button:=(a.flag0 and bm_TGtkSpinButton_button) shr bp_TGtkSpinButton_button;
end;

procedure set_button(var a : TGtkSpinButton; __button : guint);
begin
   a.flag0:=a.flag0 or ((__button shl bp_TGtkSpinButton_button) and bm_TGtkSpinButton_button);
end;

function need_timer(var a : TGtkSpinButton) : guint;
begin
   need_timer:=(a.flag0 and bm_TGtkSpinButton_need_timer) shr bp_TGtkSpinButton_need_timer;
end;

procedure set_need_timer(var a : TGtkSpinButton; __need_timer : guint);
begin
   a.flag0:=a.flag0 or ((__need_timer shl bp_TGtkSpinButton_need_timer) and bm_TGtkSpinButton_need_timer);
end;

function timer_calls(var a : TGtkSpinButton) : guint;
begin
   timer_calls:=(a.flag0 and bm_TGtkSpinButton_timer_calls) shr bp_TGtkSpinButton_timer_calls;
end;

procedure set_timer_calls(var a : TGtkSpinButton; __timer_calls : guint);
begin
   a.flag0:=a.flag0 or ((__timer_calls shl bp_TGtkSpinButton_timer_calls) and bm_TGtkSpinButton_timer_calls);
end;

function digits(var a : TGtkSpinButton) : guint;
begin
   digits:=(a.flag0 and bm_TGtkSpinButton_digits) shr bp_TGtkSpinButton_digits;
end;

procedure set_digits(var a : TGtkSpinButton; __digits : guint);
begin
   a.flag0:=a.flag0 or ((__digits shl bp_TGtkSpinButton_digits) and bm_TGtkSpinButton_digits);
end;

function numeric(var a : TGtkSpinButton) : guint;
begin
   numeric:=(a.flag0 and bm_TGtkSpinButton_numeric) shr bp_TGtkSpinButton_numeric;
end;

procedure set_numeric(var a : TGtkSpinButton; __numeric : guint);
begin
   a.flag0:=a.flag0 or ((__numeric shl bp_TGtkSpinButton_numeric) and bm_TGtkSpinButton_numeric);
end;

function wrap(var a : TGtkSpinButton) : guint;
begin
   wrap:=(a.flag0 and bm_TGtkSpinButton_wrap) shr bp_TGtkSpinButton_wrap;
end;

procedure set_wrap(var a : TGtkSpinButton; __wrap : guint);
begin
   a.flag0:=a.flag0 or ((__wrap shl bp_TGtkSpinButton_wrap) and bm_TGtkSpinButton_wrap);
end;

function snap_to_ticks(var a : TGtkSpinButton) : guint;
begin
   snap_to_ticks:=(a.flag0 and bm_TGtkSpinButton_snap_to_ticks) shr bp_TGtkSpinButton_snap_to_ticks;
end;

procedure set_snap_to_ticks(var a : TGtkSpinButton; __snap_to_ticks : guint);
begin
   a.flag0:=a.flag0 or ((__snap_to_ticks shl bp_TGtkSpinButton_snap_to_ticks) and bm_TGtkSpinButton_snap_to_ticks);
end;

{$ifndef GTK_DISABLE_DEPRECATED}
function gtk_spin_button_get_value_as_float(spin_button:PGtkSpinButton):gdouble;
begin
   gtk_spin_button_get_value_as_float:=gtk_spin_button_get_value(spin_button);
end;
{$endif}

{$ENDIF read_implementation}
// included by gtk2.pas