summaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc75
1 files changed, 55 insertions, 20 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 2ff7203..3270525 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.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: FbWinFrame.cc,v 1.63 2003/12/07 16:39:43 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.64 2003/12/09 08:48:08 rathnor Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25 25
@@ -235,7 +235,7 @@ void FbWinFrame::setFocus(bool newvalue) {
235 if (newvalue) // focused 235 if (newvalue) // focused
236 renderButtonFocus(*m_current_label); 236 renderButtonFocus(*m_current_label);
237 else // unfocused 237 else // unfocused
238 renderButtonUnfocus(*m_current_label); 238 renderButtonActive(*m_current_label);
239 } 239 }
240 240
241 renderTitlebar(); 241 renderTitlebar();
@@ -287,6 +287,9 @@ void FbWinFrame::addLabelButton(FbTk::TextButton &btn) {
287 return; 287 return;
288 288
289 m_labelbuttons.push_back(&btn); 289 m_labelbuttons.push_back(&btn);
290
291 if (currentLabel() == 0)
292 setLabelButtonFocus(btn);
290} 293}
291 294
292void FbWinFrame::removeLabelButton(FbTk::TextButton &btn) { 295void FbWinFrame::removeLabelButton(FbTk::TextButton &btn) {
@@ -355,7 +358,10 @@ void FbWinFrame::setLabelButtonFocus(FbTk::TextButton &btn) {
355 358
356 m_current_label = *it; // current focused button 359 m_current_label = *it; // current focused button
357 360
358 renderButtonFocus(*m_current_label); 361 if (m_focused)
362 renderButtonFocus(*m_current_label);
363 else
364 renderButtonActive(*m_current_label);
359} 365}
360 366
361void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { 367void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
@@ -688,6 +694,7 @@ void FbWinFrame::reconfigure() {
688 m_shape->update(); 694 m_shape->update();
689 695
690 // titlebar stuff rendered already by reconftitlebar 696 // titlebar stuff rendered already by reconftitlebar
697
691} 698}
692 699
693void FbWinFrame::setUseShape(bool value) { 700void FbWinFrame::setUseShape(bool value) {
@@ -833,6 +840,11 @@ void FbWinFrame::renderTitlebar() {
833 m_label_unfocused_pm, 840 m_label_unfocused_pm,
834 m_label.width(), m_label.height()); 841 m_label.width(), m_label.height());
835 842
843 render(m_theme.labelActiveTexture(), m_label_active_color,
844 m_label_active_pm,
845 m_label.width(), m_label.height());
846
847
836 // finaly set up pixmaps for titlebar windows 848 // finaly set up pixmaps for titlebar windows
837 Pixmap label_pm = None; 849 Pixmap label_pm = None;
838 Pixmap title_pm = None; 850 Pixmap title_pm = None;
@@ -973,7 +985,7 @@ void FbWinFrame::init() {
973 985
974 // clear pixmaps 986 // clear pixmaps
975 m_title_focused_pm = m_title_unfocused_pm = 0; 987 m_title_focused_pm = m_title_unfocused_pm = 0;
976 m_label_focused_pm = m_label_unfocused_pm = 0; 988 m_label_focused_pm = m_label_unfocused_pm = m_label_active_pm = 0;
977 m_handle_focused_pm = m_handle_unfocused_pm = 0; 989 m_handle_focused_pm = m_handle_unfocused_pm = 0;
978 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0; 990 m_button_pm = m_button_unfocused_pm = m_button_pressed_pm = 0;
979 m_grip_unfocused_pm = m_grip_focused_pm = 0; 991 m_grip_unfocused_pm = m_grip_focused_pm = 0;
@@ -1049,19 +1061,21 @@ void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
1049 title_color = m_title_focused_color; 1061 title_color = m_title_focused_color;
1050 1062
1051 } else { 1063 } else {
1052 getUnfocusPixmap(label_pm, title_pm, 1064 getActiveLabelPixmap(label_pm, title_pm,
1053 label_color, title_color); 1065 label_color, title_color);
1054 } 1066 }
1055 1067
1056} 1068}
1057 1069
1058void FbWinFrame::getUnfocusPixmap(Pixmap &label_pm, Pixmap &title_pm, 1070// only called if not focused
1071void FbWinFrame::getActiveLabelPixmap(Pixmap &label_pm, Pixmap &title_pm,
1059 FbTk::Color &label_color, 1072 FbTk::Color &label_color,
1060 FbTk::Color &title_color) { 1073 FbTk::Color &title_color) {
1061 if (m_label_unfocused_pm != 0) { 1074
1062 label_pm = m_label_unfocused_pm; 1075 if (m_label_active_pm != 0)
1063 } else 1076 label_pm = m_label_active_pm;
1064 label_color = m_label_unfocused_color; 1077 else
1078 label_color = m_label_active_color;
1065 1079
1066 if (m_title_unfocused_pm != 0) 1080 if (m_title_unfocused_pm != 0)
1067 title_pm = m_title_unfocused_pm; 1081 title_pm = m_title_unfocused_pm;
@@ -1081,9 +1095,12 @@ void FbWinFrame::renderLabelButtons() {
1081 LabelList::iterator btn_it = m_labelbuttons.begin(); 1095 LabelList::iterator btn_it = m_labelbuttons.begin();
1082 LabelList::iterator btn_it_end = m_labelbuttons.end(); 1096 LabelList::iterator btn_it_end = m_labelbuttons.end();
1083 for (; btn_it != btn_it_end; ++btn_it) { 1097 for (; btn_it != btn_it_end; ++btn_it) {
1084 if (*btn_it == m_current_label) 1098 if (*btn_it == m_current_label) {
1085 renderButtonFocus(**btn_it); 1099 if (m_focused)
1086 else 1100 renderButtonFocus(**btn_it);
1101 else
1102 renderButtonActive(**btn_it);
1103 } else
1087 renderButtonUnfocus(**btn_it); 1104 renderButtonUnfocus(**btn_it);
1088 1105
1089 } 1106 }
@@ -1136,15 +1153,34 @@ void FbWinFrame::renderButtonFocus(FbTk::TextButton &button) {
1136 1153
1137 if (m_label_focused_pm != 0) { 1154 if (m_label_focused_pm != 0) {
1138 // already set 1155 // already set
1139 if (button.backgroundPixmap() == m_label_focused_pm) 1156 if (button.backgroundPixmap() != m_label_focused_pm)
1140 return; 1157 button.setBackgroundPixmap(m_label_focused_pm);
1141 button.setBackgroundPixmap(m_label_focused_pm);
1142 } else 1158 } else
1143 button.setBackgroundColor(m_label_focused_color); 1159 button.setBackgroundColor(m_label_focused_color);
1144 1160
1145 button.clear(); 1161 button.clear();
1146} 1162}
1147 1163
1164void FbWinFrame::renderButtonActive(FbTk::TextButton &button) {
1165
1166 button.setGC(theme().labelTextActiveGC());
1167 button.setJustify(theme().justify());
1168 button.setBorderWidth(1);
1169 button.setAlpha(theme().alpha());
1170
1171 if (m_label_active_pm == 0)
1172 m_label_active_pm = m_label_unfocused_pm;
1173
1174 if (m_label_active_pm != 0) {
1175 // already set
1176 if (button.backgroundPixmap() != m_label_active_pm)
1177 button.setBackgroundPixmap(m_label_active_pm);
1178 } else
1179 button.setBackgroundColor(m_label_active_color);
1180
1181 button.clear();
1182}
1183
1148void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) { 1184void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
1149 1185
1150 button.setGC(theme().labelTextUnfocusGC()); 1186 button.setGC(theme().labelTextUnfocusGC());
@@ -1154,9 +1190,8 @@ void FbWinFrame::renderButtonUnfocus(FbTk::TextButton &button) {
1154 1190
1155 if (m_label_unfocused_pm != 0) { 1191 if (m_label_unfocused_pm != 0) {
1156 // already set 1192 // already set
1157 if (button.backgroundPixmap() == m_label_unfocused_pm) 1193 if (button.backgroundPixmap() != m_label_unfocused_pm)
1158 return; 1194 button.setBackgroundPixmap(m_label_unfocused_pm);
1159 button.setBackgroundPixmap(m_label_unfocused_pm);
1160 } else 1195 } else
1161 button.setBackgroundColor(m_label_unfocused_color); 1196 button.setBackgroundColor(m_label_unfocused_color);
1162 1197