aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2002-01-20 02:15:23 (GMT)
committerfluxgen <fluxgen>2002-01-20 02:15:23 (GMT)
commitaaa0c6d0780ceb021a3306e2f0c3ae965541eff6 (patch)
treed7b6127d71a1295f83533d25bebfefbbccdc441b
parente1b1f375c6621ab5e51673216522526ad41b29fc (diff)
downloadfluxbox-aaa0c6d0780ceb021a3306e2f0c3ae965541eff6.zip
fluxbox-aaa0c6d0780ceb021a3306e2f0c3ae965541eff6.tar.bz2
Named enums
-rw-r--r--src/Tab.cc17
-rw-r--r--src/Tab.hh20
2 files changed, 18 insertions, 19 deletions
diff --git a/src/Tab.cc b/src/Tab.cc
index d05d7d5..3e00264 100644
--- a/src/Tab.cc
+++ b/src/Tab.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: Tab.cc,v 1.15 2002/01/18 18:28:17 pekdon Exp $ 22// $Id: Tab.cc,v 1.16 2002/01/20 02:15:23 fluxgen Exp $
23 23
24#include "Tab.hh" 24#include "Tab.hh"
25 25
@@ -29,6 +29,7 @@
29 29
30#include "i18n.hh" 30#include "i18n.hh"
31#include "DrawUtil.hh" 31#include "DrawUtil.hh"
32#include "Screen.hh"
32 33
33#include <iostream> 34#include <iostream>
34using namespace std; 35using namespace std;
@@ -1049,7 +1050,7 @@ unsigned int Tab::calcCenterYPos() {
1049// Returns the tabplacement string of the 1050// Returns the tabplacement string of the
1050// tabplacement number on success else 0. 1051// tabplacement number on success else 0.
1051//---------------------------------------- 1052//----------------------------------------
1052const char *Tab::getTabPlacementString(int placement) { 1053const char *Tab::getTabPlacementString(Tab::Placement placement) {
1053 for (int i=0; i<(PNONE / 5); i++) { 1054 for (int i=0; i<(PNONE / 5); i++) {
1054 if (m_tabplacementlist[i] == placement) 1055 if (m_tabplacementlist[i] == placement)
1055 return m_tabplacementlist[i].string; 1056 return m_tabplacementlist[i].string;
@@ -1062,10 +1063,10 @@ const char *Tab::getTabPlacementString(int placement) {
1062// tabplacement string on success else 1063// tabplacement string on success else
1063// the type none on failure. 1064// the type none on failure.
1064//---------------------------------------- 1065//----------------------------------------
1065int Tab::getTabPlacementNum(const char *string) { 1066Tab::Placement Tab::getTabPlacementNum(const char *string) {
1066 for (int i=0; i<(PNONE / 5); i ++) { 1067 for (int i=0; i<(PNONE / 5); i ++) {
1067 if (m_tabplacementlist[i] == string) { 1068 if (m_tabplacementlist[i] == string) {
1068 return m_tabplacementlist[i].tp; 1069 return static_cast<Tab::Placement>(m_tabplacementlist[i].tp);
1069 } 1070 }
1070 } 1071 }
1071 return PNONE; 1072 return PNONE;
@@ -1075,9 +1076,9 @@ int Tab::getTabPlacementNum(const char *string) {
1075// Returns the tabplacement string of the 1076// Returns the tabplacement string of the
1076// tabplacement number on success else 0. 1077// tabplacement number on success else 0.
1077//---------------------------------------- 1078//----------------------------------------
1078const char *Tab::getTabAlignmentString(int placement) { 1079const char *Tab::getTabAlignmentString(Tab::Alignment alignment) {
1079 for (int i=0; i<ANONE; i++) { 1080 for (int i=0; i<ANONE; i++) {
1080 if (m_tabalignmentlist[i] == placement) 1081 if (m_tabalignmentlist[i] == alignment)
1081 return m_tabalignmentlist[i].string; 1082 return m_tabalignmentlist[i].string;
1082 } 1083 }
1083 return 0; 1084 return 0;
@@ -1088,10 +1089,10 @@ const char *Tab::getTabAlignmentString(int placement) {
1088// tabplacement string on success else 1089// tabplacement string on success else
1089// the type none on failure. 1090// the type none on failure.
1090//---------------------------------------- 1091//----------------------------------------
1091int Tab::getTabAlignmentNum(const char *string) { 1092Tab::Alignment Tab::getTabAlignmentNum(const char *string) {
1092 for (int i=0; i<ANONE; i++) { 1093 for (int i=0; i<ANONE; i++) {
1093 if (m_tabalignmentlist[i] == string) { 1094 if (m_tabalignmentlist[i] == string) {
1094 return m_tabalignmentlist[i].tp; 1095 return static_cast<Tab::Alignment>(m_tabalignmentlist[i].tp);
1095 } 1096 }
1096 } 1097 }
1097 return ANONE; 1098 return ANONE;
diff --git a/src/Tab.hh b/src/Tab.hh
index a0e3737..02f0dbe 100644
--- a/src/Tab.hh
+++ b/src/Tab.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: Tab.hh,v 1.7 2002/01/18 18:28:17 pekdon Exp $ 22// $Id: Tab.hh,v 1.8 2002/01/20 02:15:23 fluxgen Exp $
23 23
24#ifndef _TAB_HH_ 24#ifndef _TAB_HH_
25#define _TAB_HH_ 25#define _TAB_HH_
@@ -27,9 +27,7 @@
27#ifndef _IMAGE_HH_ 27#ifndef _IMAGE_HH_
28#include "Image.hh" 28#include "Image.hh"
29#endif 29#endif
30#ifndef _SCREEN_HH_ 30
31#include "Screen.hh"
32#endif
33#ifndef _WINDOW_HH_ 31#ifndef _WINDOW_HH_
34#include "Window.hh" 32#include "Window.hh"
35#endif 33#endif
@@ -39,6 +37,9 @@
39 37
40class Tab { 38class Tab {
41public: 39public:
40 enum Placement{ PTOP = 0, PBOTTOM = 5, PLEFT = 10, PRIGHT = 15, PNONE = 20};
41 enum Alignment{ ALEFT = 0, ACENTER, ARIGHT, ARELATIVE, ANONE };
42
42 Tab(FluxboxWindow *win, Tab *prev=0, Tab *next=0); 43 Tab(FluxboxWindow *win, Tab *prev=0, Tab *next=0);
43 ~Tab(); 44 ~Tab();
44 void draw(bool pressed); 45 void draw(bool pressed);
@@ -70,14 +71,11 @@ public:
70 static Tab *getFirst(Tab *current); 71 static Tab *getFirst(Tab *current);
71 static Tab *getLast(Tab *current); 72 static Tab *getLast(Tab *current);
72 void disconnect(); 73 void disconnect();
73
74 enum { PTOP = 0, PBOTTOM = 5, PLEFT = 10, PRIGHT = 15, PNONE = 20};
75 enum { ALEFT = 0, ACENTER, ARIGHT, ARELATIVE, ANONE };
76 74
77 static const char *getTabPlacementString(int placement); 75 static const char *getTabPlacementString(Tab::Placement placement);
78 static int getTabPlacementNum(const char *string); 76 static Tab::Placement getTabPlacementNum(const char *string);
79 static const char *getTabAlignmentString(int placement); 77 static const char *getTabAlignmentString(Tab::Alignment alignment);
80 static int getTabAlignmentNum(const char *string); 78 static Tab::Alignment getTabAlignmentNum(const char *string);
81 //TODO: do these have to be public? 79 //TODO: do these have to be public?
82 void resizeGroup(void); // used when (un)shading windows 80 void resizeGroup(void); // used when (un)shading windows
83 void calcIncrease(void); 81 void calcIncrease(void);