From 9139910e08e834d2c92b8bc9e99dce816c3da696 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 13 Nov 2012 01:41:40 +0300 Subject: Extend on screen keyboard button. New theme options: x - x position y - y position padding - button padding --- src/touchmanager.cpp | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) (limited to 'src/touchmanager.cpp') 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 } -- cgit v1.2.3-60-g2f50