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