OpenMoHAA 0.82.0
Loading...
Searching...
No Matches
uihorizscroll.h
1/*
2===========================================================================
3Copyright (C) 2015 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
25typedef enum {
26 VS_NONE,
27 VS_UP_ARROW,
28 VS_DOWN_ARROW,
29 VS_THUMB,
30 VS_PAGE_DOWN,
31 VS_PAGE_UP
32} whatspressed;
33
34class UIHorizScroll : public UIWidget
35{
36protected:
37 int m_numitems;
38 int m_pagewidth;
39 int m_topitem;
40 UIFont m_marlett;
41 whatspressed m_pressed;
42 UIRect2D thumbRect;
43
44 struct {
45 int itemOffset;
46 int orgItem;
47 } m_dragThumbState;
48
49 bool m_frameinitted;
50 UColor m_thumbcolor;
51 UColor m_solidbordercolor;
52
53public:
54 CLASS_PROTOTYPE(UIHorizScroll);
55
56protected:
57 int getItemFromWidth(float height);
58 bool isEnoughItems(void);
59
60public:
61 UIHorizScroll();
62
63 void Draw(void) override;
64 void DrawArrow(float top, const char *text, bool pressed);
65 void DrawThumb();
66 void MouseDown(Event *ev);
67 void MouseUp(Event *ev);
68 void MouseDragged(Event *ev);
69 void MouseEnter(Event *ev);
70 void MouseLeave(Event *ev);
71 void Scroll(Event *ev);
72 bool AttemptScrollTo(int to);
73 void setNumItems(int i);
74 void setPageWidth(int i);
75 void setTopItem(int i);
76 int getTopItem(void);
77 int getPageWidth(void);
78 int getNumItems(void);
79 void setThumbColor(const UColor& thumb);
80 void setSolidBorderColor(const UColor& col);
81 void InitFrameAlignRight(UIWidget *parent);
82};
Definition listener.h:246
Definition ucolor.h:25
Definition uifont.h:40
Definition uirect2d.h:28