aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-04-16 12:27:49 (GMT)
committerfluxgen <fluxgen>2003-04-16 12:27:49 (GMT)
commit67929002b1285897c212e1b88592d8f47ac468c1 (patch)
tree8998c0ea85a2c8c0466a8bc67eb567c2ffbb2f95
parent274e0a928efd7dad917e148e69e59fe84b6cefca (diff)
downloadfluxbox_paul-67929002b1285897c212e1b88592d8f47ac468c1.zip
fluxbox_paul-67929002b1285897c212e1b88592d8f47ac468c1.tar.bz2
current label button focused
-rw-r--r--src/FbWinFrame.cc139
-rw-r--r--src/FbWinFrame.hh14
-rw-r--r--src/Window.cc16
3 files changed, 119 insertions, 50 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}
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index e6bd585..590c30a 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.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: FbWinFrame.hh,v 1.5 2003/04/14 14:38:21 fluxgen Exp $ 22// $Id: FbWinFrame.hh,v 1.6 2003/04/16 12:24:28 fluxgen Exp $
23 23
24#ifndef FBWINFRAME_HH 24#ifndef FBWINFRAME_HH
25#define FBWINFRAME_HH 25#define FBWINFRAME_HH
@@ -42,7 +42,8 @@ namespace FbTk {
42class ImageControl; 42class ImageControl;
43}; 43};
44 44
45/// holds a window frame with a client window (see: <a href="fluxbox_fbwinframe.png">image</a>) 45/// holds a window frame with a client window
46/// (see: <a href="fluxbox_fbwinframe.png">image</a>)
46class FbWinFrame:public FbTk::EventHandler { 47class FbWinFrame:public FbTk::EventHandler {
47public: 48public:
48 49
@@ -89,7 +90,8 @@ public:
89 void addLabelButton(FbTk::Button &btn); 90 void addLabelButton(FbTk::Button &btn);
90 /// removes a specific button from label window 91 /// removes a specific button from label window
91 void removeLabelButton(FbTk::Button &btn); 92 void removeLabelButton(FbTk::Button &btn);
92 93 /// which button is to be rendered focused
94 void setLabelButtonFocus(FbTk::Button &btn);
93 /// attach a client window for client area 95 /// attach a client window for client area
94 void setClientWindow(Window win); 96 void setClientWindow(Window win);
95 /// same as above but with FbWindow 97 /// same as above but with FbWindow
@@ -172,6 +174,11 @@ private:
172 /// renders to pixmap or sets color 174 /// renders to pixmap or sets color
173 void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm, 175 void render(const FbTk::Texture &tex, FbTk::Color &col, Pixmap &pm,
174 unsigned int width, unsigned int height); 176 unsigned int width, unsigned int height);
177 void getUnFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
178 FbTk::Color &label_color, FbTk::Color &title_color);
179 void getCurrentFocusPixmap(Pixmap &label_pm, Pixmap &title_pm,
180 FbTk::Color &label_color, FbTk::Color &title_color);
181 void renderLabelButtons();
175 //@} 182 //@}
176 183
177 /// initiate some commont variables 184 /// initiate some commont variables
@@ -197,6 +204,7 @@ private:
197 ButtonList m_buttons_left, ///< buttons to the left 204 ButtonList m_buttons_left, ///< buttons to the left
198 m_buttons_right; ///< buttons to the right 205 m_buttons_right; ///< buttons to the right
199 ButtonList m_labelbuttons; ///< holds buttons inside label window 206 ButtonList m_labelbuttons; ///< holds buttons inside label window
207 FbTk::Button *m_current_label; ///< which button is focused at the moment
200 std::string m_titletext; ///< text to be displayed int m_label 208 std::string m_titletext; ///< text to be displayed int m_label
201 int m_bevel; ///< bevel between titlebar items and titlebar 209 int m_bevel; ///< bevel between titlebar items and titlebar
202 bool m_use_titlebar; ///< if we should use titlebar 210 bool m_use_titlebar; ///< if we should use titlebar
diff --git a/src/Window.cc b/src/Window.cc
index 5839c52..a2a9d02 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -22,7 +22,7 @@
22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 22// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
23// DEALINGS IN THE SOFTWARE. 23// DEALINGS IN THE SOFTWARE.
24 24
25// $Id: Window.cc,v 1.139 2003/04/16 00:38:06 fluxgen Exp $ 25// $Id: Window.cc,v 1.140 2003/04/16 12:27:49 fluxgen Exp $
26 26
27#include "Window.hh" 27#include "Window.hh"
28 28
@@ -307,7 +307,8 @@ void FluxboxWindow::init() {
307 btn->setJustify(m_frame.theme().justify()); 307 btn->setJustify(m_frame.theme().justify());
308 m_labelbuttons[m_client] = btn; 308 m_labelbuttons[m_client] = btn;
309 m_frame.addLabelButton(*btn); 309 m_frame.addLabelButton(*btn);
310 btn->show(); 310 m_frame.setLabelButtonFocus(*btn);
311 btn->show();
311 FbTk::EventManager &evm = *FbTk::EventManager::instance(); 312 FbTk::EventManager &evm = *FbTk::EventManager::instance();
312 // we need motion notify so we mask it 313 // we need motion notify so we mask it
313 btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask | 314 btn->window().setEventMask(ExposureMask | ButtonPressMask | ButtonReleaseMask |
@@ -594,6 +595,13 @@ bool FluxboxWindow::detachClient(WinClient &client) {
594 return true; 595 return true;
595} 596}
596 597
598void FluxboxWindow::detachCurrentClient() {
599 // should only operate if we had more than one client
600 if (numClients() <= 1)
601 return;
602 detachClient(*m_client);
603}
604
597/// removes client from client list, does not create new fluxboxwindow for it 605/// removes client from client list, does not create new fluxboxwindow for it
598bool FluxboxWindow::removeClient(WinClient &client) { 606bool FluxboxWindow::removeClient(WinClient &client) {
599 if (client.m_win != this || numClients() == 0) 607 if (client.m_win != this || numClients() == 0)
@@ -662,6 +670,7 @@ void FluxboxWindow::nextClient() {
662 else 670 else
663 m_client = *it; 671 m_client = *it;
664 m_client->raise(); 672 m_client->raise();
673 m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]);
665 setInputFocus(); 674 setInputFocus();
666} 675}
667 676
@@ -680,6 +689,7 @@ void FluxboxWindow::prevClient() {
680 m_client = *(--it); 689 m_client = *(--it);
681 690
682 m_client->raise(); 691 m_client->raise();
692 m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]);
683 setInputFocus(); 693 setInputFocus();
684} 694}
685 695
@@ -691,6 +701,7 @@ void FluxboxWindow::setCurrentClient(WinClient &client) {
691 m_client = &client; 701 m_client = &client;
692 m_client->raise(); 702 m_client->raise();
693 Fluxbox::instance()->setFocusedWindow(this); 703 Fluxbox::instance()->setFocusedWindow(this);
704 m_frame.setLabelButtonFocus(*m_labelbuttons[m_client]);
694 setInputFocus(); 705 setInputFocus();
695} 706}
696 707
@@ -2365,7 +2376,6 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2365 // drag'n'drop code for tabs 2376 // drag'n'drop code for tabs
2366 // 2377 //
2367 if (m_attaching_tab == 0) { 2378 if (m_attaching_tab == 0) {
2368 cerr<<"starting m_attching_tab for this="<<this<<endl;
2369 // start drag'n'drop for tab 2379 // start drag'n'drop for tab
2370 m_attaching_tab = client; 2380 m_attaching_tab = client;
2371 2381