00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #include "mmsgui/additional/mmsinputcontrol.h"
00034 #include "mmsinfo/mmsinfo.h"
00035
00036 #define INPUTCONTROL_TEXTWIN "inputcontrol_textwin"
00037 #define INPUTCONTROL_TEXT "inputcontrol_text"
00038 #define INPUTCONTROL_SPRITE "inputcontrol_sprite"
00039 #define INPUTCONTROL_STEXT "inputcontrol_stext"
00040
00041 MMSInputControl::MMSInputControl(MMSWindow *window) {
00042 }
00043
00044 MMSInputControl::~MMSInputControl() {
00045 }
00046
00047 bool MMSInputControl::load(MMSWindow *parent, string dialogfile, MMSTheme *theme) {
00048 if (!MMSGUIControl::load(parent, dialogfile, theme)) {
00049
00050 if (parent) {
00051
00052
00053 this->window = this->dm->loadChildDialog((string)getPrefix() + "/share/disko/mmsgui/mmsinputcontrol.xml", theme);
00054 }
00055 }
00056
00057 if (!this->window)
00058 return false;
00059
00060
00061 this->inputcontrol_textwin = dynamic_cast<MMSWindow*>(this->window->findWindow(INPUTCONTROL_TEXTWIN));
00062 this->inputcontrol_text = dynamic_cast<MMSInputWidget*>(this->window->findWidget(INPUTCONTROL_TEXT));
00063 this->inputcontrol_sprite = dynamic_cast<MMSWindow*>(this->window->findWindow(INPUTCONTROL_SPRITE));
00064 this->inputcontrol_stext = dynamic_cast<MMSLabelWidget*>(this->window->findWidget(INPUTCONTROL_STEXT));
00065
00066
00067 if (this->inputcontrol_text) {
00068 this->inputcontrol_text->onBeforeChange->connect(sigc::mem_fun(this,&MMSInputControl::onBeforeChange));
00069 }
00070
00071 return true;
00072 }
00073
00074 bool MMSInputControl::onBeforeChange(MMSWidget *widget, string text, bool add, MMSFBRectangle rect) {
00075 if (add) {
00076 MMSFBRectangle r = this->inputcontrol_textwin->getGeometry();
00077 MMSFBRectangle rs = this->inputcontrol_sprite->getGeometry();
00078 this->inputcontrol_stext->setText(text);
00079 this->inputcontrol_sprite->moveTo(r.x + rect.x - rs.w / 2 + rect.w / 2, r.y + rect.y - rs.h / 2 + rect.h / 2);
00080 this->inputcontrol_sprite->show();
00081 }
00082
00083 return true;
00084 }