diff options
author | fluxgen <fluxgen> | 2003-07-10 11:48:14 (GMT) |
---|---|---|
committer | fluxgen <fluxgen> | 2003-07-10 11:48:14 (GMT) |
commit | 3b95805b5f9419f8e523514224e90326dc572cca (patch) | |
tree | f0a12f45e12f841b3c399309553db74c0a8a3ef4 | |
parent | e7d0cfd16c9cd386c28d0d563dd057a561e8ceb0 (diff) | |
download | fluxbox_lack-3b95805b5f9419f8e523514224e90326dc572cca.zip fluxbox_lack-3b95805b5f9419f8e523514224e90326dc572cca.tar.bz2 |
added shape
-rw-r--r-- | src/Toolbar.cc | 54 | ||||
-rw-r--r-- | src/Toolbar.hh | 4 |
2 files changed, 50 insertions, 8 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc index f99d2ad..24df816 100644 --- a/src/Toolbar.cc +++ b/src/Toolbar.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: Toolbar.cc,v 1.97 2003/07/01 12:41:44 fluxgen Exp $ | 25 | // $Id: Toolbar.cc,v 1.98 2003/07/10 11:48:14 fluxgen Exp $ |
26 | 26 | ||
27 | #include "Toolbar.hh" | 27 | #include "Toolbar.hh" |
28 | 28 | ||
@@ -55,6 +55,8 @@ | |||
55 | #include "config.h" | 55 | #include "config.h" |
56 | #endif // HAVE_CONFIG_H | 56 | #endif // HAVE_CONFIG_H |
57 | 57 | ||
58 | #include "Shape.hh" | ||
59 | |||
58 | #include <X11/Xutil.h> | 60 | #include <X11/Xutil.h> |
59 | #include <X11/keysym.h> | 61 | #include <X11/keysym.h> |
60 | 62 | ||
@@ -269,8 +271,8 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, FbTk::Menu &menu, size_t wi | |||
269 | m_rc_on_head(scrn.resourceManager(), 0, | 271 | m_rc_on_head(scrn.resourceManager(), 0, |
270 | scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"), | 272 | scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"), |
271 | m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, | 273 | m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, |
272 | scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement") | 274 | scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"), |
273 | { | 275 | m_shape(new Shape(frame.window, 0)) { |
274 | 276 | ||
275 | // we need to get notified when the theme is reloaded | 277 | // we need to get notified when the theme is reloaded |
276 | m_theme.addListener(m_themelistener); | 278 | m_theme.addListener(m_themelistener); |
@@ -397,11 +399,17 @@ bool Toolbar::isVertical() const { | |||
397 | } | 399 | } |
398 | 400 | ||
399 | void Toolbar::addIcon(FluxboxWindow *w) { | 401 | void Toolbar::addIcon(FluxboxWindow *w) { |
402 | if (w == 0) | ||
403 | return; | ||
404 | |||
400 | if (m_iconbar.get() != 0) | 405 | if (m_iconbar.get() != 0) |
401 | FbTk::EventManager::instance()->add(*this, m_iconbar->addIcon(w)); | 406 | FbTk::EventManager::instance()->add(*this, m_iconbar->addIcon(w)); |
402 | } | 407 | } |
403 | 408 | ||
404 | void Toolbar::delIcon(FluxboxWindow *w) { | 409 | void Toolbar::delIcon(FluxboxWindow *w) { |
410 | if (w == 0) | ||
411 | return; | ||
412 | |||
405 | if (m_iconbar.get() != 0) | 413 | if (m_iconbar.get() != 0) |
406 | FbTk::EventManager::instance()->remove(m_iconbar->delIcon(w)); | 414 | FbTk::EventManager::instance()->remove(m_iconbar->delIcon(w)); |
407 | } | 415 | } |
@@ -473,7 +481,13 @@ void Toolbar::reconfigure() { | |||
473 | m_iconbar->setVertical(vertical); | 481 | m_iconbar->setVertical(vertical); |
474 | 482 | ||
475 | frame.bevel_w = theme().bevelWidth(); | 483 | frame.bevel_w = theme().bevelWidth(); |
476 | 484 | // destroy shape if the theme wasn't specified with one, | |
485 | // or create one | ||
486 | if (theme().shape() == false && m_shape.get()) | ||
487 | m_shape.reset(0); | ||
488 | else if (theme().shape() && m_shape.get() == 0) { | ||
489 | m_shape.reset(new Shape(frame.window, 0)); | ||
490 | } | ||
477 | // recallibrate size | 491 | // recallibrate size |
478 | setPlacement(placement()); | 492 | setPlacement(placement()); |
479 | 493 | ||
@@ -740,12 +754,15 @@ void Toolbar::reconfigure() { | |||
740 | 754 | ||
741 | frame.workspace_label.clear(); | 755 | frame.workspace_label.clear(); |
742 | frame.window_label.clear(); | 756 | frame.window_label.clear(); |
743 | frame.clock.clear(); | 757 | frame.clock.clear(); |
744 | frame.psbutton.clear(); | 758 | frame.psbutton.clear(); |
745 | frame.nsbutton.clear(); | 759 | frame.nsbutton.clear(); |
746 | frame.pwbutton.clear(); | 760 | frame.pwbutton.clear(); |
747 | frame.nwbutton.clear(); | 761 | frame.nwbutton.clear(); |
748 | 762 | ||
763 | if (theme().shape() && m_shape.get()) | ||
764 | m_shape->update(); | ||
765 | |||
749 | redrawWindowLabel(); | 766 | redrawWindowLabel(); |
750 | if (m_iconbar.get()) | 767 | if (m_iconbar.get()) |
751 | m_iconbar->reconfigure(); | 768 | m_iconbar->reconfigure(); |
@@ -1199,6 +1216,8 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
1199 | frame.y = head_y; | 1216 | frame.y = head_y; |
1200 | frame.x_hidden = head_x; | 1217 | frame.x_hidden = head_x; |
1201 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 1218 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; |
1219 | if (m_shape.get()) | ||
1220 | m_shape->setPlaces(Shape::BOTTOMRIGHT | Shape::BOTTOMLEFT); | ||
1202 | break; | 1221 | break; |
1203 | 1222 | ||
1204 | case BOTTOMLEFT: | 1223 | case BOTTOMLEFT: |
@@ -1206,7 +1225,8 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
1206 | frame.y = head_y + head_h - frame.height - border_width*2; | 1225 | frame.y = head_y + head_h - frame.height - border_width*2; |
1207 | frame.x_hidden = head_x; | 1226 | frame.x_hidden = head_x; |
1208 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 1227 | frame.y_hidden = head_y + head_h - bevel_width - border_width; |
1209 | 1228 | if (m_shape.get()) | |
1229 | m_shape->setPlaces(Shape::TOPRIGHT | Shape::TOPLEFT); | ||
1210 | break; | 1230 | break; |
1211 | 1231 | ||
1212 | case TOPCENTER: | 1232 | case TOPCENTER: |
@@ -1214,11 +1234,15 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
1214 | frame.y = head_y; | 1234 | frame.y = head_y; |
1215 | frame.x_hidden = frame.x; | 1235 | frame.x_hidden = frame.x; |
1216 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; | 1236 | frame.y_hidden = head_y + bevel_width - border_width - frame.height; |
1237 | if (m_shape.get()) | ||
1238 | m_shape->setPlaces(Shape::BOTTOMRIGHT | Shape::BOTTOMLEFT); | ||
1217 | break; | 1239 | break; |
1218 | case TOPRIGHT: | 1240 | case TOPRIGHT: |
1219 | frame.x = head_x + head_w - frame.width - border_width*2; | 1241 | frame.x = head_x + head_w - frame.width - border_width*2; |
1220 | frame.y = head_y; | 1242 | frame.y = head_y; |
1221 | frame.x_hidden = frame.x; | 1243 | frame.x_hidden = frame.x; |
1244 | if (m_shape.get()) | ||
1245 | m_shape->setPlaces(Shape::BOTTOMRIGHT | Shape::BOTTOMLEFT); | ||
1222 | break; | 1246 | break; |
1223 | 1247 | ||
1224 | case BOTTOMRIGHT: | 1248 | case BOTTOMRIGHT: |
@@ -1226,6 +1250,8 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
1226 | frame.y = head_y + head_h - frame.height - border_width*2; | 1250 | frame.y = head_y + head_h - frame.height - border_width*2; |
1227 | frame.x_hidden = frame.x; | 1251 | frame.x_hidden = frame.x; |
1228 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 1252 | frame.y_hidden = head_y + head_h - bevel_width - border_width; |
1253 | if (m_shape.get()) | ||
1254 | m_shape->setPlaces(Shape::TOPRIGHT | Shape::TOPLEFT); | ||
1229 | break; | 1255 | break; |
1230 | 1256 | ||
1231 | case BOTTOMCENTER: // default is BOTTOMCENTER | 1257 | case BOTTOMCENTER: // default is BOTTOMCENTER |
@@ -1234,42 +1260,56 @@ void Toolbar::setPlacement(Toolbar::Placement where) { | |||
1234 | frame.y = head_y + head_h - frame.height - border_width*2; | 1260 | frame.y = head_y + head_h - frame.height - border_width*2; |
1235 | frame.x_hidden = frame.x; | 1261 | frame.x_hidden = frame.x; |
1236 | frame.y_hidden = head_y + head_h - bevel_width - border_width; | 1262 | frame.y_hidden = head_y + head_h - bevel_width - border_width; |
1263 | if (m_shape.get()) | ||
1264 | m_shape->setPlaces(Shape::TOPRIGHT | Shape::TOPLEFT); | ||
1237 | break; | 1265 | break; |
1238 | case LEFTCENTER: | 1266 | case LEFTCENTER: |
1239 | frame.x = head_x; | 1267 | frame.x = head_x; |
1240 | frame.y = head_y + (head_h - frame.height)/2; | 1268 | frame.y = head_y + (head_h - frame.height)/2; |
1241 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; | 1269 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; |
1242 | frame.y_hidden = frame.y; | 1270 | frame.y_hidden = frame.y; |
1271 | if (m_shape.get()) | ||
1272 | m_shape->setPlaces(Shape::TOPRIGHT | Shape::BOTTOMRIGHT); | ||
1243 | break; | 1273 | break; |
1244 | case LEFTTOP: | 1274 | case LEFTTOP: |
1245 | frame.x = head_x; | 1275 | frame.x = head_x; |
1246 | frame.y = head_y; | 1276 | frame.y = head_y; |
1247 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; | 1277 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; |
1248 | frame.y_hidden = frame.y; | 1278 | frame.y_hidden = frame.y; |
1279 | if (m_shape.get()) | ||
1280 | m_shape->setPlaces(Shape::TOPRIGHT | Shape::BOTTOMRIGHT); | ||
1249 | break; | 1281 | break; |
1250 | case LEFTBOTTOM: | 1282 | case LEFTBOTTOM: |
1251 | frame.x = head_x; | 1283 | frame.x = head_x; |
1252 | frame.y = head_y + head_h - frame.height - border_width*2; | 1284 | frame.y = head_y + head_h - frame.height - border_width*2; |
1253 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; | 1285 | frame.x_hidden = frame.x - frame.width + bevel_width + border_width; |
1254 | frame.y_hidden = frame.y; | 1286 | frame.y_hidden = frame.y; |
1287 | if (m_shape.get()) | ||
1288 | m_shape->setPlaces(Shape::TOPRIGHT | Shape::BOTTOMRIGHT); | ||
1255 | break; | 1289 | break; |
1256 | case RIGHTCENTER: | 1290 | case RIGHTCENTER: |
1257 | frame.x = head_x + head_w - frame.width - border_width*2; | 1291 | frame.x = head_x + head_w - frame.width - border_width*2; |
1258 | frame.y = head_y + (head_h - frame.height)/2; | 1292 | frame.y = head_y + (head_h - frame.height)/2; |
1259 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; | 1293 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; |
1260 | frame.y_hidden = frame.y; | 1294 | frame.y_hidden = frame.y; |
1295 | if (m_shape.get()) | ||
1296 | m_shape->setPlaces(Shape::TOPLEFT | Shape::BOTTOMLEFT); | ||
1261 | break; | 1297 | break; |
1262 | case RIGHTTOP: | 1298 | case RIGHTTOP: |
1263 | frame.x = head_x + head_w - frame.width - border_width*2; | 1299 | frame.x = head_x + head_w - frame.width - border_width*2; |
1264 | frame.y = head_y; | 1300 | frame.y = head_y; |
1265 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; | 1301 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; |
1266 | frame.y_hidden = frame.y; | 1302 | frame.y_hidden = frame.y; |
1303 | if (m_shape.get()) | ||
1304 | m_shape->setPlaces(Shape::TOPLEFT | Shape::BOTTOMLEFT); | ||
1267 | break; | 1305 | break; |
1268 | case RIGHTBOTTOM: | 1306 | case RIGHTBOTTOM: |
1269 | frame.x = head_x + head_w - frame.width - border_width*2; | 1307 | frame.x = head_x + head_w - frame.width - border_width*2; |
1270 | frame.y = head_y + head_h - frame.height - border_width*2; | 1308 | frame.y = head_y + head_h - frame.height - border_width*2; |
1271 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; | 1309 | frame.x_hidden = frame.x + frame.width - bevel_width - border_width; |
1272 | frame.y_hidden = frame.y; | 1310 | frame.y_hidden = frame.y; |
1311 | if (m_shape.get()) | ||
1312 | m_shape->setPlaces(Shape::TOPLEFT | Shape::BOTTOMLEFT); | ||
1273 | break; | 1313 | break; |
1274 | } | 1314 | } |
1275 | } | 1315 | } |
diff --git a/src/Toolbar.hh b/src/Toolbar.hh index 7a62c8d..b6732f4 100644 --- a/src/Toolbar.hh +++ b/src/Toolbar.hh | |||
@@ -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: Toolbar.hh,v 1.36 2003/06/26 12:22:42 rathnor Exp $ | 25 | // $Id: Toolbar.hh,v 1.37 2003/07/10 11:45:22 fluxgen Exp $ |
26 | 26 | ||
27 | #ifndef TOOLBAR_HH | 27 | #ifndef TOOLBAR_HH |
28 | #define TOOLBAR_HH | 28 | #define TOOLBAR_HH |
@@ -42,6 +42,7 @@ | |||
42 | class BScreen; | 42 | class BScreen; |
43 | class Strut; | 43 | class Strut; |
44 | class IconBar; | 44 | class IconBar; |
45 | class Shape; | ||
45 | 46 | ||
46 | namespace FbTk { | 47 | namespace FbTk { |
47 | class ImageControl; | 48 | class ImageControl; |
@@ -205,6 +206,7 @@ private: | |||
205 | FbTk::Resource<Fluxbox::Layer> m_rc_layernum; | 206 | FbTk::Resource<Fluxbox::Layer> m_rc_layernum; |
206 | FbTk::Resource<int> m_rc_on_head; | 207 | FbTk::Resource<int> m_rc_on_head; |
207 | FbTk::Resource<Placement> m_rc_placement; | 208 | FbTk::Resource<Placement> m_rc_placement; |
209 | std::auto_ptr<Shape> m_shape; | ||
208 | }; | 210 | }; |
209 | 211 | ||
210 | 212 | ||