aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2003-02-16 13:55:49 (GMT)
committerfluxgen <fluxgen>2003-02-16 13:55:49 (GMT)
commit2a80ac63ef03fa183e9bd688aae2cdf5424d6514 (patch)
tree5657707b56b5473fe96d9ce8ffb835a9c66380a9
parenta6e3b3a6f634edea759cf67cbf4acd5ee6dcf255 (diff)
downloadfluxbox_pavel-2a80ac63ef03fa183e9bd688aae2cdf5424d6514.zip
fluxbox_pavel-2a80ac63ef03fa183e9bd688aae2cdf5424d6514.tar.bz2
using configurated button position for titlebar
-rw-r--r--src/Screen.cc77
1 files changed, 49 insertions, 28 deletions
diff --git a/src/Screen.cc b/src/Screen.cc
index d77117d..66512ea 100644
--- a/src/Screen.cc
+++ b/src/Screen.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: Screen.cc,v 1.105 2003/02/16 01:14:54 fluxgen Exp $ 25// $Id: Screen.cc,v 1.106 2003/02/16 13:55:49 fluxgen Exp $
26 26
27 27
28#include "Screen.hh" 28#include "Screen.hh"
@@ -1113,43 +1113,64 @@ void BScreen::setupWindowActions(FluxboxWindow &win) {
1113 1113
1114 // clear old buttons from frame 1114 // clear old buttons from frame
1115 frame.removeAllButtons(); 1115 frame.removeAllButtons();
1116 //!! TODO: fix this ugly hack
1117 // get titlebar configuration
1118 const vector<Fluxbox::Titlebar> *dir = &Fluxbox::instance()->getTitlebarLeft();
1119 for (char c=0; c<2; c++) {
1120 for (int i=0; i< dir->size(); ++i) {
1121 //create new buttons
1122 FbTk::Button *newbutton = 0;
1123 if (win.isIconifiable() && (*dir)[i] == Fluxbox::MINIMIZE) {
1124 newbutton = new WinButton(WinButton::MINIMIZE,
1125 frame.titlebar(),
1126 0, 0, 10, 10);
1127 newbutton->setOnClick(iconify_cmd);
1116 1128
1117 //create new buttons
1118 if (win.isIconifiable()) {
1119 FbTk::Button *iconifybtn = new WinButton(WinButton::MINIMIZE, frame.titlebar(),
1120 0, 0, 10, 10);
1121 iconifybtn->setOnClick(iconify_cmd);
1122 iconifybtn->show();
1123 frame.addRightButton(iconifybtn);
1124#ifdef DEBUG 1129#ifdef DEBUG
1125 cerr<<"Creating iconify button"<<endl; 1130 cerr<<__FILE__<<": Creating iconify button"<<endl;
1126#endif //DEBUG 1131#endif //DEBUG
1127 } 1132 } else if (win.isMaximizable() && (*dir)[i] == Fluxbox::MAXIMIZE) {
1133 newbutton = new WinButton(WinButton::MAXIMIZE,
1134 frame.titlebar(),
1135 0, 0, 10, 10);
1128 1136
1129 if (win.isMaximizable()) { 1137 newbutton->setOnClick(maximize_cmd, 1);
1130 FbTk::Button *maximizebtn = new WinButton(WinButton::MAXIMIZE, frame.titlebar(), 1138 newbutton->setOnClick(maximize_horiz_cmd, 3);
1131 0, 0, 10, 10); 1139 newbutton->setOnClick(maximize_vert_cmd, 2);
1132 1140
1133 maximizebtn->setOnClick(maximize_cmd, 1);
1134 maximizebtn->setOnClick(maximize_horiz_cmd, 3);
1135 maximizebtn->setOnClick(maximize_vert_cmd, 2);
1136 maximizebtn->show();
1137 frame.addRightButton(maximizebtn);
1138#ifdef DEBUG 1141#ifdef DEBUG
1139 cerr<<"Creating maximize button"<<endl; 1142 cerr<<__FILE__<<":Creating maximize button"<<endl;
1140#endif // DEBUG 1143#endif // DEBUG
1141 } 1144 } else if (win.isClosable() && (*dir)[i] == Fluxbox::CLOSE) {
1142 1145 newbutton = new WinButton(WinButton::CLOSE,
1143 if (win.isClosable()) { 1146 frame.titlebar(),
1144 Button *closebtn = new WinButton(WinButton::CLOSE, frame.titlebar(), 0, 0, 10, 10); 1147 0, 0, 10, 10);
1145 1148
1146 closebtn->setOnClick(close_cmd); 1149 newbutton->setOnClick(close_cmd);
1147 closebtn->show();
1148 frame.addRightButton(closebtn);
1149#ifdef DEBUG 1150#ifdef DEBUG
1150 cerr<<"Creating close button"<<endl; 1151 cerr<<__FILE__<<": Creating close button"<<endl;
1151#endif // DEBUG 1152#endif // DEBUG
1152 } 1153 } else if ((*dir)[i] == Fluxbox::STICK) {
1154 newbutton = new WinButton(WinButton::STICK,
1155 frame.titlebar(),
1156 0, 0, 10, 10);
1157 newbutton->setOnClick(stick_cmd);
1158#ifdef DEBUG
1159 cerr<<__FILE__<<": Creating stick button"<<endl;
1160#endif // DEBUG
1161 }
1162
1163 if (newbutton != 0) {
1164 newbutton->show();
1165 if (c == 0)
1166 frame.addLeftButton(newbutton);
1167 else
1168 frame.addRightButton(newbutton);
1169 }
1170 } //end for i
1171 dir = &Fluxbox::instance()->getTitlebarRight();
1172 } // end for c
1173
1153 // setup titlebar 1174 // setup titlebar
1154 frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1 1175 frame.setOnClickTitlebar(raise_cmd, 1, false, true); // on press with button 1
1155 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1 1176 frame.setOnClickTitlebar(shade_cmd, 1, true); // doubleclick with button 1