]> Dogcows Code - chaz/openbox/blob - otk/focuswidget.cc
better historyplacement
[chaz/openbox] / otk / focuswidget.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 "focuswidget.hh"
8
9 namespace otk {
10
11 FocusWidget::FocusWidget(Widget *parent, Direction direction)
12 : Widget(parent, direction), _unfocus_texture(0), _unfocus_bcolor(0)
13 {
14 _focused = true;
15 _focus_texture = parent->texture();
16 _focus_bcolor = parent->borderColor();
17 }
18
19 FocusWidget::~FocusWidget()
20 {
21 }
22
23
24 void FocusWidget::focus(void)
25 {
26 if (_focused)
27 return;
28
29 Widget::focus();
30
31 if (_focus_bcolor)
32 Widget::setBorderColor(_focus_bcolor);
33
34 Widget::setTexture(_focus_texture);
35 update();
36 }
37
38 void FocusWidget::unfocus(void)
39 {
40 if (!_focused)
41 return;
42
43 Widget::unfocus();
44
45 if (_unfocus_bcolor)
46 Widget::setBorderColor(_unfocus_bcolor);
47
48 Widget::setTexture(_unfocus_texture);
49 update();
50 }
51
52 void FocusWidget::setTexture(RenderTexture *texture)
53 {
54 Widget::setTexture(texture);
55 _focus_texture = texture;
56 }
57
58 void FocusWidget::setBorderColor(const RenderColor *color)
59 {
60 Widget::setBorderColor(color);
61 _focus_bcolor = color;
62 }
63
64 }
This page took 0.036601 seconds and 4 git commands to generate.