aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc139
1 files changed, 95 insertions, 44 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index d3f6782..7fd15cb 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.20 2003/04/16 10:56:37 fluxgen Exp $ 22// $Id: FbWinFrame.cc,v 1.21 2003/04/16 12:26:21 fluxgen Exp $
23 23
24#include "FbWinFrame.hh" 24#include "FbWinFrame.hh"
25#include "ImageControl.hh" 25#include "ImageControl.hh"
@@ -261,6 +261,17 @@ void FbWinFrame::removeLabelButton(FbTk::Button &btn) {
261 m_labelbuttons.erase(erase_it); 261 m_labelbuttons.erase(erase_it);
262} 262}
263 263
264void FbWinFrame::setLabelButtonFocus(FbTk::Button &btn) {
265 ButtonList::iterator it = find(m_labelbuttons.begin(),
266 m_labelbuttons.end(),
267 &btn);
268 if (it == m_labelbuttons.end())
269 return;
270
271 m_current_label = *it; // current focused button
272 renderLabelButtons();
273}
274
264void FbWinFrame::setClientWindow(FbTk::FbWindow &win) { 275void FbWinFrame::setClientWindow(FbTk::FbWindow &win) {
265 setClientWindow(win.window()); 276 setClientWindow(win.window());
266} 277}
@@ -649,51 +660,25 @@ void FbWinFrame::renderTitlebar() {
649 m_label.width(), m_label.height()); 660 m_label.width(), m_label.height());
650 661
651 // finaly set up pixmaps for titlebar windows 662 // finaly set up pixmaps for titlebar windows
652 Pixmap labelpm = None; 663 Pixmap label_pm = None;
653 FbTk::Color labelcolor; 664 Pixmap title_pm = None;
654 665 FbTk::Color label_color;
655 if (m_focused) { 666 FbTk::Color title_color;
656 if (m_label_focused_pm != 0){ 667 getCurrentFocusPixmap(label_pm, title_pm,
657 labelpm = m_label_focused_pm; 668 label_color, title_color);
658 m_label.setBackgroundPixmap(m_label_focused_pm); 669
659 } else { 670
660 labelcolor = m_label_focused_color; 671 if (label_pm != 0)
661 m_label.setBackgroundColor(m_label_focused_color); 672 m_label.setBackgroundPixmap(label_pm);
662 } 673 else
674 m_label.setBackgroundColor(label_color);
663 675
664 if (m_title_focused_pm != 0) 676 if (title_pm != 0)
665 m_titlebar.setBackgroundPixmap(m_title_focused_pm); 677 m_titlebar.setBackgroundPixmap(title_pm);
666 else 678 else
667 m_titlebar.setBackgroundColor(m_title_focused_color); 679 m_titlebar.setBackgroundColor(title_color);
668
669 } else {
670 if (m_label_unfocused_pm != 0) {
671 labelpm = m_label_unfocused_pm;
672 m_label.setBackgroundPixmap(m_label_unfocused_pm);
673 } else {
674 labelcolor = m_label_unfocused_color;
675 m_label.setBackgroundColor(m_label_unfocused_color);
676 }
677
678
679 if (m_title_unfocused_pm != 0)
680 m_titlebar.setBackgroundPixmap(m_title_unfocused_pm);
681 else
682 m_titlebar.setBackgroundColor(m_title_unfocused_color);
683
684 }
685 680
686 ButtonList::iterator btn_it = m_labelbuttons.begin(); 681 renderLabelButtons();
687 ButtonList::iterator btn_it_end = m_labelbuttons.end();
688 for (; btn_it != btn_it_end; ++btn_it) {
689 (*btn_it)->setGC(theme().labelTextFocusGC());
690 (*btn_it)->window().setBorderWidth(1);
691 if (labelpm)
692 (*btn_it)->setBackgroundPixmap(labelpm);
693 else
694 (*btn_it)->setBackgroundColor(labelcolor);
695 }
696
697 redrawTitle(); 682 redrawTitle();
698} 683}
699 684
@@ -779,6 +764,7 @@ void FbWinFrame::renderButtons() {
779 764
780void FbWinFrame::init() { 765void FbWinFrame::init() {
781 // clear pixmaps 766 // clear pixmaps
767 m_current_label = 0; // no focused button at first
782 m_title_focused_pm = m_title_unfocused_pm = 0; 768 m_title_focused_pm = m_title_unfocused_pm = 0;
783 m_label_focused_pm = m_label_unfocused_pm = 0; 769 m_label_focused_pm = m_label_unfocused_pm = 0;
784 m_button_unfocused_pm = m_button_pressed_pm = 0; 770 m_button_unfocused_pm = m_button_pressed_pm = 0;
@@ -843,3 +829,68 @@ void FbWinFrame::render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
843 m_imagectrl.removeImage(tmp); 829 m_imagectrl.removeImage(tmp);
844 830
845} 831}
832
833void FbWinFrame::getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
834 FbTk::Color &label_color, FbTk::Color &title_color) {
835 if (m_focused) {
836 if (m_label_focused_pm != 0)
837 label_pm = m_label_focused_pm;
838 else
839 label_color = m_label_focused_color;
840
841 if (m_title_focused_pm != 0)
842 title_pm = m_title_focused_pm;
843 else
844 title_color = m_title_focused_color;
845
846 } else {
847 getUnFocusPixmap(label_pm, title_pm,
848 label_color, title_color);
849 }
850
851}
852
853void FbWinFrame::getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
854 FbTk::Color &label_color, FbTk::Color &title_color) {
855 if (m_label_unfocused_pm != 0)
856 label_pm = m_label_unfocused_pm;
857 else
858 label_color = m_label_unfocused_color;
859
860 if (m_title_unfocused_pm != 0)
861 title_pm = m_title_unfocused_pm;
862 else
863 title_color = m_title_unfocused_color;
864}
865
866void FbWinFrame::renderLabelButtons() {
867 Pixmap label_pm = None;
868 Pixmap not_used_pm = None;
869 FbTk::Color label_color;
870 FbTk::Color not_used_color;
871 getCurrentFocusPixmap(label_pm, not_used_pm,
872 label_color, not_used_color);
873
874 ButtonList::iterator btn_it = m_labelbuttons.begin();
875 ButtonList::iterator btn_it_end = m_labelbuttons.end();
876 for (; btn_it != btn_it_end; ++btn_it) {
877 (*btn_it)->setGC(theme().labelTextFocusGC());
878 (*btn_it)->window().setBorderWidth(1);
879 if ((*btn_it) != m_current_label) {
880 if (m_label_unfocused_pm != 0)
881 (*btn_it)->setBackgroundPixmap(m_label_unfocused_pm);
882 else
883 (*btn_it)->setBackgroundColor(m_label_unfocused_color);
884
885 } else {
886
887 if (label_pm)
888 (*btn_it)->setBackgroundPixmap(label_pm);
889 else
890 (*btn_it)->setBackgroundColor(label_color);
891 }
892
893 (*btn_it)->clear();
894 }
895
896}