Neo  0.5.0
Developer Documentation
ThemedInputField.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 (C) Yannick Pflanzer <neo-engine.de>
3  *
4  * This file is part of Neo2D.
5  *
6  * NeoGui is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Neo2D is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with Neo2D. If not, see <http://www.gnu.org/licenses/>.
18  *
19  * Diese Datei ist Teil von Neo2D.
20  *
21  * Neo2D ist Freie Software: Sie können es unter den Bedingungen
22  * der GNU Lesser General Public License, wie von der Free Software Foundation,
23  * Version 3 der Lizenz oder (nach Ihrer Wahl) jeder späteren
24  * veröffentlichten Version, weiterverbreiten und/oder modifizieren.
25  *
26  * Neo2D wird in der Hoffnung, dass es nützlich sein wird, aber
27  * OHNE JEDE GEWÄHRLEISTUNG, bereitgestellt; sogar ohne die implizite
28  * Gewährleistung der MARKTFÄHIGKEIT oder EIGNUNG FÜR EINEN BESTIMMTEN ZWECK.
29  * Siehe die GNU Lesser General Public License für weitere Details.
30  *
31  * Sie sollten eine Kopie der GNU Lesser General Public License zusammen mit diesem
32  * Programm erhalten haben. Wenn nicht, siehe <http://www.gnu.org/licenses/>.
33  */
34 
35 #ifndef __THEMED_INPUT_FIELD_H__
36 #define __THEMED_INPUT_FIELD_H__
37 
38 #include <InputField.h>
39 #include <Sprite.h>
40 #include <NeoEngine.h>
41 
42 namespace Neo2D
43 {
44 namespace Gui
45 {
46 
47 #define NUM_SPRITES 9
48 
55 class NEO2D_EXPORT ThemedInputField : public InputField
56 {
57  enum SPRITE_POS
58  {
59  BODY = 0,
60  TOP,
61  BOTTOM,
62  LEFT,
63  RIGHT,
64  TOP_LEFT,
65  TOP_RIGHT,
66  BOTTOM_LEFT,
67  BOTTOM_RIGHT
68  };
69 
70  Sprite* m_sprites[NUM_SPRITES];
71  Sprite* m_hoveredSprites[NUM_SPRITES];
72  Sprite* m_pressedSprites[NUM_SPRITES];
73 
74  float m_marginTop;
75  float m_marginSide;
76 
77  void loadSprites(Sprite* sprites[], const char* vert,
78  const char* hor, const char* body,
79  const char* edge);
80 
81  void drawSprites(Sprite* sprites[]);
82 public:
83  ThemedInputField(unsigned int x, unsigned int y, unsigned int width,
84  unsigned int height, const char* label);
85 
86  void draw(Vector2 offset);
87 };
88 }
89 }
90 #endif
Implements a simple pushable button that calls the specified callback. This implementation uses Sprit...
Definition: ThemedInputField.h:55
The Sprite class displays a texture on the screen.
Definition: Sprite.h:93
Implements a basic input field that takes keyboard input and delivers it to the program.
Definition: InputField.h:73
Definition: Vector2.h:31
Definition: Button.h:42