-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyle.go
437 lines (406 loc) · 19.5 KB
/
style.go
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
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
// Copyright (c) 2023 The Go-Curses Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package ctk
import (
"github.com/go-curses/cdk"
cenums "github.com/go-curses/cdk/lib/enums"
"github.com/go-curses/cdk/lib/ptypes"
"github.com/go-curses/ctk/lib/enums"
)
const TypeStyle cdk.CTypeTag = "ctk-style"
func init() {
_ = cdk.TypesManager.AddType(TypeStyle, func() interface{} { return MakeStyle() })
}
// Style Hierarchy:
// Object
// +- Style
type Style interface {
Object
PaintArrow(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, arrowType enums.ArrowType, fill bool, x int, y int, width int, height int)
PaintBox(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintBoxGap(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, gapSide enums.PositionType, gapX int, gapWidth int)
PaintCheck(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintDiamond(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintExtension(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, gapSide enums.PositionType)
PaintFlatBox(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintFocus(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintHandle(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, orientation cenums.Orientation)
PaintOption(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintPolygon(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, points []ptypes.Point2I, nPoints int, fill bool)
PaintShadow(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintShadowGap(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, gapSide enums.PositionType, gapX int, gapWidth int)
PaintSlider(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, orientation cenums.Orientation)
PaintSpinner(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, step int, x int, y int, width int, height int)
PaintTab(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int)
PaintVLine(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, y1 int, y2 int, x int)
PaintExpander(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, expanderStyle enums.ExpanderStyle)
PaintResizeGrip(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, edge enums.WindowEdge, x int, y int, width int, height int)
}
var _ Style = (*CStyle)(nil)
// The CStyle structure implements the Style interface and is
// exported to facilitate type embedding with custom implementations. No member
// variables are exported as the interface methods are the only intended means
// of interacting with Style objects
type CStyle struct {
CObject
}
// Default constructor for Style objects
func MakeStyle() Style {
return NewStyle()
}
// Constructor for Style objects
func NewStyle() (value Style) {
s := new(CStyle)
s.Init()
return s
}
// Style object initialization. This must be called at least once to setup
// the necessary defaults and allocate any memory structures. Calling this more
// than once is safe though unnecessary. Only the first call will result in any
// effect upon the Style instance
func (s *CStyle) Init() (already bool) {
if s.InitTypeItem(TypeStyle, s) {
return true
}
s.CObject.Init()
return false
}
// Draws an arrow in the given rectangle on window using the given
// parameters. arrow_type determines the direction of the arrow.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// arrowType the type of arrow to draw
// fill TRUE if the arrow tip should be filled
// x x origin of the rectangle to draw the arrow in
// y y origin of the rectangle to draw the arrow in
// width width of the rectangle to draw the arrow in
// height height of the rectangle to draw the arrow in
func (s *CStyle) PaintArrow(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, arrowType enums.ArrowType, fill bool, x int, y int, width int, height int) {
}
// Draws a box on window with the given parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the box
// y y origin of the box
// width the width of the box
// height the height of the box
func (s *CStyle) PaintBox(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a box in window using the given style and state and shadow type,
// leaving a gap in one side.
// Parameters:
// window a Window
// stateType a state
// shadowType type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle
// y y origin of the rectangle
// width width of the rectangle
// height width of the rectangle
// gapSide side in which to leave the gap
// gapX starting position of the gap
// gapWidth width of the gap
func (s *CStyle) PaintBoxGap(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, gapSide enums.PositionType, gapX int, gapWidth int) {
}
// Draws a check button indicator in the given rectangle on window with the
// given parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle to draw the check in
// y y origin of the rectangle to draw the check in
// width the width of the rectangle to draw the check in
// height the height of the rectangle to draw the check in
func (s *CStyle) PaintCheck(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a diamond in the given rectangle on window using the given
// parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle to draw the diamond in
// y y origin of the rectangle to draw the diamond in
// width width of the rectangle to draw the diamond in
// height height of the rectangle to draw the diamond in
func (s *CStyle) PaintDiamond(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws an extension, i.e. a notebook tab.
// Parameters:
// window a Window
// stateType a state
// shadowType type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the extension
// y y origin of the extension
// width width of the extension
// height width of the extension
// gapSide the side on to which the extension is attached
func (s *CStyle) PaintExtension(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, gapSide enums.PositionType) {
}
// Draws a flat box on window with the given parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the box
// y y origin of the box
// width the width of the box
// height the height of the box
func (s *CStyle) PaintFlatBox(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a focus indicator around the given rectangle on window using the
// given style.
// Parameters:
// window a Window
// stateType a state
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x the x origin of the rectangle around which to draw a focus indicator
// y the y origin of the rectangle around which to draw a focus indicator
// width the width of the rectangle around which to draw a focus indicator
// height the height of the rectangle around which to draw a focus indicator
func (s *CStyle) PaintFocus(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a handle as used in HandleBox and Paned.
// Parameters:
// window a Window
// stateType a state
// shadowType type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the handle
// y y origin of the handle
// width with of the handle
// height height of the handle
// orientation the orientation of the handle
func (s *CStyle) PaintHandle(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, orientation cenums.Orientation) {
}
// Draws a radio button indicator in the given rectangle on window with the
// given parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle to draw the option in
// y y origin of the rectangle to draw the option in
// width the width of the rectangle to draw the option in
// height the height of the rectangle to draw the option in
func (s *CStyle) PaintOption(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a polygon on window with the given parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// points an array of Points
// nPoints length of points
//
// fill TRUE if the polygon should be filled
func (s *CStyle) PaintPolygon(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, points []ptypes.Point2I, nPoints int, fill bool) {
}
// Draws a shadow around the given rectangle in window using the given style
// and state and shadow type.
// Parameters:
// window a Window
// stateType a state
// shadowType type of shadow to draw
// area clip rectangle or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle
// y y origin of the rectangle
// width width of the rectangle
// height width of the rectangle
func (s *CStyle) PaintShadow(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a shadow around the given rectangle in window using the given style
// and state and shadow type, leaving a gap in one side.
// Parameters:
// window a Window
// stateType a state
// shadowType type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle
// y y origin of the rectangle
// width width of the rectangle
// height width of the rectangle
// gapSide side in which to leave the gap
// gapX starting position of the gap
// gapWidth width of the gap
func (s *CStyle) PaintShadowGap(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, gapSide enums.PositionType, gapX int, gapWidth int) {
}
// Draws a slider in the given rectangle on window using the given style and
// orientation.
// Parameters:
// window a Window
// stateType a state
// shadowType a shadow
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x the x origin of the rectangle in which to draw a slider
// y the y origin of the rectangle in which to draw a slider
// width the width of the rectangle in which to draw a slider
// height the height of the rectangle in which to draw a slider
// orientation the orientation to be used
func (s *CStyle) PaintSlider(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int, orientation cenums.Orientation) {
}
// Draws a spinner on window using the given parameters.
// Parameters:
// window a Window
// stateType a state
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget (may be NULL).
// detail a style detail (may be NULL).
// step the nth step, a value between 0 and “num-steps”
// x the x origin of the rectangle in which to draw the spinner
// y the y origin of the rectangle in which to draw the spinner
// width the width of the rectangle in which to draw the spinner
// height the height of the rectangle in which to draw the spinner
func (s *CStyle) PaintSpinner(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, step int, x int, y int, width int, height int) {
}
// Draws an option menu tab (i.e. the up and down pointing arrows) in the
// given rectangle on window using the given parameters.
// Parameters:
// window a Window
// stateType a state
// shadowType the type of shadow to draw
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin of the rectangle to draw the tab in
// y y origin of the rectangle to draw the tab in
// width the width of the rectangle to draw the tab in
// height the height of the rectangle to draw the tab in
func (s *CStyle) PaintTab(window Window, stateType enums.StateType, shadowType enums.ShadowType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, width int, height int) {
}
// Draws a vertical line from (x , y1_ ) to (x , y2_ ) in window using the
// given style and state.
// Parameters:
// window a Window
// stateType a state
// area rectangle to which the output is clipped, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// y1 the starting y coordinate
// y2 the ending y coordinate
// x the x coordinate
func (s *CStyle) PaintVLine(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, y1 int, y2 int, x int) {
}
// Draws an expander as used in TreeView. x and y specify the center the
// expander. The size of the expander is determined by the "expander-size"
// style property of widget . (If widget is not specified or doesn't have an
// "expander-size" property, an unspecified default size will be used, since
// the caller doesn't have sufficient information to position the expander,
// this is likely not useful.) The expander is expander_size pixels tall in
// the collapsed position and expander_size pixels wide in the expanded
// position.
// Parameters:
// window a Window
// stateType a state
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x the x position to draw the expander at
// y the y position to draw the expander at
// expanderStyle the style to draw the expander in; determines
// whether the expander is collapsed, expanded, or in an
// intermediate state.
func (s *CStyle) PaintExpander(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, x int, y int, expanderStyle enums.ExpanderStyle) {
}
// Draws a layout on window using the given parameters.
// Parameters:
// window a Window
// stateType a state
// useText whether to use the text or foreground
// graphics context of style
//
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// x x origin
// y y origin
// layout the layout to draw
// func (s *CStyle) PaintLayout(window Window, stateType StateType, useText bool, area ptypes.Rectangle, widget Widget, detail string, x int, y int, layout PangoLayout) {
// }
// Draws a resize grip in the given rectangle on window using the given
// parameters.
// Parameters:
// window a Window
// stateType a state
// area clip rectangle, or NULL if the
// output should not be clipped.
// widget the widget.
// detail a style detail.
// edge the edge in which to draw the resize grip
// x the x origin of the rectangle in which to draw the resize grip
// y the y origin of the rectangle in which to draw the resize grip
// width the width of the rectangle in which to draw the resize grip
// height the height of the rectangle in which to draw the resize grip
func (s *CStyle) PaintResizeGrip(window Window, stateType enums.StateType, area ptypes.Rectangle, widget Widget, detail string, edge enums.WindowEdge, x int, y int, width int, height int) {
}