diff options
author | fluxgen <fluxgen> | 2003-08-27 18:05:12 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-08-27 18:05:12 (GMT) |
commit | 84c9a6a804814b46dec0c0d56e586d4edfa8ed12 (patch) | |
tree | 41c24380ebc14077a0e85391535b2fba391321b9 /src | |
parent | 1c3ddb390bf8abd95fe26e5b32eac17b02453461 (diff) | |
download | fluxbox-84c9a6a804814b46dec0c0d56e586d4edfa8ed12.zip fluxbox-84c9a6a804814b46dec0c0d56e586d4edfa8ed12.tar.bz2 |
using FbTk GContext
Diffstat (limited to 'src')
-rw-r--r-- | src/SetWorkspaceName.cc | 18 | ||||
-rw-r--r-- | src/SetWorkspaceName.hh | 5 | ||||
-rw-r--r-- | src/TextTheme.cc | 14 | ||||
-rw-r--r-- | src/TextTheme.hh | 7 |
4 files changed, 18 insertions, 26 deletions
diff --git a/src/SetWorkspaceName.cc b/src/SetWorkspaceName.cc index 1127c3b..32187bb 100644 --- a/src/SetWorkspaceName.cc +++ b/src/SetWorkspaceName.cc | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: SetWorkspaceName.cc,v 1.1 2003/08/26 23:48:19 fluxgen Exp $ | 22 | // $Id: SetWorkspaceName.cc,v 1.2 2003/08/27 18:05:12 fluxgen Exp $ |
23 | 23 | ||
24 | #include "SetWorkspaceName.hh" | 24 | #include "SetWorkspaceName.hh" |
25 | 25 | ||
@@ -43,8 +43,7 @@ SetWorkspaceName::SetWorkspaceName(BScreen &screen): | |||
43 | m_textbox(*this, m_font, screen.currentWorkspace()->name()), | 43 | m_textbox(*this, m_font, screen.currentWorkspace()->name()), |
44 | m_label(*this, m_font, "Set workspace name:"), | 44 | m_label(*this, m_font, "Set workspace name:"), |
45 | m_font("fixed"), | 45 | m_font("fixed"), |
46 | m_gc(XCreateGC(FbTk::App::instance()->display(), m_textbox.window(), | 46 | m_gc(m_textbox), |
47 | 0, 0)), | ||
48 | m_screen(screen), | 47 | m_screen(screen), |
49 | m_move_x(0), | 48 | m_move_x(0), |
50 | m_move_y(0) { | 49 | m_move_y(0) { |
@@ -58,12 +57,12 @@ SetWorkspaceName::SetWorkspaceName(BScreen &screen): | |||
58 | m_label.show(); | 57 | m_label.show(); |
59 | 58 | ||
60 | m_textbox.setBackgroundColor(FbTk::Color("white", m_textbox.screenNumber())); | 59 | m_textbox.setBackgroundColor(FbTk::Color("white", m_textbox.screenNumber())); |
61 | XGCValues gc_val; | 60 | |
62 | FbTk::Color black("black", m_textbox.screenNumber()); | 61 | FbTk::Color black("black", m_textbox.screenNumber()); |
63 | gc_val.foreground = black.pixel(); | 62 | m_gc.setForeground(black); |
64 | XChangeGC(FbTk::App::instance()->display(), m_gc, | 63 | |
65 | GCForeground, &gc_val); | 64 | m_textbox.setGC(m_gc.gc()); |
66 | m_textbox.setGC(m_gc); | 65 | |
67 | m_textbox.moveResize(0, m_label.height(), | 66 | m_textbox.moveResize(0, m_label.height(), |
68 | 200, m_font.height() + 2); | 67 | 200, m_font.height() + 2); |
69 | m_textbox.show(); | 68 | m_textbox.show(); |
@@ -80,9 +79,6 @@ SetWorkspaceName::SetWorkspaceName(BScreen &screen): | |||
80 | 79 | ||
81 | SetWorkspaceName::~SetWorkspaceName() { | 80 | SetWorkspaceName::~SetWorkspaceName() { |
82 | FbTk::EventManager::instance()->remove(*this); | 81 | FbTk::EventManager::instance()->remove(*this); |
83 | if (m_gc) | ||
84 | XFreeGC(FbTk::App::instance()->display(), m_gc); | ||
85 | |||
86 | hide(); | 82 | hide(); |
87 | } | 83 | } |
88 | 84 | ||
diff --git a/src/SetWorkspaceName.hh b/src/SetWorkspaceName.hh index 50e827f..3d8d010 100644 --- a/src/SetWorkspaceName.hh +++ b/src/SetWorkspaceName.hh | |||
@@ -19,7 +19,7 @@ | |||
19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 19 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
20 | // DEALINGS IN THE SOFTWARE. | 20 | // DEALINGS IN THE SOFTWARE. |
21 | 21 | ||
22 | // $Id: SetWorkspaceName.hh,v 1.1 2003/08/26 23:48:19 fluxgen Exp $ | 22 | // $Id: SetWorkspaceName.hh,v 1.2 2003/08/27 18:05:12 fluxgen Exp $ |
23 | 23 | ||
24 | #ifndef SETWORKSPACENAME_HH | 24 | #ifndef SETWORKSPACENAME_HH |
25 | #define SETWORKSPACENAME_HH | 25 | #define SETWORKSPACENAME_HH |
@@ -27,6 +27,7 @@ | |||
27 | #include "FbTk/TextBox.hh" | 27 | #include "FbTk/TextBox.hh" |
28 | #include "FbTk/TextButton.hh" | 28 | #include "FbTk/TextButton.hh" |
29 | #include "FbTk/Font.hh" | 29 | #include "FbTk/Font.hh" |
30 | #include "FbTk/GContext.hh" | ||
30 | 31 | ||
31 | class BScreen; | 32 | class BScreen; |
32 | 33 | ||
@@ -47,7 +48,7 @@ private: | |||
47 | FbTk::TextBox m_textbox; | 48 | FbTk::TextBox m_textbox; |
48 | FbTk::TextButton m_label; | 49 | FbTk::TextButton m_label; |
49 | FbTk::Font m_font; | 50 | FbTk::Font m_font; |
50 | GC m_gc; | 51 | FbTk::GContext m_gc; |
51 | BScreen &m_screen; | 52 | BScreen &m_screen; |
52 | int m_move_x, m_move_y; | 53 | int m_move_x, m_move_y; |
53 | }; | 54 | }; |
diff --git a/src/TextTheme.cc b/src/TextTheme.cc index 3a18b4b..bebf010 100644 --- a/src/TextTheme.cc +++ b/src/TextTheme.cc | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: TextTheme.cc,v 1.5 2003/08/16 11:33:13 fluxgen Exp $ | 23 | // $Id: TextTheme.cc,v 1.6 2003/08/27 18:05:12 fluxgen Exp $ |
24 | 24 | ||
25 | #include "TextTheme.hh" | 25 | #include "TextTheme.hh" |
26 | 26 | ||
@@ -33,9 +33,7 @@ TextTheme::TextTheme(FbTk::Theme &theme, | |||
33 | m_font(theme, name + ".font", altname + ".Font"), | 33 | m_font(theme, name + ".font", altname + ".Font"), |
34 | m_text_color(theme, name + ".textColor", altname + ".TextColor"), | 34 | m_text_color(theme, name + ".textColor", altname + ".TextColor"), |
35 | m_justify(theme, name + ".justify", altname + ".Justify"), | 35 | m_justify(theme, name + ".justify", altname + ".Justify"), |
36 | m_text_gc(XCreateGC(FbTk::App::instance()->display(), | 36 | m_text_gc(RootWindow(FbTk::App::instance()->display(), theme.screenNum())) { |
37 | RootWindow(FbTk::App::instance()->display(), | ||
38 | theme.screenNum()), 0, 0)) { | ||
39 | *m_justify = FbTk::LEFT; | 37 | *m_justify = FbTk::LEFT; |
40 | // set default values | 38 | // set default values |
41 | m_font->load("fixed"); | 39 | m_font->load("fixed"); |
@@ -45,15 +43,11 @@ TextTheme::TextTheme(FbTk::Theme &theme, | |||
45 | } | 43 | } |
46 | 44 | ||
47 | TextTheme::~TextTheme() { | 45 | TextTheme::~TextTheme() { |
48 | if (m_text_gc) | 46 | |
49 | XFreeGC(FbTk::App::instance()->display(), m_text_gc); | ||
50 | } | 47 | } |
51 | 48 | ||
52 | void TextTheme::update() { | 49 | void TextTheme::update() { |
53 | XGCValues gcv; | 50 | m_text_gc.setForeground(*m_text_color); |
54 | gcv.foreground = m_text_color->pixel(); | ||
55 | XChangeGC(FbTk::App::instance()->display(), m_text_gc, | ||
56 | GCForeground, &gcv); | ||
57 | } | 51 | } |
58 | 52 | ||
59 | void TextTheme::setAntialias(bool value) { | 53 | void TextTheme::setAntialias(bool value) { |
diff --git a/src/TextTheme.hh b/src/TextTheme.hh index 0764aca..d24b201 100644 --- a/src/TextTheme.hh +++ b/src/TextTheme.hh | |||
@@ -20,7 +20,7 @@ | |||
20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | 20 | // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
21 | // DEALINGS IN THE SOFTWARE. | 21 | // DEALINGS IN THE SOFTWARE. |
22 | 22 | ||
23 | // $Id: TextTheme.hh,v 1.2 2003/08/13 09:54:30 fluxgen Exp $ | 23 | // $Id: TextTheme.hh,v 1.3 2003/08/27 18:05:12 fluxgen Exp $ |
24 | 24 | ||
25 | #ifndef TEXTTHEME_HH | 25 | #ifndef TEXTTHEME_HH |
26 | #define TEXTTHEME_HH | 26 | #define TEXTTHEME_HH |
@@ -29,6 +29,7 @@ | |||
29 | #include "FbTk/Font.hh" | 29 | #include "FbTk/Font.hh" |
30 | #include "FbTk/Color.hh" | 30 | #include "FbTk/Color.hh" |
31 | #include "FbTk/Text.hh" | 31 | #include "FbTk/Text.hh" |
32 | #include "FbTk/GContext.hh" | ||
32 | 33 | ||
33 | class TextTheme { | 34 | class TextTheme { |
34 | public: | 35 | public: |
@@ -43,12 +44,12 @@ public: | |||
43 | const FbTk::Font &font() const { return *m_font; } | 44 | const FbTk::Font &font() const { return *m_font; } |
44 | const FbTk::Color &textColor() const { return *m_text_color; } | 45 | const FbTk::Color &textColor() const { return *m_text_color; } |
45 | FbTk::Justify justify() const { return *m_justify; } | 46 | FbTk::Justify justify() const { return *m_justify; } |
46 | GC textGC() const { return m_text_gc; } | 47 | GC textGC() const { return m_text_gc.gc(); } |
47 | private: | 48 | private: |
48 | FbTk::ThemeItem<FbTk::Font> m_font; | 49 | FbTk::ThemeItem<FbTk::Font> m_font; |
49 | FbTk::ThemeItem<FbTk::Color> m_text_color; | 50 | FbTk::ThemeItem<FbTk::Color> m_text_color; |
50 | FbTk::ThemeItem<FbTk::Justify> m_justify; | 51 | FbTk::ThemeItem<FbTk::Justify> m_justify; |
51 | GC m_text_gc; | 52 | FbTk::GContext m_text_gc; |
52 | }; | 53 | }; |
53 | 54 | ||
54 | #endif // TEXTTHEME_HH | 55 | #endif // TEXTTHEME_HH |