2 * ion/mod_tiling/panehandle.c
4 * Copyright (c) Tuomo Valkonen 1999-2009.
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
, "WPanelHandle"))
52 panehandle_getbrush(pwin
);
54 if(pwin
->brush
==NULL
){
55 GrBorderWidths bdw
=GR_BORDER_WIDTHS_INIT
;
56 memcpy(&(pwin
->bdw
), &bdw
, sizeof(bdw
));
59 window_select_input(&(pwin
->wwin
), IONCORE_EVENTMASK_NORMAL
);
65 WPaneHandle
*create_panehandle(WWindow
*parent
, const WFitParams
*fp
)
67 CREATEOBJ_IMPL(WPaneHandle
, panehandle
, (p
, parent
, fp
));
71 void panehandle_deinit(WPaneHandle
*pwin
)
73 assert(pwin
->splitfloat
==NULL
);
75 if(pwin
->brush
!=NULL
){
76 grbrush_release(pwin
->brush
);
80 window_deinit(&(pwin
->wwin
));
90 static void panehandle_updategr(WPaneHandle
*pwin
)
92 panehandle_getbrush(pwin
);
93 region_updategr_default((WRegion
*)pwin
);
97 static void panehandle_draw(WPaneHandle
*pwin
, bool complete
)
101 if(pwin
->brush
==NULL
)
106 g
.w
=REGION_GEOM(pwin
).w
;
107 g
.h
=REGION_GEOM(pwin
).h
;
109 grbrush_begin(pwin
->brush
, &g
, (complete
? 0 : GRBRUSH_NO_CLEAR_OK
));
111 grbrush_draw_borderline(pwin
->brush
, &g
, pwin
->bline
);
113 grbrush_end(pwin
->brush
);
123 static DynFunTab panehandle_dynfuntab
[]={
124 {region_updategr
, panehandle_updategr
},
125 {window_draw
, panehandle_draw
},
130 IMPLCLASS(WPaneHandle
, WWindow
, panehandle_deinit
, panehandle_dynfuntab
);