*
* Copyright (c) Tuomo Valkonen 1999-2007.
*
- * Ion is free software; you can redistribute it and/or modify it under
- * the terms of the GNU Lesser General Public License as published by
- * the Free Software Foundation; either version 2.1 of the License, or
- * (at your option) any later version.
+ * See the included file LICENSE for details.
*/
#include <string.h>
if(m>0){
grbrush_get_border_widths(frame->bar_brush, &bdw);
- bdtotal=((m-1)*(bdw.tb_ileft+bdw.tb_iright)
+ bdtotal=((m-1)*(bdw.tb_ileft+bdw.tb_iright+bdw.spacing)
+bdw.right+bdw.left);
FRAME_MX_FOR_ALL(sub, frame, itmp){
FRAME_MX_FOR_ALL(sub, frame, tmp){
textw=init_title(frame, i);
if(textw>0){
- if(frame->flags&FRAME_SHOW_NUMBERS){
- char *s=NULL;
- libtu_asprintf(&s, "[%d]", i+1);
- if(s!=NULL){
- title=grbrush_make_label(frame->bar_brush, s, textw);
- free(s);
- }else{
- title=NULL;
- }
- }else{
- title=region_make_label(sub, textw, frame->bar_brush);
- }
+ title=region_make_label(sub, textw, frame->bar_brush);
frame->titles[i].text=title;
}
i++;
}
-static void set_common_attrs(const WFrame *frame, GrBrush *brush)
-{
- ensure_create_attrs();
-
- grbrush_set_attr(brush, REGION_IS_ACTIVE(frame)
- ? GR_ATTR(active)
- : GR_ATTR(inactive));
- grbrush_set_attr(brush, frame->quasiactive_count>0
- ? GR_ATTR(quasiactive)
- : GR_ATTR(not_quasiactive));
-}
-
-
void frame_draw_bar(const WFrame *frame, bool complete)
{
WRectangle geom;
grbrush_begin(frame->bar_brush, &geom, GRBRUSH_AMEND);
- set_common_attrs(frame, frame->bar_brush);
+ grbrush_init_attr(frame->bar_brush, &frame->baseattr);
grbrush_draw_textboxes(frame->bar_brush, &geom, frame->titles_n,
frame->titles, complete);
grbrush_begin(frame->brush, &geom, (complete ? 0 : GRBRUSH_NO_CLEAR_OK));
- set_common_attrs(frame, frame->brush);
+ grbrush_init_attr(frame->brush, &frame->baseattr);
grbrush_draw_border(frame->brush, &geom);
void frame_setup_dragwin_style(WFrame *frame, GrStyleSpec *spec, int tab)
{
+ gr_stylespec_append(spec, &frame->baseattr);
gr_stylespec_append(spec, &frame->titles[tab].attr);
+}
+
+
+/*}}}*/
+
+
+/*{{{ Activated/inactivated */
+
+
+void frame_inactivated(WFrame *frame)
+{
+ ensure_create_attrs();
+
+ gr_stylespec_set(&frame->baseattr, GR_ATTR(inactive));
+ gr_stylespec_unset(&frame->baseattr, GR_ATTR(active));
+
+ window_draw((WWindow*)frame, FALSE);
+}
+
+
+void frame_activated(WFrame *frame)
+{
+ ensure_create_attrs();
+
+ gr_stylespec_set(&frame->baseattr, GR_ATTR(active));
+ gr_stylespec_unset(&frame->baseattr, GR_ATTR(inactive));
+
+ window_draw((WWindow*)frame, FALSE);
+}
+
+
+void frame_quasiactivity_change(WFrame *frame)
+{
+ bool is=(frame->quasiact_source!=NULL);
- gr_stylespec_set(spec, REGION_IS_ACTIVE(frame)
- ? GR_ATTR(active)
- : GR_ATTR(inactive));
- gr_stylespec_set(spec, frame->quasiactive_count>0
- ? GR_ATTR(quasiactive)
- : GR_ATTR(not_quasiactive));
+ ensure_create_attrs();
+
+ if(is){
+ gr_stylespec_set(&frame->baseattr, GR_ATTR(quasiactive));
+ gr_stylespec_unset(&frame->baseattr, GR_ATTR(not_quasiactive));
+ }else{
+ gr_stylespec_set(&frame->baseattr, GR_ATTR(not_quasiactive));
+ gr_stylespec_unset(&frame->baseattr, GR_ATTR(quasiactive));
+ }
}