00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
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"),
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
00074 m_font->load("fixed");
00075 *m_alpha = 255;
00076
00077
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
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