diff options
author | simonb <simonb> | 2005-04-10 18:18:14 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-04-10 18:18:14 (GMT) |
commit | 88c66f0687d2a9e2018f22407b2587dc4d87d012 (patch) | |
tree | 197308ad2426783058f479d12329548c6a8a4374 /src/FbTk/TextButton.cc | |
parent | 6cf66c66554a20a1c98eddf26af9e35b7c90cbd5 (diff) | |
download | fluxbox-88c66f0687d2a9e2018f22407b2587dc4d87d012.zip fluxbox-88c66f0687d2a9e2018f22407b2587dc4d87d012.tar.bz2 |
Big changes to how transparency works
Consequently rearrange lots of rendering ops, and strip calls to
updateTransparent
Diffstat (limited to 'src/FbTk/TextButton.cc')
-rw-r--r-- | src/FbTk/TextButton.cc | 55 |
1 files changed, 8 insertions, 47 deletions
diff --git a/src/FbTk/TextButton.cc b/src/FbTk/TextButton.cc index e623b9a..bdf5002 100644 --- a/src/FbTk/TextButton.cc +++ b/src/FbTk/TextButton.cc | |||
@@ -37,8 +37,7 @@ TextButton::TextButton(const FbTk::FbWindow &parent, | |||
37 | m_text(text), | 37 | m_text(text), |
38 | m_justify(FbTk::LEFT), m_bevel(1), | 38 | m_justify(FbTk::LEFT), m_bevel(1), |
39 | m_left_padding(0), | 39 | m_left_padding(0), |
40 | m_right_padding(0), | 40 | m_right_padding(0) { |
41 | m_buffer(drawable(), width(), height(), depth()) { | ||
42 | 41 | ||
43 | } | 42 | } |
44 | 43 | ||
@@ -46,10 +45,6 @@ void TextButton::resize(unsigned int width, unsigned int height) { | |||
46 | if (this->width() == width && height == this->height()) | 45 | if (this->width() == width && height == this->height()) |
47 | return; | 46 | return; |
48 | 47 | ||
49 | m_buffer.resize(width, height); | ||
50 | |||
51 | if (backgroundPixmap() != ParentRelative) | ||
52 | FbWindow::setBackgroundPixmap(m_buffer.drawable()); | ||
53 | Button::resize(width, height); | 48 | Button::resize(width, height); |
54 | } | 49 | } |
55 | 50 | ||
@@ -59,12 +54,6 @@ void TextButton::moveResize(int x, int y, | |||
59 | x == this->x() && y == this->y()) | 54 | x == this->x() && y == this->y()) |
60 | return; | 55 | return; |
61 | 56 | ||
62 | if (this->width() != width || height != this->height()) | ||
63 | m_buffer.resize(width, height); | ||
64 | |||
65 | if (backgroundPixmap() != ParentRelative) | ||
66 | FbWindow::setBackgroundPixmap(m_buffer.drawable()); | ||
67 | |||
68 | Button::moveResize(x, y, width, height); | 57 | Button::moveResize(x, y, width, height); |
69 | } | 58 | } |
70 | 59 | ||
@@ -112,37 +101,12 @@ void TextButton::clear() { | |||
112 | void TextButton::clearArea(int x, int y, | 101 | void TextButton::clearArea(int x, int y, |
113 | unsigned int width, unsigned int height, | 102 | unsigned int width, unsigned int height, |
114 | bool exposure) { | 103 | bool exposure) { |
115 | if (backgroundPixmap() != ParentRelative) { | 104 | Button::clearArea(x, y, width, height, exposure); |
116 | if (backgroundPixmap()) { | 105 | // TODO: do we need to check if the text overlaps the clearing area |
117 | m_buffer.copyArea(backgroundPixmap(), | 106 | // and if so, then clear a rectangle that encompases all the text plus the |
118 | gc(), | 107 | // requested area? |
119 | x, y, | 108 | drawText(); |
120 | x, y, | 109 | |
121 | width, height); | ||
122 | |||
123 | } else { // fill with background color | ||
124 | FbTk::GContext gc(m_buffer); | ||
125 | gc.setForeground(backgroundColor()); | ||
126 | m_buffer.fillRectangle(gc.gc(), | ||
127 | x, y, | ||
128 | width, height); | ||
129 | |||
130 | } | ||
131 | drawText(); | ||
132 | |||
133 | setBufferPixmap(m_buffer.drawable()); | ||
134 | FbWindow::setBackgroundPixmap(m_buffer.drawable()); | ||
135 | updateTransparent(x, y, width, height); | ||
136 | |||
137 | FbWindow::clearArea(x, y, width, height, exposure); | ||
138 | |||
139 | } else { // parent relative | ||
140 | FbWindow::setBufferPixmap(0); | ||
141 | FbWindow::setBackgroundPixmap(backgroundPixmap()); | ||
142 | Button::clearArea(x, y, width, height, exposure); | ||
143 | updateTransparent(x, y, width, height); | ||
144 | drawText(); | ||
145 | } | ||
146 | } | 110 | } |
147 | 111 | ||
148 | unsigned int TextButton::textWidth() const { | 112 | unsigned int TextButton::textWidth() const { |
@@ -161,11 +125,8 @@ void TextButton::drawText(int x_offset, int y_offset) { | |||
161 | 125 | ||
162 | // center text by default | 126 | // center text by default |
163 | int center_pos = height()/2 + font().ascent()/2 - 1; | 127 | int center_pos = height()/2 + font().ascent()/2 - 1; |
164 | FbDrawable *drawable = &m_buffer; | ||
165 | if (backgroundPixmap() == ParentRelative) | ||
166 | drawable = this; | ||
167 | 128 | ||
168 | font().drawText(*drawable, | 129 | font().drawText(*this, |
169 | screenNumber(), | 130 | screenNumber(), |
170 | gc(), // graphic context | 131 | gc(), // graphic context |
171 | text().c_str(), textlen, // string and string size | 132 | text().c_str(), textlen, // string and string size |