13 #include "../../gfx.h"
15 #if GFX_USE_GWIN && GWIN_NEED_TABSET
17 #include "gwin_class.h"
22 #define GTABSET_BORDER 2
23 #define GTABSET_TXT_PAD 5
26 #define GTABSET_TAB_CNR 8
27 #define GTABSET_TOP_FADE 50
28 #define GTABSET_BOTTOM_FADE 25
29 #define GTABSET_OUTLINE_FADE 128
32 #define GWIN_TABSET_USER_FLAGS (GWIN_TABSET_BORDER)
33 #if GWIN_TABSET_BORDER < GWIN_FIRST_CONTROL_FLAG
34 #error "GWIN Tabset: - Flag definitions don't match"
36 #if GWIN_TABSET_BORDER > GWIN_LAST_CONTROL_FLAG
37 #error "GWIN Tabset: - Flag definitions don't match"
44 static void FixTabSizePos(
GHandle gh);
48 static gCoord TabpageBorderSize(
GHandle gh) { (void)gh;
return 0; }
50 static void gwinTabpageDraw_Std(
GWidgetObject *gw,
void *param) {
57 static void TabpageDestroy(
GHandle gh) {
58 _gcontainerDestroy(gh);
60 FixTabSizePos(gh->parent);
67 sizeof(GTabpageObject),
80 #if GINPUT_NEED_KEYBOARD || GWIN_NEED_KEYBOARD
85 #if GINPUT_NEED_TOGGLE
116 FixTabSizePos(gh->parent);
143 static void FixTabSizePos(
GHandle gh) {
147 oldth = ((GTabsetObject *)gh)->border_top;
148 ((GTabsetObject *)gh)->border_top = CalcTabHeight(gh);
149 oldth -= ((GTabsetObject *)gh)->border_top;
158 if (!vis || (ph->
flags & GWIN_FLG_VISIBLE))
166 if (vis && !(vis->
flags & GWIN_FLG_VISIBLE)) {
167 vis->
flags |= GWIN_FLG_VISIBLE;
168 _gwinRippleVisibility();
173 static gCoord TabSetBorderTop(
GHandle gh) {
return ((GTabsetObject *)gh)->border_top; }
175 #if GINPUT_NEED_MOUSE
180 if (my < 0 || my > ((GTabsetObject *)gw)->border_top)
195 if (x > gw->g.width) {
199 if (my < y && mx < x) {
206 if (!gh || (gh->
flags & GWIN_FLG_VISIBLE))
212 if (ph->
vmt == (
gwinVMT *)&tabpageVMT && (ph->
flags & GWIN_FLG_VISIBLE)) {
214 ph->
flags &= ~GWIN_FLG_VISIBLE;
220 gh->
flags |= GWIN_FLG_VISIBLE;
221 _gwinRippleVisibility();
228 GSourceListener * psl;
252 sizeof(GTabsetObject),
258 #if GINPUT_NEED_MOUSE
265 #if GINPUT_NEED_TOGGLE
292 if (!(fo = (GTabsetObject *)_gcontainerCreate(g, (
GContainerObject *)fo, pInit, &tabsetVMT)))
296 fo->c.
g.
flags |= flags & GWIN_TABSET_USER_FLAGS;
323 if (!(gh = _gcontainerCreate(gh->
display, 0, &wi, &tabpageVMT)))
328 FixTabSizePos(gh->parent);
353 if (gh->
vmt == (
gwinVMT *)&tabpageVMT && !index--)
373 if (gh->
vmt != (
gwinVMT *)&tabpageVMT || (gh->
flags & GWIN_FLG_VISIBLE))
378 if (ph->
vmt == (
gwinVMT *)&tabpageVMT && (ph->
flags & GWIN_FLG_VISIBLE)) {
380 ph->
flags &= ~GWIN_FLG_VISIBLE;
386 gh->
flags |= GWIN_FLG_VISIBLE;
387 _gwinRippleVisibility();
397 #if GWIN_FLAT_STYLING
398 static void fgarea(GWidgetObjset *gw,
const char *text,
gCoord y,
gCoord x,
gCoord w) {
401 pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
406 static void bgarea(GWidgetObjset *gw,
const char *text,
gCoord y,
gCoord x,
gCoord w) {
409 pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->enabled : &gw->pstyle->disabled;
418 pcol = (gw->g.flags & GWIN_FLG_SYSENABLED) ? &gw->pstyle->pressed : &gw->pstyle->disabled;
474 ntarea(gw, y, x, gw->
g.
width - x);
478 if (ph->
flags & GWIN_FLG_VISIBLE)
486 ntarea(gw, y, x, gw->
g.
width - x);
510 drawborder(gw, drawtabs(gw));
535 #define gi ((gImage *)param)
536 gCoord x, y, iw, ih, mx, my;
552 for(y = gw->
g.
y+y, ih = gi->height; y < my; y += ih) {
558 for(iw = gi->width; x < mx; x += iw) {
COLOR_TYPE gColor
The color type definition.
#define GWIN_CONTAINER_BORDER
Flags for gwinContainerCreate()
gCoord gwinGetInnerHeight(GHandle gh)
Get the inner height of a container window.
GHandle gwinGetFirstChild(GHandle gh)
Get the first child window.
GHandle gwinGetSibling(GHandle gh)
Get the next child window in the z-order.
gCoord gwinGetInnerWidth(GHandle gh)
Get the inner width of a container window.
gColor gdispBlendColor(gColor fg, gColor bg, gU8 alpha)
Blend 2 colors according to the alpha.
void gdispGDrawStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gJustify justify)
Draw a text string vertically centered within the specified box.
void gdispGFillArea(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Fill an area with a color.
void gdispGDrawLine(GDisplay *g, gCoord x0, gCoord y0, gCoord x1, gCoord y1, gColor color)
Draw a line.
void gdispGFillStringBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, const char *str, gFont font, gColor color, gColor bgColor, gJustify justify)
Draw a text string vertically centered within the specified box. The box background is filled with th...
gI16 gCoord
The type for a coordinate or length on the screen.
gCoord gdispGetStringWidth(const char *str, gFont font)
Get the pixel width of an entire string.
void gdispGDrawBox(GDisplay *g, gCoord x, gCoord y, gCoord cx, gCoord cy, gColor color)
Draw a rectangular box.
GEvent * geventGetEventBuffer(GSourceListener *psl)
Get the event buffer from the GSourceListener.
void geventSendEvent(GSourceListener *psl)
Called by a source to indicate the listener's event buffer has been filled.
GSourceListener * geventGetSourceListener(GSourceHandle gsh, GSourceListener *lastlr)
Called by a source with a possible event to get a listener record.
gI32 fixed
The type for a fixed point type.
#define FIXED(x)
Macros to convert to and from a fixed point.
#define GWIN_TABSET_TABHEIGHT
The height in pixels of a row of tabs in a tabset.
gdispImageError gdispGImageDraw(GDisplay *g, gImage *img, gCoord x, gCoord y, gCoord cx, gCoord cy, gCoord sx, gCoord sy)
Draw the image.
void gwinTabsetDraw_Transparent(GWidgetObject *gw, void *param)
Renders the tabset but leaves the client area transparent.
void gwinTabsetDraw_Std(GWidgetObject *gw, void *param)
The default rendering function for the tabset widget.
void gwinTabsetDraw_Image(GWidgetObject *gw, void *param)
Renders the tabset and uses the specified image for the client area.
GHandle gwinGTabsetCreate(GDisplay *g, GTabsetObject *fo, GWidgetInit *pInit, gU32 flags)
Create a tabset widget.
GHandle gwinTabsetAddTab(GHandle gh, const char *title, gBool useAlloc)
Add a tab-page to the tabset.
void gwinTabsetSetTab(GHandle gh)
Set the active tab in a tabset.
int gwinTabsetCountTabs(GHandle gh)
Count the number of tabs in the tabset.
GHandle gwinTabsetGetTabByTitle(GHandle gh, const char *title)
Get the GHandle of a tab based on its title.
#define GWIN_TABSET_BORDER
Flags for gwinTabsetCreate()
void gwinTabsetSetTitle(GHandle gh, const char *title, gBool useAlloc)
Set the title of a tab-page.
#define GEVENT_GWIN_TABSET
The Event Type for a Tabset Event.
GHandle gwinTabsetGetTabByIndex(GHandle gh, int index)
Get the GHandle of a tab based on its position.
void gwinRedraw(GHandle gh)
Redraw a window.
void gwinSetVisible(GHandle gh, gBool visible)
Sets whether a window is visible or not.
void gwinResize(GHandle gh, gCoord width, gCoord height)
Resize a window.
void gwinMove(GHandle gh, gCoord x, gCoord y)
Move a window.
A window object structure.
const struct gwinVMT * vmt
The Virtual Method Table for a container.
The Virtual Method Table for a GWIN window.