1 /* ncmpc (Ncurses MPD Client)
2 * (c) 2004-2009 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.
18 */
20 #ifndef SCREEN_H
21 #define SCREEN_H
23 #include "config.h"
24 #include "command.h"
25 #include "window.h"
26 #include "title_bar.h"
27 #include "progress_bar.h"
28 #include "status_bar.h"
30 #include <mpd/client.h>
32 #include <glib.h>
34 #ifdef HAVE_NCURSESW_NCURSES_H
35 #include <ncursesw/ncurses.h>
36 #else
37 #include <ncurses.h>
38 #endif
40 #define IS_PLAYING(s) (s==MPD_STATE_PLAY)
41 #define IS_PAUSED(s) (s==MPD_STATE_PAUSE)
42 #define IS_STOPPED(s) (!(IS_PLAYING(s) | IS_PAUSED(s)))
44 #define MAX_SONGNAME_LENGTH 512
46 struct mpdclient;
47 struct screen_functions;
49 struct screen {
50 struct title_bar title_bar;
51 struct window main_window;
52 struct progress_bar progress_bar;
53 struct status_bar status_bar;
55 /* GTime is equivalent to time_t */
56 GTime start_timestamp;
58 unsigned cols, rows;
60 char *buf;
61 size_t buf_size;
63 char *findbuf;
64 GList *find_history;
65 };
67 extern struct screen screen;
69 void screen_init(struct mpdclient *c);
70 void screen_exit(void);
71 void screen_resize(struct mpdclient *c);
72 void screen_status_message(const char *msg);
73 void screen_status_printf(const char *format, ...);
74 void screen_paint(struct mpdclient *c);
75 void screen_update(struct mpdclient *c);
76 void screen_cmd(struct mpdclient *c, command_t cmd);
78 void
79 screen_switch(const struct screen_functions *sf, struct mpdclient *c);
80 void
81 screen_swap(struct mpdclient *c, const struct mpd_song *song);
83 gboolean
84 screen_is_visible(const struct screen_functions *sf);
86 int
87 screen_get_mouse_event(struct mpdclient *c, unsigned long *bstate, int *row);
89 #endif