]> icculus.org git repositories - dana/openbox.git/blob - src/backgroundwidget.cc
GRAMMAR HAMMER
[dana/openbox.git] / src / backgroundwidget.cc
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 2; -*-
2
3 #ifdef HAVE_CONFIG_H
4 # include "../config.h"
5 #endif
6
7 #include "backgroundwidget.hh"
8
9 namespace ob {
10
11 BackgroundWidget::BackgroundWidget(otk::Widget *parent,
12                                    WidgetBase::WidgetType type)
13   : otk::Widget(parent),
14     WidgetBase(type)
15 {
16 }
17
18
19 BackgroundWidget::~BackgroundWidget()
20 {
21 }
22
23
24 void BackgroundWidget::setTextures()
25 {
26   switch (type()) {
27   case Type_Titlebar:
28     if (_focused)
29       setTexture(_style->titlebarFocusBackground());
30     else
31       setTexture(_style->titlebarUnfocusBackground());
32     break;
33   case Type_Handle:
34     if (_focused)
35       setTexture(_style->handleFocusBackground());
36     else
37       setTexture(_style->handleUnfocusBackground());
38     break;
39   case Type_Plate:
40     if (_focused)
41       setBorderColor(_style->clientBorderFocusColor());
42     else
43       setBorderColor(_style->clientBorderUnfocusColor());
44     break;
45   default:
46     assert(false); // there's no other background widgets!
47   }
48 }
49
50
51 void BackgroundWidget::setStyle(otk::RenderStyle *style)
52 {
53   Widget::setStyle(style);
54   setTextures();
55   switch (type()) {
56   case Type_Titlebar:
57   case Type_Handle:
58     setBorderColor(_style->frameBorderColor());
59     break;
60   case Type_Plate:
61     break;
62   default:
63     assert(false); // there's no other background widgets!
64   }
65 }
66
67
68 void BackgroundWidget::focus()
69 {
70   otk::Widget::focus();
71   setTextures();
72 }
73
74
75 void BackgroundWidget::unfocus()
76 {
77   otk::Widget::unfocus();
78   setTextures();
79 }
80
81
82 void BackgroundWidget::adjust()
83 {
84   // nothing to adjust here. its done in Frame::adjustSize
85 }
86
87 }