ManaPlus
|
#include <theme.h>
Public Member Functions | |
Theme () | |
~Theme () | |
Skin * | load (const std::string &filename, const std::string &filename2, const bool full, const std::string &defaultPath) |
Skin * | loadSkinRect (ImageRect &image, const std::string &name, const std::string &name2, const int start, const int end) |
void | unload (Skin *const skin) |
void | updateAlpha () |
float | getMinimumOpacity () const |
const Color & | getColor (const ThemeColorIdT type, const unsigned int alpha) |
ThemeColorIdT | getIdByChar (const signed char c, bool &valid) const |
void | setMinimumOpacity (const float minimumOpacity) |
void | optionChanged (const std::string &name) |
void | loadRect (ImageRect &image, const std::string &name, const std::string &name2, const int start, const int end) |
Public Member Functions inherited from Palette | |
const Color & | getCharColor (const signed char c, bool &valid) const |
char | getColorChar (const int type) const |
Public Member Functions inherited from ConfigListener | |
ConfigListener () | |
virtual | ~ConfigListener () |
Static Public Member Functions | |
static void | prepareThemePath () |
static void | selectSkin () |
static std::string | getThemePath () |
static std::string | getThemeName () |
static void | fillSkinsList (StringVect &list) |
static void | fillFontsList (StringVect &list) |
static void | fillSoundsList (StringVect &list) |
static std::string | resolveThemePath (const std::string &path) |
static Image * | getImageFromTheme (const std::string &path) |
static ImageSet * | getImageSetFromTheme (const std::string &path, const int w, const int h) |
static ImageSet * | getImageSetFromThemeXml (const std::string &name, const std::string &name2, const int w, const int h) |
static Color | getProgressColor (const ProgressColorIdT type, const float progress) |
static void | unloadRect (const ImageRect &rect, const int start, const int end) |
static Image * | getImageFromThemeXml (const std::string &name, const std::string &name2) |
static ThemeInfo * | loadInfo (const std::string &themeName) |
Static Public Member Functions inherited from Palette | |
static void | advanceGradients () |
Private Types | |
typedef std::map< std::string, Skin * > | Skins |
typedef Skins::iterator | SkinIterator |
typedef std::vector< DyePalette * > | ProgressColors |
Private Member Functions | |
Skin * | readSkin (const std::string &filename0, const bool full) |
void | loadColors (std::string file) |
Static Private Member Functions | |
static bool | tryThemePath (const std::string &themePath) |
Private Attributes | |
Skins | mSkins |
float | mMinimumOpacity |
ProgressColors | mProgressColors |
Static Private Attributes | |
static std::string | mThemePath |
static std::string | mThemeName |
static std::string | mScreenDensity |
Additional Inherited Members | |
Static Public Attributes inherited from Palette | |
static const Color | BLACK = Color(0, 0, 0, 255) |
Protected Types inherited from Palette | |
typedef std::set< Palette * > | Palettes |
typedef std::vector< ColorElem > | Colors |
typedef std::map< unsigned char, int > | CharColors |
Protected Member Functions inherited from Palette | |
Palette (const int size) | |
virtual | ~Palette () |
void | advanceGradient () |
Protected Attributes inherited from Palette | |
int | mRainbowTime |
Colors | mColors |
CharColors | mCharColors |
std::vector< ColorElem * > | mGradVector |
Static Protected Attributes inherited from Palette | |
static const Color | RAINBOW_COLORS [7] |
static const int | RAINBOW_COLOR_COUNT = 7 |
static Palettes | mInstances |
|
private |
|
private |
|
private |
Theme::Theme | ( | ) |
Definition at line 78 of file theme.cpp.
References Configuration::addListener(), CAST_S32, CAST_SIZE, BeingType::CHAT, config, BeingFlag::GM, initDefaultThemePath(), Palette::mCharColors, and Palette::mColors.
Theme::~Theme | ( | ) |
Definition at line 147 of file theme.cpp.
References CHECKLISTENERS, config, delete_all(), mProgressColors, mSkins, and Configuration::removeListener().
|
static |
Definition at line 570 of file theme.cpp.
References branding, VirtFs::getFiles(), Configuration::getStringValue(), and VirtFs::permitLinks().
Referenced by FontsModel::FontsModel().
|
static |
Definition at line 564 of file theme.cpp.
References branding, VirtFs::getDirs(), and Configuration::getStringValue().
Referenced by ThemesModel::ThemesModel().
|
static |
Definition at line 578 of file theme.cpp.
References branding, VirtFs::enumerateFiles(), findCutLast(), FOR_EACH, VirtFs::freeList(), Configuration::getStringValue(), VirtFs::isDirectory(), and VirtFs::List::names.
Referenced by SoundsModel::SoundsModel().
|
inline |
Gets the color associated with the type. Sets the alpha channel before returning.
type | the color type requested |
alpha | alpha channel to use |
Definition at line 136 of file theme.h.
References Color::a, CAST_S32, CAST_SIZE, CAST_U32, Logger::log(), logger, and Palette::mColors.
Referenced by Game::addWatermark(), TextParticle::draw(), Being::drawSpeech(), TouchManager::drawText(), Widget2::getThemeCharColor(), Widget2::getThemeColor(), LocalPlayer::LocalPlayer(), Being::setSpeech(), and Being::updateColors().
ThemeColorIdT Theme::getIdByChar | ( | const signed char | c, |
bool & | valid | ||
) | const |
Definition at line 1075 of file theme.cpp.
References anonymous_namespace{libxml.cpp}::valid.
Referenced by Widget2::getThemeCharColor().
|
static |
Definition at line 655 of file theme.cpp.
References Loader::getImage().
Referenced by NpcDialog::createSkinControls(), Item::getImage(), TextCommand::loadImage(), PRAGMA45(), readSkin(), Desktop::setBestFittingWallpaper(), SkillData::setIcon(), Item::setId(), ActorSprite::setupSpriteDisplay(), TestLauncher::testBackend(), TestLauncher::testDraw(), TestLauncher::testFps2(), TestLauncher::testFps3(), and TestLauncher::testRescale().
|
static |
Definition at line 926 of file theme.cpp.
References Skin::getBorder(), getThemePath(), ImageRect::grid, load(), SkinParameter::name, theme, and unload().
Referenced by AvatarListBox::AvatarListBox(), Button::loadImage(), TouchManager::loadTouchItem(), ItemContainer::setCellBackgroundImage(), Window::setResizable(), and ShortcutContainer::ShortcutContainer().
|
static |
Definition at line 660 of file theme.cpp.
References Loader::getImageSet().
Referenced by EquipmentWindow::fillBoxes(), EquipmentWindow::fillDefault(), Button::loadImageSet(), ProgressIndicator::ProgressIndicator(), Gui::setUseCustomCursor(), and WindowMenu::WindowMenu().
|
static |
Definition at line 951 of file theme.cpp.
References Skin::getBorder(), Loader::getSubImageSet(), getThemePath(), ImageRect::grid, load(), SkinParameter::name, theme, and unload().
|
inline |
Get the minimum opacity allowed to skins.
Definition at line 124 of file theme.h.
References mMinimumOpacity.
Referenced by Button::updateAlpha(), CheckBox::updateAlpha(), DropDown::updateAlpha(), ListBox::updateAlpha(), ProgressBar::updateAlpha(), RadioButton::updateAlpha(), ScrollArea::updateAlpha(), SkillRectangleListBox::updateAlpha(), Slider::updateAlpha(), Tab::updateAlpha(), and TextField::updateAlpha().
|
static |
Definition at line 155 of file theme.cpp.
References CAST_S32, CAST_SIZE, DyePalette::getColor(), Logger::log(), logger, mProgressColors, theme, and Catch::toString().
Referenced by AvatarListBox::draw(), ProgressBar::ProgressBar(), AvatarListBox::safeDraw(), ProgressBar::setProgress(), and ProgressBar::setProgressPalette().
|
inlinestatic |
Definition at line 70 of file theme.h.
References mThemeName.
Referenced by Setup_Theme::Setup_Theme().
|
inlinestatic |
Definition at line 67 of file theme.h.
References mThemePath.
Referenced by BrowserBox::BrowserBox(), CheckBox::CheckBox(), Desktop::Desktop(), DropDown::DropDown(), Client::gameInit(), getImageFromThemeXml(), getImageSetFromThemeXml(), Button::init(), Label::init(), Tab::init(), ScrollArea::init(), ListBox::ListBox(), TouchManager::loadButtons(), loadRect(), loadSkinRect(), Pincode::Pincode(), Popup::Popup(), ProgressBar::ProgressBar(), RadioButton::RadioButton(), SkillRectangleListBox::SkillRectangleListBox(), StaticBrowserBox::StaticBrowserBox(), TestLauncher::testDraw(), TextPreview::TextPreview(), and Window::Window().
Skin * Theme::load | ( | const std::string & | filename, |
const std::string & | filename2, | ||
const bool | full, | ||
const std::string & | defaultPath | ||
) |
Loads a skin.
Definition at line 179 of file theme.cpp.
References findCutLast(), Logger::log(), logger, mScreenDensity, mSkins, readSkin(), and strprintf().
Referenced by BrowserBox::BrowserBox(), CheckBox::CheckBox(), Desktop::Desktop(), DropDown::DropDown(), Client::gameInit(), getImageFromThemeXml(), getImageSetFromThemeXml(), Button::init(), Label::init(), Tab::init(), ScrollArea::init(), ListBox::ListBox(), TouchManager::loadButtons(), Pincode::Pincode(), Popup::Popup(), ProgressBar::ProgressBar(), RadioButton::RadioButton(), SkillRectangleListBox::SkillRectangleListBox(), StaticBrowserBox::StaticBrowserBox(), TestLauncher::testDraw(), TextPreview::TextPreview(), and Window::Window().
|
private |
Definition at line 791 of file theme.cpp.
References CAST_S32, CAST_SIZE, Resource::decRef(), findLast(), for_each_xml_child_node, XML::getProperty(), Loader::getXml(), Logger::log(), logger, anonymous_namespace{palettedb.cpp}::mColors, pathJoin(), readColor(), readColorGradient(), readColorType(), readProgressType(), XML::Document::rootNode(), SkipError_false, THEME_PALETTES, and UseVirtFs_true.
Referenced by prepareThemePath(), and tryThemePath().
|
static |
Definition at line 1006 of file theme.cpp.
References boldFont, Resource::decRef(), defaultThemePath, for_each_xml_child_node, Loader::getXml(), Actions::info(), Logger::log(), logger, SkinParameter::name, pathJoin(), readFloatValue, readIntValue, readValue, XML::Document::rootNode(), SkipError_false, and UseVirtFs_true.
Referenced by Setup_Theme::updateInfo().
void Theme::loadRect | ( | ImageRect & | image, |
const std::string & | name, | ||
const std::string & | name2, | ||
const int | start, | ||
const int | end | ||
) |
Definition at line 883 of file theme.cpp.
References getThemePath(), AvatarDB::load(), loadGrid, SkinParameter::name, and Net::unload().
Referenced by DropDown::DropDown(), Slider::init(), ScrollArea::init(), EquipmentWindow::postInit(), ProgressBar::ProgressBar(), and Text::Text().
Skin * Theme::loadSkinRect | ( | ImageRect & | image, |
const std::string & | name, | ||
const std::string & | name2, | ||
const int | start, | ||
const int | end | ||
) |
Definition at line 900 of file theme.cpp.
References getThemePath(), AvatarDB::load(), loadGrid, and SkinParameter::name.
Referenced by PlayerBox::init(), TouchManager::loadTouchItem(), and TextField::TextField().
|
virtual |
Called when an option changed. The config listener will have to be registered to the option name first.
Implements ConfigListener.
Definition at line 291 of file theme.cpp.
References updateAlpha().
|
static |
Definition at line 604 of file theme.cpp.
References branding, config, Configuration::getStringValue(), initDefaultThemePath(), loadColors(), Logger::log(), logger, and theme.
|
private |
Definition at line 394 of file theme.cpp.
References Resource::decRef(), VirtFs::exists(), for_each_xml_child_node, getImageFromTheme(), XML::getProperty(), Loader::getXml(), SkinHelper::height, SkinHelper::image, imageParam, SkinHelper::loadList(), Logger::log(), Logger::log1(), logger, anonymous_namespace{itemoptiondb.cpp}::mOptions, SkinParameter::name, SkinHelper::partType, SkinHelper::rect, XML::Document::rootNode(), skinParam, SkipError_true, Skin::updateAlpha(), UseVirtFs_true, SkinHelper::width, SkinHelper::xPos, and SkinHelper::yPos.
Referenced by load().
|
static |
Returns the patch to the given gui resource relative to the theme or, if it isn't in the theme, relative to 'graphics/gui'.
Definition at line 627 of file theme.cpp.
References branding, CAST_S32, VirtFs::exists(), Configuration::getStringValue(), and pathJoin().
Referenced by ActorSprite::initTargetCursor().
|
static |
Definition at line 598 of file theme.cpp.
References GraphicsManager::getDensityString(), and graphicsManager.
Referenced by Client::gameInit().
void Theme::setMinimumOpacity | ( | const float | minimumOpacity | ) |
Set the minimum opacity allowed to skins. Set a negative value to free the minimum allowed.
Definition at line 272 of file theme.cpp.
References mMinimumOpacity, and updateAlpha().
|
staticprivate |
Definition at line 546 of file theme.cpp.
References defaultThemePath, VirtFs::exists(), loadColors(), and theme.
void Theme::unload | ( | Skin *const | skin | ) |
Definition at line 250 of file theme.cpp.
References Skin::instances, and mSkins.
Referenced by DropDown::DropDown(), getImageFromThemeXml(), getImageSetFromThemeXml(), ScrollArea::init(), TouchManager::loadButtons(), TouchManager::loadTouchItem(), BrowserBox::~BrowserBox(), Button::~Button(), CheckBox::~CheckBox(), Desktop::~Desktop(), DropDown::~DropDown(), ItemContainer::~ItemContainer(), Label::~Label(), ListBox::~ListBox(), Pincode::~Pincode(), Popup::~Popup(), ProgressBar::~ProgressBar(), RadioButton::~RadioButton(), StaticBrowserBox::~StaticBrowserBox(), Tab::~Tab(), TextField::~TextField(), TextPreview::~TextPreview(), Window::~Window(), and WindowMenu::~WindowMenu().
|
static |
Definition at line 915 of file theme.cpp.
References ImageRect::grid, and anonymous_namespace{stringutils.cpp}::start.
Referenced by TouchManager::unload(), DropDown::~DropDown(), PlayerBox::~PlayerBox(), ProgressBar::~ProgressBar(), ScrollArea::~ScrollArea(), Slider::~Slider(), and TextField::~TextField().
void Theme::updateAlpha | ( | ) |
Updates the alpha values of all of the skins.
Definition at line 281 of file theme.cpp.
References FOR_EACH, mMinimumOpacity, mSkins, and Skin::updateAlpha().
Referenced by optionChanged(), and setMinimumOpacity().
|
private |
Tells if the current skins opacity should not get less than the given value
Definition at line 206 of file theme.h.
Referenced by getMinimumOpacity(), setMinimumOpacity(), and updateAlpha().
|
private |
Definition at line 209 of file theme.h.
Referenced by getProgressColor(), and ~Theme().
|
staticprivate |
|
private |
|
staticprivate |
Definition at line 195 of file theme.h.
Referenced by getThemeName().
|
staticprivate |
Definition at line 194 of file theme.h.
Referenced by getThemePath().