From b78ffa704acba9155893c488912e7458734ccabe Mon Sep 17 00:00:00 2001 From: Maarten ter Huurne Date: Mon, 26 Jul 2010 05:24:55 +0200 Subject: [PATCH] Converted public fields of Touchscreen to private. --- src/gmenu2x.cpp | 9 ++++++--- src/inputdialog.cpp | 3 ++- src/touchscreen.h | 8 +++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gmenu2x.cpp b/src/gmenu2x.cpp index d78b4ca..9e99447 100644 --- a/src/gmenu2x.cpp +++ b/src/gmenu2x.cpp @@ -1332,10 +1332,12 @@ void GMenu2X::contextMenu() { if (ts.released()) { if (!ts.inRect(box)) close = true; - else if (ts.x>=selbox.x && ts.x<=selbox.x+selbox.w) + else if (ts.getX() >= selbox.x + && ts.getX() <= selbox.x + selbox.w) for (i=0; i=selbox.y && ts.y<=selbox.y+selbox.h) { + if (ts.getY() >= selbox.y + && ts.getY() <= selbox.y + selbox.h) { voices[i].action(); close = true; i = voices.size(); @@ -1344,7 +1346,8 @@ void GMenu2X::contextMenu() { } else if (ts.pressed() && ts.inRect(box)) { for (i=0; i=selbox.y && ts.y<=selbox.y+selbox.h) { + if (ts.getY() >= selbox.y + && ts.getY() <= selbox.y + selbox.h) { sel = i; i = voices.size(); } diff --git a/src/inputdialog.cpp b/src/inputdialog.cpp index bb4fcb4..17bc5e3 100644 --- a/src/inputdialog.cpp +++ b/src/inputdialog.cpp @@ -299,8 +299,9 @@ int InputDialog::drawVirtualKeyboard() { gmenu2x->s->write(gmenu2x->font, gmenu2x->tr["OK"], (int)(160+kbLength*KEY_WIDTH/4), KB_TOP+kb->size()*KEY_HEIGHT+KEY_HEIGHT/2, SFontHAlignCenter, SFontVAlignMiddle); //if ts released - if (gmenu2x->f200 && gmenu2x->ts.wasPressed && !gmenu2x->ts.pressed() && gmenu2x->ts.inRect(kbRect)) + if (gmenu2x->f200 && gmenu2x->ts.released() && gmenu2x->ts.inRect(kbRect)) { action = ID_ACTION_SELECT; + } return action; } diff --git a/src/touchscreen.h b/src/touchscreen.h index dc53cf9..92d19f4 100644 --- a/src/touchscreen.h +++ b/src/touchscreen.h @@ -40,13 +40,12 @@ private: bool calibrated, _handled; TS_EVENT event; int calibX, calibY; + int x, y, startX, startY; + bool wasPressed; void calibrate(/*TS_EVENT event*/); public: - int x,y, startX,startY; - bool wasPressed; - Touchscreen(); ~Touchscreen(); @@ -65,6 +64,9 @@ public: bool inRect(int x, int y, int w, int h); bool startedInRect(SDL_Rect r); bool startedInRect(int x, int y, int w, int h); + + int getX() { return x; } + int getY() { return y; } }; #endif