forked from Geballin/gtkTtk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgttk_SizeGrip.cpp
103 lines (91 loc) · 2.91 KB
/
gttk_SizeGrip.cpp
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
/*
* gttk_SizeGrip.cpp
* ---------------------
*
* This file is part of the gttk package, a Tk/Tile based theme that uses
* Gtk/GNOME for drawing.
*
* Copyright (C) 2004-2008 by:
* Georgios Petasis, petasis@iit.demokritos.gr,
* Software and Knowledge Engineering Laboratory,
* Institute of Informatics and Telecommunications,
* National Centre for Scientific Research (NCSR) "Demokritos",
* Aghia Paraskevi, 153 10, Athens, Greece.
*/
#include "gttk_Utilities.h"
#include "gttk_TkHeaders.h"
#include "gttk_WidgetDefaults.h"
#if 0
/*
* Map between Tk/Tile & Gtk/GNOME state flags.
*/
static Ttk_StateTable size_grip_statemap[] =
{
};
#endif
typedef struct {
} SizeGripElement;
static Ttk_ElementOptionSpec SizeGripElementOptions[] = {
{NULL}
};
static void SizeGripElementGeometry(
void *clientData, void *elementRecord, Tk_Window tkwin,
int *widthPtr, int *heightPtr, Ttk_Padding *paddingPtr)
{
GTTK_WIDGET_CACHE_DEFINITION;
GTTK_ENSURE_GTK_STYLE_ENGINE_ACTIVE;
GtkWidget *widget = gttk_GetStatusBar(wc);
*widthPtr = 18;
*heightPtr = 18;
GTTK_ENSURE_WIDGET_OK;
*paddingPtr = Ttk_MakePadding(0, 0, widget->style->xthickness,
widget->style->ythickness);
}
static void SizeGripElementDraw(
void *clientData, void *elementRecord, Tk_Window tkwin,
Drawable d, Ttk_Box b, unsigned state)
{
GTTK_GTK_DRAWABLE_DEFINITIONS;
GTTK_ENSURE_GTK_STYLE_ENGINE_ACTIVE;
/* GTTK_SETUP_GTK_DRAWABLE; */
GtkWidget *widget = wc->gtkWindow;
GTTK_ENSURE_WIDGET_OK;
GTTK_STYLE_FROM_WIDGET;
GTTK_DRAWABLE_FROM_WIDGET;
// gttk_StateShadowTableLookup(NULL, state, gtkState, gtkShadow,
// GTTK_SECTION_ALL);
GTTK_DEFAULT_BACKGROUND;
// gttk_StateInfo(state, gtkState, gtkShadow, tkwin, widget);
gttk_gtk_paint_resize_grip(style, gdkDrawable, GTK_STATE_NORMAL, NULL, widget,
"window", GDK_WINDOW_EDGE_SOUTH_EAST, 0, 0, b.width, b.height);
gttk_CopyGtkPixmapOnToDrawable(gdkDrawable, d, tkwin,
0, 0, b.width, b.height, b.x, b.y);
GTTK_CLEANUP_GTK_DRAWABLE;
}; /* SizeGripElementDraw */
static Ttk_ElementSpec SizeGripElementSpec = {
TK_STYLE_VERSION_2,
sizeof(SizeGripElement),
SizeGripElementOptions,
SizeGripElementGeometry,
SizeGripElementDraw
};
/*------------------------------------------------------------------------
* +++ Widget layout.
*/
TTK_BEGIN_LAYOUT(SizegripLayout)
TTK_NODE("Sizegrip.sizegrip", TTK_PACK_BOTTOM|TTK_STICK_S|TTK_STICK_E)
TTK_END_LAYOUT
int gttk_Init_SizeGrip(Tcl_Interp *interp,
gttk_WidgetCache **wc, Ttk_Theme themePtr)
{
/*
* Register elements:
*/
Ttk_RegisterElement(interp, themePtr, "sizegrip",
&SizeGripElementSpec, (void *) wc[0]);
/*
* Register layouts:
*/
Ttk_RegisterLayout(themePtr, "TSizegrip", SizegripLayout);
return TCL_OK;
}; /* gttk_Init_SizeGrip */