137 lines
3.1 KiB
C++
137 lines
3.1 KiB
C++
#pragma once
|
|
/************************************************************************
|
|
MeOS - Orienteering Software
|
|
Copyright (C) 2009-2024 Melin Software HB
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
Melin Software HB - software@melin.nu - www.melin.nu
|
|
Eksoppsvägen 16, SE-75646 UPPSALA, Sweden
|
|
|
|
************************************************************************/
|
|
|
|
#include "Localizer.h"
|
|
#include "gdioutput.h"
|
|
|
|
|
|
class oBase;
|
|
class oRunner;
|
|
typedef oRunner * pRunner;
|
|
|
|
class oTeam;
|
|
typedef oTeam * pTeam;
|
|
|
|
class gdioutput;
|
|
class oEvent;
|
|
|
|
enum TabType {
|
|
TRunnerTab,
|
|
TTeamTab,
|
|
TClassTab,
|
|
TCourseTab,
|
|
TControlTab,
|
|
TSITab,
|
|
TListTab,
|
|
TCmpTab,
|
|
TSpeakerTab,
|
|
TClubTab,
|
|
TAutoTab,
|
|
};
|
|
|
|
class TabBase
|
|
{
|
|
protected:
|
|
oEvent *oe;
|
|
int tabId;
|
|
virtual void clearCompetitionData() = 0;
|
|
|
|
public:
|
|
oEvent *getEvent() const {return oe;}
|
|
int getTabId() const {return tabId;}
|
|
virtual bool loadPage(gdioutput &gdi) = 0;
|
|
|
|
virtual TabType getType() const = 0;
|
|
virtual const char *getTypeStr() const = 0;
|
|
|
|
TabBase(oEvent *poe) : oe(poe), tabId(0) {}
|
|
virtual ~TabBase()=0 {}
|
|
friend class TabObject;
|
|
friend class FixedTabs;
|
|
};
|
|
|
|
|
|
class TabObject
|
|
{
|
|
protected:
|
|
TabBase * const tab = nullptr;
|
|
|
|
public:
|
|
const string name;
|
|
const int imageId = -1;
|
|
int id = -1;
|
|
|
|
TabObject(TabBase *t, string n, int imageId) : name(n), tab(t), imageId(imageId) {}
|
|
|
|
void setId(int i){id=i; if (tab) tab->tabId=id;}
|
|
|
|
const type_info &getType() const {return typeid(*tab);}
|
|
const TabBase &getTab() const {return *tab;}
|
|
|
|
TabObject(const TabObject& t) = delete;
|
|
TabObject& operator=(TabObject& t) = delete;
|
|
~TabObject() = default;
|
|
|
|
bool loadPage(gdioutput &gdi);
|
|
};
|
|
|
|
class TabRunner;
|
|
class TabTeam;
|
|
class TabClass;
|
|
class TabCourse;
|
|
class TabControl;
|
|
class TabClub;
|
|
class TabSI;
|
|
class TabList;
|
|
class TabCompetition;
|
|
class TabSpeaker;
|
|
class TabAuto;
|
|
|
|
class FixedTabs {
|
|
oEvent *oe;
|
|
TabRunner *runnerTab;
|
|
TabTeam *teamTab;
|
|
TabClass *classTab;
|
|
TabCourse *courseTab;
|
|
TabControl *controlTab;
|
|
TabSI *siTab;
|
|
TabList *listTab;
|
|
TabCompetition *cmpTab;
|
|
TabSpeaker *speakerTab;
|
|
TabClub *clubTab;
|
|
TabAuto *autoTab;
|
|
|
|
vector<TabBase *> tabs;
|
|
public:
|
|
|
|
TabBase *get(TabType tag);
|
|
const vector<TabBase *> &getActiveTabs() const {return tabs;}
|
|
// Clean up competition specific data from user interface
|
|
void clearCompetitionData();
|
|
|
|
|
|
FixedTabs();
|
|
~FixedTabs();
|
|
};
|
|
|