Colobot
slider.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 // slider.h
21 
22 #pragma once
23 
24 
25 #include "ui/control.h"
26 #include "common/event.h"
27 
28 namespace Ui {
29 
30 class CButton;
31 
32 class CSlider : public CControl
33 {
34 public:
35  CSlider();
36  ~CSlider();
37 
38  bool Create(Math::Point pos, Math::Point dim, int icon, EventType eventMsg);
39 
40  void SetPos(Math::Point pos);
41  void SetDim(Math::Point dim);
42 
43  bool SetState(int state, bool bState);
44  bool SetState(int state);
45  bool ClearState(int state);
46 
47  bool EventProcess(const Event &event);
48  void Draw();
49 
50  void SetLimit(float min, float max);
51 
52  void SetVisibleValue(float value);
53  float GetVisibleValue();
54 
55  void SetArrowStep(float step);
56  float GetArrowStep();
57 
58 protected:
59  void MoveAdjust();
60  void AdjustGlint();
61  void DrawVertex(Math::Point pos, Math::Point dim, int icon);
62 
63 protected:
64  CButton* m_buttonLeft;
65  CButton* m_buttonRight;
66 
67  float m_min;
68  float m_max;
69  float m_visibleValue;
70  float m_step;
71 
72  bool m_bHoriz;
73  float m_marginButton;
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 
Definition: controller.h:32
Definition: button.h:30
Definition: slider.h:32
2D point
Definition: point.h:49
Event types, structs and event queue.
EventType
Type of event message.
Definition: event.h:38
Event sent by system, interface or game.
Definition: event.h:678
Definition: control.h:66