1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Benjamin Grauer |
---|
13 | co-programmer: ... |
---|
14 | */ |
---|
15 | |
---|
16 | #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI |
---|
17 | |
---|
18 | #include "glgui_inputline.h" |
---|
19 | |
---|
20 | namespace OrxGui |
---|
21 | { |
---|
22 | /** |
---|
23 | * standard constructor |
---|
24 | */ |
---|
25 | GLGuiInputLine::GLGuiInputLine () |
---|
26 | { |
---|
27 | this->init(); |
---|
28 | |
---|
29 | } |
---|
30 | |
---|
31 | |
---|
32 | /** |
---|
33 | * standard deconstructor |
---|
34 | */ |
---|
35 | GLGuiInputLine::~GLGuiInputLine() |
---|
36 | { |
---|
37 | } |
---|
38 | |
---|
39 | /** |
---|
40 | * initializes the GUI-element |
---|
41 | */ |
---|
42 | void GLGuiInputLine::init() |
---|
43 | { |
---|
44 | this->setClassID(CL_GLGUI_INPUTLINE, "GLGuiInputLine"); |
---|
45 | this->text.setParent2D(this); |
---|
46 | this->text.setFont("fonts/final_frontier.ttf", 20); |
---|
47 | |
---|
48 | this->setText("SUPERTEST"); |
---|
49 | this->setSize2D( this->text.getSize2D()); |
---|
50 | |
---|
51 | } |
---|
52 | |
---|
53 | void GLGuiInputLine::setText(const std::string& text) |
---|
54 | { |
---|
55 | this->text.setText(text); |
---|
56 | } |
---|
57 | |
---|
58 | void GLGuiInputLine::append(const std::string& appendText) |
---|
59 | { |
---|
60 | this->text.append(appendText); |
---|
61 | |
---|
62 | } |
---|
63 | |
---|
64 | void GLGuiInputLine::removeCharacters(unsigned int chars) |
---|
65 | { |
---|
66 | this->text.removeCharacters(chars); |
---|
67 | } |
---|
68 | |
---|
69 | |
---|
70 | |
---|
71 | /** |
---|
72 | * draws the GLGuiInputLine |
---|
73 | */ |
---|
74 | void GLGuiInputLine::draw() const |
---|
75 | { |
---|
76 | this->startDraw(); |
---|
77 | GLGuiWidget::draw(); |
---|
78 | |
---|
79 | this->frontMaterial().select(); |
---|
80 | glBegin(GL_QUADS); |
---|
81 | |
---|
82 | glTexCoord2i(0,0); glVertex2d(3, 3); |
---|
83 | glTexCoord2i(0,1); glVertex2d(3, this->getSizeY2D() - 3); |
---|
84 | glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 3, this->getSizeY2D() -3); |
---|
85 | glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 3, 3); |
---|
86 | |
---|
87 | glEnd(); |
---|
88 | this->endDraw(); |
---|
89 | } |
---|
90 | } |
---|