ncmpc  0.29
hscroll.h
Go to the documentation of this file.
1 /* ncmpc (Ncurses MPD Client)
2  * (c) 2004-2017 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 
26 #include <glib.h>
27 
34 struct hscroll {
35  WINDOW *w;
36  const char *separator;
37 
41  unsigned x, y, width;
42 
46  attr_t attrs;
47 
51  short pair;
52 
56  char *text;
57 
62  gsize offset;
63 
68  guint source_id;
69 };
70 
71 static inline void
72 hscroll_reset(struct hscroll *hscroll)
73 {
74  hscroll->offset = 0;
75 }
76 
77 static inline void
78 hscroll_step(struct hscroll *hscroll)
79 {
80  ++hscroll->offset;
81 }
82 
83 char *
84 strscroll(struct hscroll *hscroll, const char *str, const char *separator,
85  unsigned width);
86 
90 static inline void
91 hscroll_init(struct hscroll *hscroll, WINDOW *w, const char *separator)
92 {
93  hscroll->w = w;
94  hscroll->separator = separator;
95 }
96 
102 void
103 hscroll_set(struct hscroll *hscroll, unsigned x, unsigned y, unsigned width,
104  const char *text);
105 
110 void
111 hscroll_clear(struct hscroll *hscroll);
112 
117 void
118 hscroll_draw(struct hscroll *hscroll);
119 
120 #endif
void hscroll_clear(struct hscroll *hscroll)
char * strscroll(struct hscroll *hscroll, const char *str, const char *separator, unsigned width)
WINDOW * w
Definition: hscroll.h:35
Definition: hscroll.h:34
short pair
Definition: hscroll.h:51
void hscroll_set(struct hscroll *hscroll, unsigned x, unsigned y, unsigned width, const char *text)
unsigned x
Definition: hscroll.h:41
const char * separator
Definition: hscroll.h:36
void hscroll_draw(struct hscroll *hscroll)
unsigned y
Definition: hscroll.h:41
unsigned width
Definition: hscroll.h:41
guint source_id
Definition: hscroll.h:68
char * text
Definition: hscroll.h:56
attr_t attrs
Definition: hscroll.h:46
gsize offset
Definition: hscroll.h:62