diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-11-13 01:41:40 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-11-13 01:43:11 +0300 |
commit | 9139910e08e834d2c92b8bc9e99dce816c3da696 (patch) | |
tree | ff265f9f86c813f20adcce7bca5762472e55bc23 | |
parent | 0dc9fd5199358037b0eff99d06afc7a6b4ac114f (diff) | |
download | manaplus-9139910e08e834d2c92b8bc9e99dce816c3da696.tar.gz manaplus-9139910e08e834d2c92b8bc9e99dce816c3da696.tar.bz2 manaplus-9139910e08e834d2c92b8bc9e99dce816c3da696.tar.xz manaplus-9139910e08e834d2c92b8bc9e99dce816c3da696.zip |
Extend on screen keyboard button.
New theme options:
x - x position
y - y position
padding - button padding
-rw-r--r-- | data/graphics/gui/keyboard_icon.xml | 4 | ||||
-rw-r--r-- | src/touchmanager.cpp | 27 | ||||
-rw-r--r-- | src/touchmanager.h | 1 |
3 files changed, 26 insertions, 6 deletions
diff --git a/data/graphics/gui/keyboard_icon.xml b/data/graphics/gui/keyboard_icon.xml index 5b84f50b2..4b157ef10 100644 --- a/data/graphics/gui/keyboard_icon.xml +++ b/data/graphics/gui/keyboard_icon.xml @@ -1,5 +1,9 @@ <skinset name="Default" image="window.png"> <widget type="Window"> + <option name="padding" value="5" /> + <option name="x" value="10" /> + <option name="y" value="10" /> + <part type="standart" xpos="168" ypos="220" width="28" height="28" /> </widget> </skinset> diff --git a/src/touchmanager.cpp b/src/touchmanager.cpp index 0278b9ddb..c2fd1ff00 100644 --- a/src/touchmanager.cpp +++ b/src/touchmanager.cpp @@ -41,11 +41,28 @@ TouchManager::~TouchManager() void TouchManager::init() { #ifdef ANDROID - Image *image = Theme::getImageFromThemeXml("keyboard_icon.xml", ""); - TouchItem *keyboard = new TouchItem(gcn::Rectangle(10, 10, - image->getWidth(), image->getHeight()), image, 10, 10, - nullptr, nullptr, &showKeyboard); - mObjects.push_back(keyboard); + Theme *theme = Theme::instance(); + if (!theme) + return; + Skin *skin = theme->load("keyboard_icon.xml", ""); + if (skin) + { + const ImageRect &images = skin->getBorder(); + Image *image = images.grid[0]; + if (image) + { + image->incRef(); + const int x = skin->getOption("x", 10); + const int y = skin->getOption("y", 10); + const int pad = skin->getPadding(); + const int pad2 = 2 * pad; + TouchItem *keyboard = new TouchItem(gcn::Rectangle(x, y, + image->getWidth() + pad2, image->getHeight() + pad2), + image, x + pad, y + pad, nullptr, nullptr, &showKeyboard); + mObjects.push_back(keyboard); + } + theme->unload(skin); + } #endif } diff --git a/src/touchmanager.h b/src/touchmanager.h index c37a1aeae..97d7d5625 100644 --- a/src/touchmanager.h +++ b/src/touchmanager.h @@ -82,7 +82,6 @@ class TouchManager final private: TouchItemVector mObjects; - // std::map <std::string, int> mNameToRect; }; |