Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
scroll.h
1 // * This file is part of the COLOBOT source code
2 // * Copyright (C) 2001-2008, Daniel ROUX & EPSITEC SA, www.epsitec.ch
3 // * Copyright (C) 2012, Polish Portal of Colobot (PPC)
4 // *
5 // * This program is free software: you can redistribute it and/or modify
6 // * it under the terms of the GNU General Public License as published by
7 // * the Free Software Foundation, either version 3 of the License, or
8 // * (at your option) any later version.
9 // *
10 // * This program is distributed in the hope that it will be useful,
11 // * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // * GNU General Public License for more details.
14 // *
15 // * You should have received a copy of the GNU General Public License
16 // * along with this program. If not, see http://www.gnu.org/licenses/.
17 
18 // scroll.h
19 
20 #pragma once
21 
22 
23 #include "common/event.h"
24 
25 #include "ui/control.h"
26 
27 namespace Ui {
28 
29 class CButton;
30 
31 const float SCROLL_WIDTH = (15.0f/640.0f);
32 
33 
34 
35 class CScroll : public CControl
36 {
37 public:
38  CScroll();
39  ~CScroll();
40 
41  bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
42 
43  void SetPos(Math::Point pos);
44  void SetDim(Math::Point dim);
45 
46  bool SetState(int state, bool bState);
47  bool SetState(int state);
48  bool ClearState(int state);
49 
50  bool EventProcess(const Event &event);
51  void Draw();
52 
53  void SetVisibleValue(float value);
54  float GetVisibleValue();
55 
56  void SetVisibleRatio(float value);
57  float GetVisibleRatio();
58 
59  void SetArrowStep(float step);
60  float GetArrowStep();
61 
62 protected:
63  void MoveAdjust();
64  void AdjustGlint();
65  void DrawVertex(Math::Point pos, Math::Point dim, int icon);
66 
67 protected:
68  CButton* m_buttonUp;
69  CButton* m_buttonDown;
70 
71  float m_visibleValue;
72  float m_visibleRatio;
73  float m_step;
74 
75  bool m_bCapture;
76  Math::Point m_pressPos;
77  float m_pressValue;
78 
79  EventType m_eventUp;
80  EventType m_eventDown;
81 };
82 
83 
84 }
85