Named enums
fluxgen fluxgen
2 files changed,
18 insertions(+),
19 deletions(-)
M
src/Tab.cc
→
src/Tab.cc
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ #endif // HAVE_CONFIG_H
#include "i18n.hh" #include "DrawUtil.hh" +#include "Screen.hh" #include <iostream> using namespace std;@@ -1049,7 +1050,7 @@ //------- getTabPlacementString ----------
// 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 @@ // Returns the tabplacement number of the
// 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<Tab::Placement>(m_tabplacementlist[i].tp); } } return PNONE;@@ -1075,9 +1076,9 @@ //------- getTabAlignmentString ----------
// 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<ANONE; i++) { - if (m_tabalignmentlist[i] == placement) + if (m_tabalignmentlist[i] == alignment) return m_tabalignmentlist[i].string; } return 0;@@ -1088,10 +1089,10 @@ // Returns the tabplacement number of the
// tabplacement string on success else // the type none on failure. //---------------------------------------- -int Tab::getTabAlignmentNum(const char *string) { +Tab::Alignment Tab::getTabAlignmentNum(const char *string) { for (int i=0; i<ANONE; i++) { if (m_tabalignmentlist[i] == string) { - return m_tabalignmentlist[i].tp; + return static_cast<Tab::Alignment>(m_tabalignmentlist[i].tp); } } return ANONE;
M
src/Tab.hh
→
src/Tab.hh
@@ -19,7 +19,7 @@ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// 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 @@ void motionNotifyEvent(XMotionEvent *me);
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);