OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
cl_uigmbox.h
1/*
2===========================================================================
3Copyright (C) 2015-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
25static constexpr unsigned int GMBOX_ITEM_FLAG_BOLD = 1u;
26
27class UIGMBox : public UIWidget {
28 struct item_t {
29 str string;
30 UColor color;
31 UIFont* font;
32 int flags;
33 };
34
35protected:
36 item_t m_items[ 5 ];
37 int m_numitems;
38 bool m_reallyshown;
39 class UIFont *m_fontbold;
40 bool m_boxmovingout;
41 boxstate_t m_boxstate;
42 int m_boxtime;
43 int m_movespeed;
44 int m_iBeginDecay;
45 int m_iEndDecay;
46 // Added in OPM
47 bool m_drawoutline;
48
49public:
50 CLASS_PROTOTYPE( UIGMBox );
51
52protected:
53 void VerifyBoxOut( void );
54 void ChangeBoxState( boxstate_t state );
55 void HandleBoxMoving( void );
56 void PostMoveinEvent( void );
57 void PostDecayEvent( void );
58 void setShowState( void );
59 void RemoveTopItem( void );
60 str CalculateBreaks( UIFont *font, str text, float max_width );
61 float PrintWrap( UIFont *font, float x, float y, str text );
62 float DrawItem( item_t *in, float x, float y, float alpha );
63
64public:
65 UIGMBox();
66
67 void Print( const char *text );
68 void OnSizeChanged( Event *ev );
69 void Create( const UIRect2D& rect, const UColor& fore, const UColor& back, float alpha );
70 void MoveInEvent( Event *ev );
71 void DecayEvent( Event *ev );
72 void Draw( void ) override;
73 void setRealShow( bool b );
74 void Clear( void );
75};
Definition listener.h:246
Definition ucolor.h:25
Definition uifont.h:40
Definition uirect2d.h:28
Definition str.h:77
Definition puff.c:88