2 * ion/mod_tiling/panehandle.c
4 * Copyright (c) Tuomo Valkonen 1999-2007.
6 * See the included file LICENSE for details.
11 #include <libtu/objp.h>
12 #include <libtu/minmax.h>
13 #include <ioncore/common.h>
14 #include <ioncore/global.h>
15 #include <ioncore/event.h>
16 #include <ioncore/gr.h>
17 #include <ioncore/regbind.h>
18 #include "panehandle.h"
25 static void panehandle_getbrush(WPaneHandle *pwin)
27 GrBrush *brush=gr_get_brush(pwin->wwin.win,
28 region_rootwin_of((WRegion*)pwin),
33 grbrush_release(pwin->brush);
37 grbrush_get_border_widths(brush, &(pwin->bdw));
38 grbrush_enable_transparency(brush, GR_TRANSPARENCY_YES);
43 bool panehandle_init(WPaneHandle *pwin, WWindow *parent, const WFitParams *fp)
46 pwin->bline=GR_BORDERLINE_NONE;
47 pwin->splitfloat=NULL;
49 if(!window_init(&(pwin->wwin), parent, fp))
52 ((WRegion*)pwin)->flags|=REGION_SKIP_FOCUS;
54 panehandle_getbrush(pwin);
56 if(pwin->brush==NULL){
57 GrBorderWidths bdw=GR_BORDER_WIDTHS_INIT;
58 memcpy(&(pwin->bdw), &bdw, sizeof(bdw));
61 window_select_input(&(pwin->wwin), IONCORE_EVENTMASK_NORMAL);
67 WPaneHandle *create_panehandle(WWindow *parent, const WFitParams *fp)
69 CREATEOBJ_IMPL(WPaneHandle, panehandle, (p, parent, fp));
73 void panehandle_deinit(WPaneHandle *pwin)
75 assert(pwin->splitfloat==NULL);
77 if(pwin->brush!=NULL){
78 grbrush_release(pwin->brush);
82 window_deinit(&(pwin->wwin));
92 static void panehandle_updategr(WPaneHandle *pwin)
94 panehandle_getbrush(pwin);
95 region_updategr_default((WRegion*)pwin);
99 static void panehandle_draw(WPaneHandle *pwin, bool complete)
103 if(pwin->brush==NULL)
108 g.w=REGION_GEOM(pwin).w;
109 g.h=REGION_GEOM(pwin).h;
111 grbrush_begin(pwin->brush, &g, (complete ? 0 : GRBRUSH_NO_CLEAR_OK));
113 grbrush_draw_borderline(pwin->brush, &g, pwin->bline);
115 grbrush_end(pwin->brush);
125 static DynFunTab panehandle_dynfuntab[]={
126 {region_updategr, panehandle_updategr},
127 {window_draw, panehandle_draw},
132 IMPLCLASS(WPaneHandle, WWindow, panehandle_deinit, panehandle_dynfuntab);