OpenMoHAA 0.82.1
Loading...
Searching...
No Matches
uivertscroll.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
26{
27public:
28 int itemOffset;
29 int orgItem;
30};
31
32class UIVertScroll : public UIWidget
33{
34protected:
35 int m_numitems;
36 int m_pageheight;
37 int m_topitem;
38 UIFont m_marlett;
39 whatspressed m_pressed;
40 UIRect2D thumbRect;
41 unnamed_struct m_dragThumbState;
42 bool m_frameinitted;
43 UColor m_thumbcolor;
44 UColor m_solidbordercolor;
45
46public:
47 CLASS_PROTOTYPE(UIVertScroll);
48
49protected:
50 int getItemFromHeight(float height);
51 bool isEnoughItems(void);
52
53public:
54 UIVertScroll();
55
56 void Draw(void) override;
57 void DrawArrow(float top, const char *text, bool pressed);
58 void DrawThumb(void);
59 void MouseDown(Event *ev);
60 void MouseUp(Event *ev);
61 void MouseDragged(Event *ev);
62 void MouseEnter(Event *ev);
63 void MouseLeave(Event *ev);
64 void Scroll(Event *ev);
65 bool AttemptScrollTo(int to);
66 void setNumItems(int i);
67 void setPageHeight(int i);
68 void setTopItem(int i);
69 int getTopItem(void);
70 int getPageHeight(void);
71 int getNumItems(void);
72 void setThumbColor(const UColor& thumb);
73 void setSolidBorderColor(const UColor& col);
74 void InitFrameAlignRight(UIWidget *parent, float fWidthPadding, float fHeightPadding);
75 void FrameInitialized() override;
76};
Definition listener.h:246
Definition ucolor.h:26
Definition uifont.h:40
Definition uirect2d.h:29
Definition uivertscroll.h:26