ncmpc  0.31
hscroll.hxx
Go to the documentation of this file.
1 /* ncmpc (Ncurses MPD Client)
2  * (c) 2004-2018 The Music Player Daemon Project
3  * Project homepage: http://musicpd.org
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 2 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 along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef HSCROLL_H
21 #define HSCROLL_H
22 
23 #include "config.h"
24 #include "ncmpc_curses.h"
25 #include "BasicMarquee.hxx"
26 
27 enum class Style : unsigned;
28 
35 class hscroll {
36  WINDOW *const w;
37 
38  BasicMarquee basic;
39 
43  unsigned x, y;
44 
48  Style style;
49 
50  attr_t attr;
51 
56  unsigned source_id = 0;
57 
58 public:
59  hscroll(WINDOW *_w, const char *_separator)
60  :w(_w), basic(_separator) {
61  }
62 
63  bool IsDefined() const {
64  return basic.IsDefined();
65  }
66 
72  void Set(unsigned x, unsigned y, unsigned width, const char *text,
73  Style style, attr_t attr=0);
74 
79  void Clear();
80 
81  void Rewind() {
82  basic.Rewind();
83  }
84 
85  void Step() {
86  basic.Step();
87  }
88 
93  void Paint() const;
94 
95 private:
96  bool TimerCallback();
97 };
98 
99 #endif
bool IsDefined() const
Definition: hscroll.hxx:63
Definition: hscroll.hxx:35
Style
Definition: Styles.hxx:26
Definition: BasicMarquee.hxx:33
hscroll(WINDOW *_w, const char *_separator)
Definition: hscroll.hxx:59
void Set(unsigned x, unsigned y, unsigned width, const char *text, Style style, attr_t attr=0)
void Clear()
void Rewind()
Definition: BasicMarquee.hxx:83
void Rewind()
Definition: hscroll.hxx:81
void Paint() const
void Step()
Definition: hscroll.hxx:85
bool IsDefined() const
Definition: BasicMarquee.hxx:66
void Step()
Definition: BasicMarquee.hxx:87