news download themes documentation links










FbWinFrameTheme.cc

00001 // FbWinFrameTheme.cc for Fluxbox Window Manager
00002 // Copyright (c) 2003-2004 Henrik Kinnunen (fluxgen at users.sourceforge.net)
00003 //
00004 // Permission is hereby granted, free of charge, to any person obtaining a
00005 // copy of this software and associated documentation files (the "Software"),
00006 // to deal in the Software without restriction, including without limitation
00007 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
00008 // and/or sell copies of the Software, and to permit persons to whom the
00009 // Software is furnished to do so, subject to the following conditions:
00010 //
00011 // The above copyright notice and this permission notice shall be included in
00012 // all copies or substantial portions of the Software.
00013 //
00014 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
00017 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
00019 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
00020 // DEALINGS IN THE SOFTWARE.
00021 
00022 // $Id: FbWinFrameTheme.cc,v 1.17 2004/01/11 16:13:09 fluxgen Exp $
00023 
00024 #include "FbWinFrameTheme.hh"
00025 #include "App.hh"
00026 
00027 #include <X11/cursorfont.h>
00028 
00029 #include <iostream>
00030 using namespace std;
00031 
00032 FbWinFrameTheme::FbWinFrameTheme(int screen_num): 
00033     FbTk::Theme(screen_num),
00034     m_label_focus(*this, "window.label.focus", "Window.Label.Focus"),
00035     m_label_unfocus(*this, "window.label.unfocus", "Window.Label.Unfocus"),
00036     m_label_active(*this, "window.label.active", "Window.Label.Active"),
00037 
00038     m_title_focus(*this, "window.title.focus", "Window.Title.Focus"),
00039     m_title_unfocus(*this, "window.title.unfocus", "Window.Title.Unfocus"),
00040 
00041     m_handle_focus(*this, "window.handle.focus", "Window.Handle.Focus"),
00042     m_handle_unfocus(*this, "window.handle.unfocus", "Window.Handle.Unfocus"),
00043 
00044     m_button_focus(*this, "window.button.focus", "Window.Button.Focus"),
00045     m_button_unfocus(*this, "window.button.unfocus", "Window.Button.Unfocus"),
00046     m_button_pressed(*this, "window.button.pressed", "Window.Button.Pressed"),
00047     
00048     m_grip_focus(*this, "window.grip.focus", "Window.Grip.Focus"),
00049     m_grip_unfocus(*this, "window.grip.unfocus", "Window.Grip.Unfocus"),
00050   
00051     m_label_focus_color(*this, "window.label.focus.textColor", "Window.Label.Focus.TextColor"),
00052     m_label_unfocus_color(*this, "window.label.unfocus.textColor", "Window.Label.Unfocus.TextColor"),
00053     m_label_active_color(*this, "window.label.active.textColor", "Window.Label.Active.TextColor"),
00054     
00055     m_button_focus_color(*this, "window.button.focus.picColor", "Window.Button.Focus.PicColor"),
00056     m_button_unfocus_color(*this, "window.button.unfocus.picColor", "Window.Button.Unfocus.PicColor"),
00057 
00058     m_font(*this, "window.font", "Window.Font"),
00059     m_textjustify(*this, "window.justify", "Window.Justify"),
00060     m_shape_place(*this, "window.roundCorners", "Window.RoundCorners"),
00061     m_alpha(*this, "window.alpha", "Window.Alpha"),
00062     m_title_height(*this, "window.title.height", "Window.Title.Height"),
00063     m_bevel_width(*this, "window.bevelWidth", "Window.BevelWidth"),
00064     m_handle_width(*this, "window.handleWidth", "Window.handleWidth"),
00065     m_border(*this, "window", "Window"), // for window.border*
00066     m_label_text_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
00067     m_label_text_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
00068     m_label_text_active_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
00069     m_button_pic_focus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)),
00070     m_button_pic_unfocus_gc(RootWindow(FbTk::App::instance()->display(), screen_num)) {
00071 
00072     *m_title_height = 0;
00073     // set defaults
00074     m_font->load("fixed");
00075     *m_alpha = 255;
00076 
00077     // create cursors
00078     Display *disp = FbTk::App::instance()->display();
00079     m_cursor_move = XCreateFontCursor(disp, XC_fleur);
00080     m_cursor_lower_left_angle = XCreateFontCursor(disp, XC_ll_angle);
00081     m_cursor_lower_right_angle = XCreateFontCursor(disp, XC_lr_angle);
00082     m_cursor_upper_right_angle = XCreateFontCursor(disp, XC_ur_angle);
00083     m_cursor_upper_left_angle = XCreateFontCursor(disp, XC_ul_angle);
00084 
00085     reconfigTheme();
00086 }
00087 
00088 FbWinFrameTheme::~FbWinFrameTheme() {
00089 
00090 }
00091 
00092 bool FbWinFrameTheme::fallback(FbTk::ThemeItem_base &item) {
00093     if (item.name() == "window.borderWidth")
00094         return FbTk::ThemeManager::instance().loadItem(item, "borderWidth", "BorderWidth");
00095     else if (item.name() == "window.borderColor")
00096         return FbTk::ThemeManager::instance().loadItem(item, "borderColor", "BorderColor");
00097     else if (item.name() == "window.bevelWidth")
00098         return FbTk::ThemeManager::instance().loadItem(item, "bevelWidth", "bevelWidth");
00099     else if (item.name() == "window.handleWidth")
00100         return FbTk::ThemeManager::instance().loadItem(item, "handleWidth", "HandleWidth");
00101     else if (item.name() == "window.label.active") {
00102         // copy texture
00103         *m_label_active = *m_label_unfocus;
00104         return true;
00105     } else if (item.name() == "window.label.active.textColor") {
00106         return FbTk::ThemeManager::instance().loadItem(item, "window.label.unfocus.textColor", 
00107                                                        "Window.Label.Unfocus.TextColor");
00108     }
00109     
00110 
00111     return false;
00112 }
00113 
00114 void FbWinFrameTheme::reconfigTheme() {
00115     if (*m_alpha > 255)
00116         *m_alpha = 255;
00117     else if (*m_alpha < 0)
00118         *m_alpha = 0;
00119 
00120     if (*m_bevel_width > 20)
00121         *m_bevel_width = 20;
00122     else if (*m_bevel_width < 0)
00123         *m_bevel_width = 0;
00124 
00125     if (*m_handle_width > 200)
00126         *m_handle_width = 200;
00127     else if (*m_handle_width < 0)
00128         *m_handle_width = 1;
00129 
00130     m_label_text_focus_gc.setForeground(*m_label_focus_color);
00131     m_label_text_unfocus_gc.setForeground(*m_label_unfocus_color);
00132     m_label_text_active_gc.setForeground(*m_label_active_color);
00133     m_button_pic_focus_gc.setForeground(*m_button_focus_color);
00134     m_button_pic_unfocus_gc.setForeground(*m_button_unfocus_color);
00135 }
00136 

Fluxbox CVS-Jan-2003




      



Got comments about the page? Send them to webmaster.
If you have general Fluxbox related questions ask them on our irc channel or mailing lists.

Show Source








Designed by aLEczapKA