Bsongis/move everything (#3669)
* Directories moved * Directories moved * Directories moved * Directories moved * Directories moved * rename horus directories in gui to 480x272 * Directories moved * Rename taranis to 212x64 * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Fix x9e compile * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Directories moved - TARANIS target removed, it's now X9E / X9D+ / X9D * Minor improvement of path handling * Another bunch of files renamed :) * Another bunch of files renamed :) * Another bunch of files renamed :) * Another bunch of files renamed :) * Another bunch of files renamed :) * Rename 9x to 128x64 * Compilation fixes * Compilation fixes * Compilation fixes * Compilation fixes * Compilation fixes * Compilation fixes
This commit is contained in:
@@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) OpenTX
|
||||
*
|
||||
* Based on code named
|
||||
* th9x - http://code.google.com/p/th9x
|
||||
* er9x - http://code.google.com/p/er9x
|
||||
* gruvin9x - http://code.google.com/p/gruvin9x
|
||||
*
|
||||
* License GPLv2: http://www.gnu.org/licenses/gpl-2.0.html
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef _THEME_H_
|
||||
#define _THEME_H_
|
||||
|
||||
class BitmapBuffer;
|
||||
|
||||
#define MAX_THEME_OPTIONS 5
|
||||
|
||||
class Theme;
|
||||
void registerTheme(Theme * theme);
|
||||
|
||||
class Theme
|
||||
{
|
||||
public:
|
||||
struct PersistentData {
|
||||
ZoneOptionValue options[MAX_THEME_OPTIONS];
|
||||
};
|
||||
|
||||
Theme(const char * name, const ZoneOption * options=NULL):
|
||||
name(name),
|
||||
options(options),
|
||||
thumb(NULL)
|
||||
{
|
||||
registerTheme(this);
|
||||
}
|
||||
|
||||
inline const char * getName() const
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
const char * getFilePath(const char * filename) const;
|
||||
|
||||
void drawThumb(uint16_t x, uint16_t y, uint32_t flags);
|
||||
|
||||
inline const ZoneOption * getOptions() const
|
||||
{
|
||||
return options;
|
||||
}
|
||||
|
||||
void init() const;
|
||||
|
||||
virtual void update() const
|
||||
{
|
||||
}
|
||||
|
||||
ZoneOptionValue * getOptionValue(unsigned int index) const;
|
||||
|
||||
virtual void load() const;
|
||||
|
||||
virtual void drawBackground() const;
|
||||
|
||||
virtual void drawTopbarBackground(uint8_t icon) const = 0;
|
||||
|
||||
virtual void drawMenuIcon(uint8_t index, uint8_t position, bool selected) const { }
|
||||
|
||||
virtual void drawMessageBox(const char * title, const char * text, const char * action, uint32_t flags) const;
|
||||
|
||||
protected:
|
||||
const char * name;
|
||||
const ZoneOption * options;
|
||||
BitmapBuffer * thumb;
|
||||
static const BitmapBuffer * asterisk;
|
||||
static const BitmapBuffer * question;
|
||||
static const BitmapBuffer * busy;
|
||||
};
|
||||
|
||||
extern Theme * theme;
|
||||
|
||||
inline const char * getThemePath(const char * filename)
|
||||
{
|
||||
return theme->getFilePath(filename);
|
||||
}
|
||||
|
||||
#define MAX_REGISTERED_THEMES 10
|
||||
extern unsigned int countRegisteredThemes;
|
||||
void registerTheme(Theme * theme);
|
||||
extern Theme * registeredThemes[MAX_REGISTERED_THEMES]; // TODO dynamic
|
||||
|
||||
Theme * getTheme(const char * name);
|
||||
void loadTheme(Theme * theme);
|
||||
void loadTheme();
|
||||
|
||||
#endif // _THEME_H_
|
||||
Reference in New Issue
Block a user