Named enums
This commit is contained in:
parent
e1b1f375c6
commit
aaa0c6d078
2 changed files with 18 additions and 19 deletions
17
src/Tab.cc
17
src/Tab.cc
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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"
|
#include "Tab.hh"
|
||||||
|
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
#include "i18n.hh"
|
#include "i18n.hh"
|
||||||
#include "DrawUtil.hh"
|
#include "DrawUtil.hh"
|
||||||
|
#include "Screen.hh"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -1049,7 +1050,7 @@ unsigned int Tab::calcCenterYPos() {
|
||||||
// Returns the tabplacement string of the
|
// Returns the tabplacement string of the
|
||||||
// tabplacement number on success else 0.
|
// 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++) {
|
for (int i=0; i<(PNONE / 5); i++) {
|
||||||
if (m_tabplacementlist[i] == placement)
|
if (m_tabplacementlist[i] == placement)
|
||||||
return m_tabplacementlist[i].string;
|
return m_tabplacementlist[i].string;
|
||||||
|
@ -1062,10 +1063,10 @@ const char *Tab::getTabPlacementString(int placement) {
|
||||||
// tabplacement string on success else
|
// tabplacement string on success else
|
||||||
// the type none on failure.
|
// 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 ++) {
|
for (int i=0; i<(PNONE / 5); i ++) {
|
||||||
if (m_tabplacementlist[i] == string) {
|
if (m_tabplacementlist[i] == string) {
|
||||||
return m_tabplacementlist[i].tp;
|
return static_cast<Tab::Placement>(m_tabplacementlist[i].tp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return PNONE;
|
return PNONE;
|
||||||
|
@ -1075,9 +1076,9 @@ int Tab::getTabPlacementNum(const char *string) {
|
||||||
// Returns the tabplacement string of the
|
// Returns the tabplacement string of the
|
||||||
// tabplacement number on success else 0.
|
// 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++) {
|
for (int i=0; i<ANONE; i++) {
|
||||||
if (m_tabalignmentlist[i] == placement)
|
if (m_tabalignmentlist[i] == alignment)
|
||||||
return m_tabalignmentlist[i].string;
|
return m_tabalignmentlist[i].string;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1088,10 +1089,10 @@ const char *Tab::getTabAlignmentString(int placement) {
|
||||||
// tabplacement string on success else
|
// tabplacement string on success else
|
||||||
// the type none on failure.
|
// 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++) {
|
for (int i=0; i<ANONE; i++) {
|
||||||
if (m_tabalignmentlist[i] == string) {
|
if (m_tabalignmentlist[i] == string) {
|
||||||
return m_tabalignmentlist[i].tp;
|
return static_cast<Tab::Alignment>(m_tabalignmentlist[i].tp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ANONE;
|
return ANONE;
|
||||||
|
|
20
src/Tab.hh
20
src/Tab.hh
|
@ -19,7 +19,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// 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_
|
#ifndef _TAB_HH_
|
||||||
#define _TAB_HH_
|
#define _TAB_HH_
|
||||||
|
@ -27,9 +27,7 @@
|
||||||
#ifndef _IMAGE_HH_
|
#ifndef _IMAGE_HH_
|
||||||
#include "Image.hh"
|
#include "Image.hh"
|
||||||
#endif
|
#endif
|
||||||
#ifndef _SCREEN_HH_
|
|
||||||
#include "Screen.hh"
|
|
||||||
#endif
|
|
||||||
#ifndef _WINDOW_HH_
|
#ifndef _WINDOW_HH_
|
||||||
#include "Window.hh"
|
#include "Window.hh"
|
||||||
#endif
|
#endif
|
||||||
|
@ -39,6 +37,9 @@
|
||||||
|
|
||||||
class Tab {
|
class Tab {
|
||||||
public:
|
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(FluxboxWindow *win, Tab *prev=0, Tab *next=0);
|
||||||
~Tab();
|
~Tab();
|
||||||
void draw(bool pressed);
|
void draw(bool pressed);
|
||||||
|
@ -70,14 +71,11 @@ public:
|
||||||
static Tab *getFirst(Tab *current);
|
static Tab *getFirst(Tab *current);
|
||||||
static Tab *getLast(Tab *current);
|
static Tab *getLast(Tab *current);
|
||||||
void disconnect();
|
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 const char *getTabPlacementString(Tab::Placement placement);
|
||||||
static int getTabPlacementNum(const char *string);
|
static Tab::Placement getTabPlacementNum(const char *string);
|
||||||
static const char *getTabAlignmentString(int placement);
|
static const char *getTabAlignmentString(Tab::Alignment alignment);
|
||||||
static int getTabAlignmentNum(const char *string);
|
static Tab::Alignment getTabAlignmentNum(const char *string);
|
||||||
//TODO: do these have to be public?
|
//TODO: do these have to be public?
|
||||||
void resizeGroup(void); // used when (un)shading windows
|
void resizeGroup(void); // used when (un)shading windows
|
||||||
void calcIncrease(void);
|
void calcIncrease(void);
|
||||||
|
|
Loading…
Reference in a new issue