From aaa0c6d0780ceb021a3306e2f0c3ae965541eff6 Mon Sep 17 00:00:00 2001 From: fluxgen Date: Sun, 20 Jan 2002 02:15:23 +0000 Subject: Named enums --- src/Tab.cc | 17 +++++++++-------- src/Tab.hh | 20 +++++++++----------- 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Tab.cc,v 1.15 2002/01/18 18:28:17 pekdon Exp $ +// $Id: Tab.cc,v 1.16 2002/01/20 02:15:23 fluxgen Exp $ #include "Tab.hh" @@ -29,6 +29,7 @@ #include "i18n.hh" #include "DrawUtil.hh" +#include "Screen.hh" #include using namespace std; @@ -1049,7 +1050,7 @@ unsigned int Tab::calcCenterYPos() { // Returns the tabplacement string of the // tabplacement number on success else 0. //---------------------------------------- -const char *Tab::getTabPlacementString(int placement) { +const char *Tab::getTabPlacementString(Tab::Placement placement) { for (int i=0; i<(PNONE / 5); i++) { if (m_tabplacementlist[i] == placement) return m_tabplacementlist[i].string; @@ -1062,10 +1063,10 @@ const char *Tab::getTabPlacementString(int placement) { // tabplacement string on success else // the type none on failure. //---------------------------------------- -int Tab::getTabPlacementNum(const char *string) { +Tab::Placement Tab::getTabPlacementNum(const char *string) { for (int i=0; i<(PNONE / 5); i ++) { if (m_tabplacementlist[i] == string) { - return m_tabplacementlist[i].tp; + return static_cast(m_tabplacementlist[i].tp); } } return PNONE; @@ -1075,9 +1076,9 @@ int Tab::getTabPlacementNum(const char *string) { // Returns the tabplacement string of the // tabplacement number on success else 0. //---------------------------------------- -const char *Tab::getTabAlignmentString(int placement) { +const char *Tab::getTabAlignmentString(Tab::Alignment alignment) { for (int i=0; i(m_tabalignmentlist[i].tp); } } 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 @@ // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. -// $Id: Tab.hh,v 1.7 2002/01/18 18:28:17 pekdon Exp $ +// $Id: Tab.hh,v 1.8 2002/01/20 02:15:23 fluxgen Exp $ #ifndef _TAB_HH_ #define _TAB_HH_ @@ -27,9 +27,7 @@ #ifndef _IMAGE_HH_ #include "Image.hh" #endif -#ifndef _SCREEN_HH_ -#include "Screen.hh" -#endif + #ifndef _WINDOW_HH_ #include "Window.hh" #endif @@ -39,6 +37,9 @@ class Tab { public: + enum Placement{ PTOP = 0, PBOTTOM = 5, PLEFT = 10, PRIGHT = 15, PNONE = 20}; + enum Alignment{ ALEFT = 0, ACENTER, ARIGHT, ARELATIVE, ANONE }; + Tab(FluxboxWindow *win, Tab *prev=0, Tab *next=0); ~Tab(); void draw(bool pressed); @@ -70,14 +71,11 @@ public: static Tab *getFirst(Tab *current); static Tab *getLast(Tab *current); void disconnect(); - - enum { PTOP = 0, PBOTTOM = 5, PLEFT = 10, PRIGHT = 15, PNONE = 20}; - enum { ALEFT = 0, ACENTER, ARIGHT, ARELATIVE, ANONE }; - static const char *getTabPlacementString(int placement); - static int getTabPlacementNum(const char *string); - static const char *getTabAlignmentString(int placement); - static int getTabAlignmentNum(const char *string); + static const char *getTabPlacementString(Tab::Placement placement); + static Tab::Placement getTabPlacementNum(const char *string); + static const char *getTabAlignmentString(Tab::Alignment alignment); + static Tab::Alignment getTabAlignmentNum(const char *string); //TODO: do these have to be public? void resizeGroup(void); // used when (un)shading windows void calcIncrease(void); -- cgit v0.11.2