OpenMoHAA 0.82.1
Loading...
Searching...
No Matches
uipulldownmenu.h
1/*
2===========================================================================
3Copyright (C) 2024 the OpenMoHAA team
4
5This file is part of OpenMoHAA source code.
6
7OpenMoHAA source code is free software; you can redistribute it
8and/or modify it under the terms of the GNU General Public License as
9published by the Free Software Foundation; either version 2 of the License,
10or (at your option) any later version.
11
12OpenMoHAA source code is distributed in the hope that it will be
13useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with OpenMoHAA source code; if not, write to the Free Software
19Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20===========================================================================
21*/
22
23#pragma once
24
25class uipull_describe
26{
27public:
28 str title;
29 UColor highlightFGColor;
30 UColor highlightBGColor;
31 UColor FGColor;
32 UColor BGColor;
33 UIReggedMaterial *material;
34 UIReggedMaterial *selected_material;
36
37 uipull_describe();
38 uipull_describe(str title, UIReggedMaterial *material, UIReggedMaterial *selected_material);
39};
40
41inline uipull_describe::uipull_describe()
42{
43 title = "";
44 material = NULL;
45 selected_material = NULL;
46}
47
48inline uipull_describe::uipull_describe(str title, UIReggedMaterial *material, UIReggedMaterial *selected_material)
49{
50 this->title = title;
51 this->material = material;
52 this->selected_material = selected_material;
53}
54
55class UIPulldownMenu : public UIWidget
56{
57protected:
59 Listener *m_listener;
60 int m_submenu;
61 UIPopupMenu *m_submenuptr;
62 UColor m_highlightBGColor;
63 UColor m_highlightFGColor;
64
65public:
66 CLASS_PROTOTYPE(UIPulldownMenu);
67
68protected:
69 UIRect2D getAlignmentRect(UIWidget *parent);
70 float getDescWidth(uipull_describe *desc);
71 float getDescHeight(uipull_describe *desc);
72 uipull_describe *getPulldown(str title);
73 void HighlightBGColor(Event *ev);
74 void HighlightFGColor(Event *ev);
75
76public:
77 UIPulldownMenu();
78 ~UIPulldownMenu();
79
80 void Create(UIWidget *parent, Listener *listener, const UIRect2D& rect);
81 void CreateAligned(UIWidget *parent, Listener *listener);
82 void MousePressed(Event *ev);
83 void MouseDragged(Event *ev);
84 void MouseReleased(Event *ev);
85 void ChildKilled(Event *ev);
86 void AddUIPopupDescribe(const char *title, uipopup_describe *d);
87 void setHighlightFGColor(UColor c);
88 void setHighlightBGColor(UColor c);
89 void setPopupHighlightFGColor(str menu, UColor c);
90 void setPopupHighlightBGColor(str menu, UColor c);
91 void setPopupFGColor(str menu, UColor c);
92 void setPopupBGColor(str menu, UColor c);
93 void setPulldownShader(const char *title, UIReggedMaterial *mat);
94 void setSelectedPulldownShader(const char *title, UIReggedMaterial *mat);
95 void Realign(void) override;
96 void Draw(void) override;
97};
Definition container.h:85
Definition listener.h:246
Definition ucolor.h:26
Definition uipopupmenu.h:89
Definition uirect2d.h:29
Definition uiwidget.h:36
Definition str.h:77
Definition uipopupmenu.h:41
Definition uipulldownmenu.h:26