aboutsummaryrefslogtreecommitdiff
path: root/src/OSDWindow.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-01-19 12:00:46 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-01-19 12:00:46 (GMT)
commitdb4ec8cf20b4e72cd32d0632a5ab6a8584d2515a (patch)
treef89bd2773b284aed8c1bbb7f9e5d1fe64d694070 /src/OSDWindow.cc
parent7b055cc54a2db2398a7da012b57f0dcbc9f85a35 (diff)
downloadfluxbox-db4ec8cf20b4e72cd32d0632a5ab6a8584d2515a.zip
fluxbox-db4ec8cf20b4e72cd32d0632a5ab6a8584d2515a.tar.bz2
move position and geometry windows into their own class
Diffstat (limited to 'src/OSDWindow.cc')
-rw-r--r--src/OSDWindow.cc94
1 files changed, 94 insertions, 0 deletions
diff --git a/src/OSDWindow.cc b/src/OSDWindow.cc
new file mode 100644
index 0000000..005e07b
--- /dev/null
+++ b/src/OSDWindow.cc
@@ -0,0 +1,94 @@
1// OSDWindow.cc
2// Copyright (c) 2008 Fluxbox Team (fluxgen at fluxbox dot org)
3//
4// Permission is hereby granted, free of charge, to any person obtaining a
5// copy of this software and associated documentation files (the "Software"),
6// to deal in the Software without restriction, including without limitation
7// the rights to use, copy, modify, merge, publish, distribute, sublicense,
8// and/or sell copies of the Software, and to permit persons to whom the
9// Software is furnished to do so, subject to the following conditions:
10//
11// The above copyright notice and this permission notice shall be included in
12// all copies or substantial portions of the Software.
13//
14// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20// DEALINGS IN THE SOFTWARE.
21
22#include "OSDWindow.hh"
23
24#include "Screen.hh"
25#include "FbWinFrameTheme.hh"
26
27#include "FbTk/ImageControl.hh"
28
29void OSDWindow::reconfigTheme() {
30
31 setBorderWidth(m_theme->border().width());
32 setBorderColor(m_theme->border().color());
33
34 if (m_pixmap)
35 m_screen.imageControl().removeImage(m_pixmap);
36
37 if (m_theme->iconbarTheme().texture().type() &
38 FbTk::Texture::PARENTRELATIVE) {
39 if (!m_theme->titleTexture().usePixmap()) {
40 m_pixmap = None;
41 setBackgroundColor(m_theme->titleTexture().color());
42 } else {
43 m_pixmap = m_screen.imageControl().renderImage(width(), height(),
44 m_theme->titleTexture());
45 setBackgroundPixmap(m_pixmap);
46 }
47 } else {
48 if (!m_theme->iconbarTheme().texture().usePixmap()) {
49 m_pixmap = None;
50 setBackgroundColor(m_theme->iconbarTheme().texture().color());
51 } else {
52 m_pixmap = m_screen.imageControl().renderImage(width(), height(),
53 m_theme->iconbarTheme().texture());
54 setBackgroundPixmap(m_pixmap);
55 }
56 }
57
58}
59
60void OSDWindow::resize(const std::string &text) {
61
62 int h = m_theme->font().height() + m_theme->bevelWidth()*2;
63 int w = m_theme->font().textWidth(text, text.size()) +
64 m_theme->bevelWidth()*2;
65 FbTk::FbWindow::resize(w, h);
66}
67
68void OSDWindow::showText(const std::string &text) {
69 show();
70 clear();
71 m_theme->font().drawText(*this, m_screen.screenNumber(),
72 m_theme->iconbarTheme().text().textGC(), text, text.size(),
73 m_theme->bevelWidth(),
74 m_theme->bevelWidth() + m_theme->font().ascent());
75}
76
77void OSDWindow::show() {
78 if (m_visible)
79 return;
80
81 m_visible = true;
82 unsigned int head = m_screen.getCurrHead();
83 move(m_screen.getHeadX(head) + (m_screen.getHeadWidth(head) - width()) / 2,
84 m_screen.getHeadY(head) + (m_screen.getHeadHeight(head) - height()) / 2);
85 raise();
86 FbTk::FbWindow::show();
87}
88
89void OSDWindow::hide() {
90 if (!m_visible)
91 return;
92 m_visible = false;
93 FbTk::FbWindow::hide();
94}