1
// -*- Mode: C++; indent-tabs-mode: nil; tab-width: 2 -*-
3
* Copyright (C) 2012 Canonical Ltd
5
* This program is free software: you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 3 as
7
* published by the Free Software Foundation.
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
* GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License
15
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Authored by: Brandon Schaefer <brandon.schaefer@canonical.com>
21
#ifndef VSCROLLBAR_OVERLAY_WINDOW_H
22
#define VSCROLLBAR_OVERLAY_WINDOW_H
25
#include <Nux/BaseWindow.h>
26
#include <NuxCore/Animation.h>
31
class VScrollBarOverlayWindow : public nux::BaseWindow
34
VScrollBarOverlayWindow(nux::Geometry const& geo);
36
nux::Property<double> scale;
38
void UpdateGeometry(nux::Geometry const& geo);
39
void SetThumbOffsetY(int y);
50
void ThumbInsideSlider();
51
void ThumbOutsideSlider();
54
void PageDownAction();
56
bool IsMouseInsideThumb(int y) const;
57
bool IsMouseBeingDragged() const;
59
int GetThumbHeight() const;
60
int GetThumbOffsetY() const;
62
nux::Geometry GetThumbGeometry() const;
67
virtual void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
70
enum class ThumbAction : unsigned int
83
MOUSE_INSIDE = 1 << 3,
84
INSIDE_SLIDER = 1 << 4
88
void UpdateMouseOffsetX();
89
void UpdateContentGeometry();
90
int GetValidOffsetYValue(int y) const;
97
nux::Geometry content_size_;
98
nux::ObjectPtr<nux::BaseTexture> thumb_texture_;
100
int content_offset_x_;
103
void AddState(ThumbState const& state);
104
void RemoveState(ThumbState const& state);
105
bool HasState(ThumbState const& state) const;
107
unsigned int current_state_;
108
ThumbAction current_action_;
109
nux::animation::AnimateValue<double> show_animator_;
114
#endif // VSCROLLBAR_OVERLAY_WINDOW_H