OpenMoHAA 0.82.0
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 {
26public:
27 str title;
28 UColor highlightFGColor;
29 UColor highlightBGColor;
30 UColor FGColor;
31 UColor BGColor;
32 UIReggedMaterial *material;
33 UIReggedMaterial *selected_material;
35
36 uipull_describe();
37 uipull_describe( str title, UIReggedMaterial *material, UIReggedMaterial *selected_material );
38};
39
40inline
41uipull_describe::uipull_describe()
42{
43 title = "";
44 material = NULL;
45 selected_material = NULL;
46}
47
48inline
49uipull_describe::uipull_describe
50 (
51 str title,
52 UIReggedMaterial *material,
53 UIReggedMaterial *selected_material
54 )
55
56{
57 this->title = title;
58 this->material = material;
59 this->selected_material = selected_material;
60}
61
62class UIPulldownMenu : public UIWidget {
63protected:
65 Listener *m_listener;
66 int m_submenu;
67 UIPopupMenu *m_submenuptr;
68 UColor m_highlightBGColor;
69 UColor m_highlightFGColor;
70
71public:
72 CLASS_PROTOTYPE( UIPulldownMenu );
73
74protected:
75 UIRect2D getAlignmentRect( UIWidget *parent );
76 float getDescWidth( uipull_describe *desc );
77 float getDescHeight( uipull_describe *desc );
78 uipull_describe *getPulldown( str title );
79 void HighlightBGColor( Event *ev );
80 void HighlightFGColor( Event *ev );
81
82public:
83 UIPulldownMenu();
84 ~UIPulldownMenu();
85
86 void Create( UIWidget *parent, Listener *listener, const UIRect2D& rect );
87 void CreateAligned( UIWidget *parent, Listener *listener );
88 void MousePressed( Event *ev );
89 void MouseDragged( Event *ev );
90 void MouseReleased( Event *ev );
91 void ChildKilled( Event *ev );
92 void AddUIPopupDescribe( const char *title, uipopup_describe *d );
93 void setHighlightFGColor( UColor c );
94 void setHighlightBGColor( UColor c );
95 void setPopupHighlightFGColor( str menu, UColor c );
96 void setPopupHighlightBGColor( str menu, UColor c );
97 void setPopupFGColor( str menu, UColor c );
98 void setPopupBGColor( str menu, UColor c );
99 void setPulldownShader( const char *title, UIReggedMaterial *mat );
100 void setSelectedPulldownShader( const char *title, UIReggedMaterial *mat );
101 void Realign( void ) override;
102 void Draw( void ) override;
103};
Definition container.h:85
Definition listener.h:246
Definition ucolor.h:25
Definition uipopupmenu.h:85
Definition uirect2d.h:28
Definition uiwidget.h:35
Definition str.h:77
Definition uipopupmenu.h:28
Definition uipulldownmenu.h:25