aboutsummaryrefslogtreecommitdiff
path: root/src/Slit.cc
diff options
context:
space:
mode:
authorPavel Labath <pavelo@centrum.sk>2011-08-15 21:03:57 (GMT)
committerPavel Labath <pavelo@centrum.sk>2013-02-18 21:04:26 (GMT)
commitcab5fa69f059033c4e304076f1892d9cf7c84031 (patch)
treedd56d66c9f19dbdc606c144e8c6af2a6a444c324 /src/Slit.cc
parenta897844ea1cfa6303112fd3f0d472d3e135bdc6d (diff)
downloadfluxbox_pavel-cab5fa69f059033c4e304076f1892d9cf7c84031.zip
fluxbox_pavel-cab5fa69f059033c4e304076f1892d9cf7c84031.tar.bz2
Move declarations of Resource enums to a separate file
The reason for this is that I need to access those enums from fluxbox-update_configs and I don't want to #include and link everything in src. I also merged Slit::Placement, Toolbar::Placement and FbWinFrame::TabPlacement into one enum.
Diffstat (limited to 'src/Slit.cc')
-rw-r--r--src/Slit.cc73
1 files changed, 26 insertions, 47 deletions
diff --git a/src/Slit.cc b/src/Slit.cc
index 3937653..d9681a1 100644
--- a/src/Slit.cc
+++ b/src/Slit.cc
@@ -89,27 +89,6 @@ using std::endl;
89using std::hex; 89using std::hex;
90using std::dec; 90using std::dec;
91 91
92namespace FbTk {
93
94template<>
95const EnumTraits<Slit::Placement>::Pair EnumTraits<Slit::Placement>::s_map[] = {
96 { "TopLeft", Slit::TOPLEFT },
97 { "LeftCenter", Slit::LEFTCENTER },
98 { "BottomLeft", Slit::BOTTOMLEFT },
99 { "TopCenter", Slit::TOPCENTER },
100 { "BottomCenter", Slit::BOTTOMCENTER },
101 { "TopRight", Slit::TOPRIGHT },
102 { "RightCenter", Slit::RIGHTCENTER },
103 { "BottomRight", Slit::BOTTOMRIGHT },
104 { "LeftTop", Slit::LEFTTOP },
105 { "RightTop", Slit::RIGHTTOP },
106 { "LeftBottom", Slit::LEFTBOTTOM },
107 { "RightBottom", Slit::RIGHTBOTTOM },
108 { NULL, Slit::RIGHTBOTTOM },
109};
110
111} // end namespace FbTk
112
113namespace { 92namespace {
114 93
115class SlitClientMenuItem: public FbTk::MenuItem{ 94class SlitClientMenuItem: public FbTk::MenuItem{
@@ -145,7 +124,7 @@ private:
145 124
146class PlaceSlitMenuItem: public FbTk::RadioMenuItem { 125class PlaceSlitMenuItem: public FbTk::RadioMenuItem {
147public: 126public:
148 PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Slit::Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd): 127 PlaceSlitMenuItem(const FbTk::FbString &label, Slit &slit, Placement place, FbTk::RefCount<FbTk::Command<void> > &cmd):
149 FbTk::RadioMenuItem(label, cmd), m_slit(slit), m_place(place) { 128 FbTk::RadioMenuItem(label, cmd), m_slit(slit), m_place(place) {
150 setCloseOnClick(false); 129 setCloseOnClick(false);
151 } 130 }
@@ -156,7 +135,7 @@ public:
156 } 135 }
157private: 136private:
158 Slit &m_slit; 137 Slit &m_slit;
159 Slit::Placement m_place; 138 Placement m_place;
160}; 139};
161 140
162} // End anonymous namespace 141} // End anonymous namespace
@@ -231,10 +210,10 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer)
231 m_screen(scr), 210 m_screen(scr),
232 m_clientlist_menu(new FbMenu(scr.menuTheme(), 211 m_clientlist_menu(new FbMenu(scr.menuTheme(),
233 scr.imageControl(), 212 scr.imageControl(),
234 *scr.layerManager().getLayer(ResourceLayer::MENU)) ), 213 *scr.layerManager().getLayer(LAYERMENU)) ),
235 m_slitmenu(new FbMenu(scr.menuTheme(), 214 m_slitmenu(new FbMenu(scr.menuTheme(),
236 scr.imageControl(), 215 scr.imageControl(),
237 *scr.layerManager().getLayer(ResourceLayer::MENU)) ), 216 *scr.layerManager().getLayer(LAYERMENU)) ),
238#ifdef XINERAMA 217#ifdef XINERAMA
239 m_xineramaheadmenu(0), 218 m_xineramaheadmenu(0),
240#endif // XINERAMA 219#endif // XINERAMA
@@ -258,7 +237,7 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer)
258 m_rc_placement(scr.resourceManager(), RIGHTBOTTOM, scr.name() + ".slit.placement"), 237 m_rc_placement(scr.resourceManager(), RIGHTBOTTOM, scr.name() + ".slit.placement"),
259 m_rc_alpha(scr.resourceManager(), 255, scr.name() + ".slit.alpha"), 238 m_rc_alpha(scr.resourceManager(), 255, scr.name() + ".slit.alpha"),
260 m_rc_on_head(scr.resourceManager(), 0, scr.name() + ".slit.onhead"), 239 m_rc_on_head(scr.resourceManager(), 0, scr.name() + ".slit.onhead"),
261 m_rc_layernum(scr.resourceManager(), ResourceLayer::DOCK, scr.name() + ".slit.layer") { 240 m_rc_layernum(scr.resourceManager(), LAYERDOCK, scr.name() + ".slit.layer") {
262 241
263 _FB_USES_NLS; 242 _FB_USES_NLS;
264 243
@@ -300,7 +279,7 @@ Slit::Slit(BScreen &scr, FbTk::Layer &layer)
300 m_layermenu.reset(new LayerMenu(scr.menuTheme(), 279 m_layermenu.reset(new LayerMenu(scr.menuTheme(),
301 scr.imageControl(), 280 scr.imageControl(),
302 *scr.layerManager(). 281 *scr.layerManager().
303 getLayer(ResourceLayer::MENU), 282 getLayer(LAYERMENU),
304 this, 283 this,
305 true)); 284 true));
306 m_layermenu->setLabel(_FB_XTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu")); 285 m_layermenu->setLabel(_FB_XTEXT(Slit, Layer, "Slit Layer", "Title of Slit Layer Menu"));
@@ -1116,7 +1095,7 @@ void Slit::setupMenu() {
1116 1095
1117 FbTk::RefCount<FbTk::Menu> placement_menu( new FbMenu(m_screen.menuTheme(), 1096 FbTk::RefCount<FbTk::Menu> placement_menu( new FbMenu(m_screen.menuTheme(),
1118 m_screen.imageControl(), 1097 m_screen.imageControl(),
1119 *m_screen.layerManager().getLayer(::ResourceLayer::MENU)) ); 1098 *m_screen.layerManager().getLayer(LAYERMENU)) );
1120 1099
1121 1100
1122 // setup base menu 1101 // setup base menu
@@ -1131,7 +1110,7 @@ void Slit::setupMenu() {
1131 if (screen().hasXinerama()) { 1110 if (screen().hasXinerama()) {
1132 m_xineramaheadmenu.reset( new XineramaHeadMenu<Slit>( 1111 m_xineramaheadmenu.reset( new XineramaHeadMenu<Slit>(
1133 screen().menuTheme(), screen(), screen().imageControl(), 1112 screen().menuTheme(), screen(), screen().imageControl(),
1134 *screen().layerManager().getLayer(::ResourceLayer::MENU), *this, 1113 *screen().layerManager().getLayer(LAYERMENU), *this,
1135 _FB_XTEXT(Slit, OnHead, "Slit on Head", "Title of Slits On Head menu")) ); 1114 _FB_XTEXT(Slit, OnHead, "Slit on Head", "Title of Slits On Head menu")) );
1136 m_slitmenu->insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), 1115 m_slitmenu->insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"),
1137 FbTk::RefCount<FbTk::Menu>(m_xineramaheadmenu)); 1116 FbTk::RefCount<FbTk::Menu>(m_xineramaheadmenu));
@@ -1169,32 +1148,32 @@ void Slit::setupMenu() {
1169 placement_menu->setLabel(_FB_XTEXT(Slit, Placement, "Slit Placement", "Slit Placement")); 1148 placement_menu->setLabel(_FB_XTEXT(Slit, Placement, "Slit Placement", "Slit Placement"));
1170 placement_menu->setMinimumColumns(3); 1149 placement_menu->setMinimumColumns(3);
1171 1150
1172 typedef pair<FbTk::FbString, Slit::Placement> PlacementP; 1151 typedef pair<FbTk::FbString, Placement> PlacementP;
1173 typedef list<PlacementP> Placements; 1152 typedef list<PlacementP> Placements;
1174 Placements place_menu; 1153 Placements place_menu;
1175 1154
1176 // menu is 3 wide, 5 down 1155 // menu is 3 wide, 5 down
1177 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Slit::TOPLEFT)); 1156 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), TOPLEFT));
1178 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), Slit::LEFTTOP)); 1157 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), LEFTTOP));
1179 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Slit::LEFTCENTER)); 1158 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), LEFTCENTER));
1180 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Slit::LEFTBOTTOM)); 1159 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), LEFTBOTTOM));
1181 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Slit::BOTTOMLEFT)); 1160 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), BOTTOMLEFT));
1182 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Slit::TOPCENTER)); 1161 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), TOPCENTER));
1183 place_menu.push_back(PlacementP("", Slit::TOPLEFT)); 1162 place_menu.push_back(PlacementP("", TOPLEFT));
1184 place_menu.push_back(PlacementP("", Slit::TOPLEFT)); 1163 place_menu.push_back(PlacementP("", TOPLEFT));
1185 place_menu.push_back(PlacementP("", Slit::TOPLEFT)); 1164 place_menu.push_back(PlacementP("", TOPLEFT));
1186 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Slit::BOTTOMCENTER)); 1165 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), BOTTOMCENTER));
1187 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Slit::TOPRIGHT)); 1166 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), TOPRIGHT));
1188 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), Slit::RIGHTTOP)); 1167 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), RIGHTTOP));
1189 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Slit::RIGHTCENTER)); 1168 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), RIGHTCENTER));
1190 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Slit::RIGHTBOTTOM)); 1169 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), RIGHTBOTTOM));
1191 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Slit::BOTTOMRIGHT)); 1170 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), BOTTOMRIGHT));
1192 1171
1193 1172
1194 // create items in sub menu 1173 // create items in sub menu
1195 for (size_t i=0; i<15; ++i) { 1174 for (size_t i=0; i<15; ++i) {
1196 const FbTk::FbString &str = place_menu.front().first; 1175 const FbTk::FbString &str = place_menu.front().first;
1197 Slit::Placement placement = place_menu.front().second; 1176 Placement placement = place_menu.front().second;
1198 1177
1199 if (str == "") { 1178 if (str == "") {
1200 placement_menu->insert(""); 1179 placement_menu->insert("");
@@ -1214,7 +1193,7 @@ void Slit::setupMenu() {
1214 1193
1215void Slit::moveToLayer(int layernum) { 1194void Slit::moveToLayer(int layernum) {
1216 m_layeritem->moveToLayer(layernum); 1195 m_layeritem->moveToLayer(layernum);
1217 *m_rc_layernum = static_cast<ResourceLayer::Type>(layernum); 1196 *m_rc_layernum = static_cast<LayerType>(layernum);
1218} 1197}
1219 1198
1220void Slit::saveOnHead(int head) { 1199void Slit::saveOnHead(int head) {