summaryrefslogtreecommitdiff
path: root/src/gui/help.cpp
diff options
context:
space:
mode:
authorJosé Ávila <linux@javila.net>2005-06-03 06:18:17 +0000
committerJosé Ávila <linux@javila.net>2005-06-03 06:18:17 +0000
commitf73656a5f854bbde8aaf727c09d31a9215b1e041 (patch)
treeb83c18c82c62873ab34d854a4b3ab8ff10ba0c38 /src/gui/help.cpp
parentf4bab20b13d4b11522171b21b35d26ee43727206 (diff)
downloadmana-f73656a5f854bbde8aaf727c09d31a9215b1e041.tar.gz
mana-f73656a5f854bbde8aaf727c09d31a9215b1e041.tar.bz2
mana-f73656a5f854bbde8aaf727c09d31a9215b1e041.tar.xz
mana-f73656a5f854bbde8aaf727c09d31a9215b1e041.zip
Modification in help system
Diffstat (limited to 'src/gui/help.cpp')
-rw-r--r--src/gui/help.cpp33
1 files changed, 20 insertions, 13 deletions
diff --git a/src/gui/help.cpp b/src/gui/help.cpp
index 5b652f99..d1e13174 100644
--- a/src/gui/help.cpp
+++ b/src/gui/help.cpp
@@ -29,7 +29,6 @@ HelpWindow::HelpWindow():
Window("Help")
{
setContentSize(455, 350);
- setResizeable(true);
textBox = new TextBox();
textBox->setEditable(false);
@@ -48,11 +47,8 @@ HelpWindow::HelpWindow():
add(scrollArea);
add(okButton);
- //setLocationRelativeTo(getParent());
+ setLocationRelativeTo(getParent());
textBox->requestFocus();
-
- std::string defHelp = "index";
- loadHelp(defHelp);
}
HelpWindow::~HelpWindow()
@@ -66,16 +62,20 @@ HelpWindow::~HelpWindow()
void HelpWindow::action(const std::string& eventId)
{
- scheduleDelete();
+ setVisible(false);
}
void HelpWindow::mousePress(int mx, int my, int button)
{
- int x1 = scrollArea->getX() + 10;
- int y1 = scrollArea->getY() + 15;
- int x2 = x1 + scrollArea->getWidth() - 25;
- int y2 = y1 + scrollArea->getHeight();
+ getParent()->moveToTop(this);
+
if (button == gcn::MouseInput::LEFT) {
+
+ int x1 = scrollArea->getX() + 10;
+ int y1 = scrollArea->getY() + 15;
+ int x2 = x1 + scrollArea->getWidth() - 25;
+ int y2 = y1 + scrollArea->getHeight();
+
if ((mx >= x1) && (my >= y1) && (mx <= x2) && (my <= y2))
{
for (unsigned int i = 0; i < links.size(); i++)
@@ -85,14 +85,20 @@ void HelpWindow::mousePress(int mx, int my, int button)
int y2 = y1 + textBox->getFont()->getHeight();
if ((my > y1) && (my < y2)) {
std::string tmp = links[i].file;
- loadHelp(tmp);
+ loadHelp(links[i].file);
}
}
}
- }
+ else if (hasMouse() && my < (int)(getTitleBarHeight() + getPadding()))
+ {
+ mMouseDrag = true;
+ mMouseXOffset = mx;
+ mMouseYOffset = my;
+ }
+ }
}
-void HelpWindow::loadHelp(std::string& helpFile) {
+void HelpWindow::loadHelp(std::string helpFile) {
helpFile = TMW_DATADIR "data/help/" + helpFile + ".txt";
std::ifstream fin;
@@ -126,6 +132,7 @@ void HelpWindow::loadHelp(std::string& helpFile) {
textBox->addRow(line);
}
scrollArea->setVerticalScrollAmount(0);
+ setVisible(true);
fin.close();
}