1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2010 The Music Player Daemon Project
3 * Project homepage: http://musicpd.org
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.
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.
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.
24 #include "ncmpc_curses.h"
29 * This class is used to auto-scroll text which does not fit on the
30 * screen. Call hscroll_init() to initialize the object,
31 * hscroll_clear() to free resources, and hscroll_set() to begin
36 const char *separator
;
39 * The bounding coordinates on the screen.
44 * ncurses attributes for drawing the text.
49 * ncurses colors for drawing the text.
54 * The scrolled text, in the current locale.
59 * The current scrolling offset. This is a character
60 * position, not a screen column.
65 * The id of the timer which updates the scrolled area every
72 hscroll_reset(struct hscroll
*hscroll
)
78 hscroll_step(struct hscroll
*hscroll
)
84 strscroll(struct hscroll
*hscroll
, const char *str
, const char *separator
,
88 * Initializes a #hscroll object allocated by the caller.
91 hscroll_init(struct hscroll
*hscroll
, WINDOW
*w
, const char *separator
)
94 hscroll
->separator
= separator
;
98 * Sets a text to scroll. This installs a timer which redraws every
99 * second with the current window attributes. Call hscroll_clear() to
100 * disable it. This function automatically removes the old text.
103 hscroll_set(struct hscroll
*hscroll
, unsigned x
, unsigned y
, unsigned width
,
107 * Removes the text and the timer. It may be reused with
111 hscroll_clear(struct hscroll
*hscroll
);
114 * Explicitly draws the scrolled text. Calling this function is only
115 * allowed if there is a text currently.
118 hscroll_draw(struct hscroll
*hscroll
);