Colobot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Pages
slider.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 // slider.h
19 
20 #pragma once
21 
22 
23 #include "ui/control.h"
24 #include "common/event.h"
25 
26 namespace Ui {
27 
28 class CButton;
29 
30 class CSlider : public CControl
31 {
32 public:
33  CSlider();
34  ~CSlider();
35 
36  bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
37 
38  void SetPos(Math::Point pos);
39  void SetDim(Math::Point dim);
40 
41  bool SetState(int state, bool bState);
42  bool SetState(int state);
43  bool ClearState(int state);
44 
45  bool EventProcess(const Event &event);
46  void Draw();
47 
48  void SetLimit(float min, float max);
49 
50  void SetVisibleValue(float value);
51  float GetVisibleValue();
52 
53  void SetArrowStep(float step);
54  float GetArrowStep();
55 
56 protected:
57  void MoveAdjust();
58  void AdjustGlint();
59  void DrawVertex(Math::Point pos, Math::Point dim, int icon);
60 
61 protected:
62  CButton* m_buttonLeft;
63  CButton* m_buttonRight;
64 
65  float m_min;
66  float m_max;
67  float m_visibleValue;
68  float m_step;
69 
70  bool m_bHoriz;
71  float m_marginButton;
72 
73  bool m_bCapture;
74  Math::Point m_pressPos;
75  float m_pressValue;
76 
77  EventType m_eventUp;
78  EventType m_eventDown;
79 };
80 
81 
82 }
83 
Definition: button.h:28
Definition: slider.h:30
2D point
Definition: point.h:46
Event types, structs and event queue.
EventType
Type of event message.
Definition: event.h:35
Event sent by system, interface or game.
Definition: event.h:686
Definition: control.h:64