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