ScummVM API documentation
WidgetComboBox.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22/*
23 * Copyright (C) 2006-2010 - Frictional Games
24 *
25 * This file is part of HPL1 Engine.
26 */
27
28#ifndef HPL_WIDGET_COMBO_BOX_H
29#define HPL_WIDGET_COMBO_BOX_H
30
31#include "hpl1/engine/gui/Widget.h"
32#include "hpl1/engine/gui/WidgetBaseClasses.h"
33
34namespace hpl {
35
36class cGuiSkinFont;
37
38class cWidgetTextBox;
39class cWidgetButton;
40class cWidgetSlider;
41
43public:
44 cWidgetComboBox(cGuiSet *apSet, cGuiSkin *apSkin);
45 virtual ~cWidgetComboBox();
46
47 void SetSelectedItem(int alX, bool abMoveList = false);
48 int GetSelectedItem() { return mlSelectedItem; }
49
50 void SetCanEdit(bool abX);
51 bool GetCanEdit();
52
53 void SetMaxShownItems(int alX);
54 int GetMaxShownItems() { return mlMaxItems; }
55
56protected:
58 // Own functions
59 void UpdateProperties();
60
61 void OpenMenu();
62 void CloseMenu();
63
64 bool ButtonPress(iWidget *apWidget, cGuiMessageData &aData);
65 kGuiCalllbackDeclarationEnd(ButtonPress);
66
67 bool DrawText(iWidget *apWidget, cGuiMessageData &aData);
68 kGuiCalllbackDeclarationEnd(DrawText);
69
70 bool SliderMove(iWidget *apWidget, cGuiMessageData &aData);
71 kGuiCalllbackDeclarationEnd(SliderMove);
72
73 bool SliderLostFocus(iWidget *apWidget, cGuiMessageData &aData);
74 kGuiCalllbackDeclarationEnd(SliderLostFocus);
75
77 // Implemented functions
78 void OnLoadGraphics();
79 void OnChangeSize();
80 void OnChangeText();
81 void OnInit();
82
83 void OnDraw(float afTimeStep, cGuiClipRegion *apClipRegion);
84
85 bool OnMouseMove(cGuiMessageData &aData);
86 bool OnMouseDown(cGuiMessageData &aData);
87 bool OnMouseUp(cGuiMessageData &aData);
88 bool OnMouseEnter(cGuiMessageData &aData);
89 bool OnMouseLeave(cGuiMessageData &aData);
90
91 bool OnLostFocus(cGuiMessageData &aData);
92
94 // Data
95 cWidgetTextBox *mpText;
96 cWidgetButton *mpButton;
97 cWidgetSlider *mpSlider;
98
99 bool mbMenuOpen;
100 float mfMenuHeight;
101
102 float mfButtonWidth;
103 float mfSliderWidth;
104
105 int mlMouseOverSelection;
106 int mlSelectedItem;
107 int mlFirstItem;
108 int mlMaxItems;
109 int mlItemsShown;
110
111 cGuiGfxElement *mpGfxBackground;
112
113 cGuiGfxElement *mpGfxSelection;
114
115 cGuiGfxElement *mvGfxBorders[4];
116 cGuiGfxElement *mvGfxCorners[4];
117};
118
119} // namespace hpl
120
121#endif // HPL_WIDGET_COMBO_BOX_H
Definition: GuiSet.h:96
Definition: GuiGfxElement.h:72
Definition: GuiSet.h:112
Definition: GuiSkin.h:59
Definition: WidgetButton.h:37
Definition: WidgetComboBox.h:42
Definition: WidgetSlider.h:41
Definition: WidgetTextBox.h:37
Definition: Widget.h:65
Definition: WidgetBaseClasses.h:37
Definition: GuiTypes.h:263