ncmpc  0.30
StatusBar.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 NCMPC_STATUS_BAR_HXX
21 #define NCMPC_STATUS_BAR_HXX
22 
23 #include "Window.hxx"
24 
25 #ifndef NCMPC_MINI
26 #include "hscroll.hxx"
27 #endif
28 
29 #include <mpd/status.h>
30 
31 #include <string>
32 
33 struct mpd_status;
34 struct mpd_song;
35 
36 class StatusBar {
37  Window window;
38 
39  unsigned message_source_id = 0;
40 
41 #ifndef NCMPC_MINI
42  class hscroll hscroll;
43 #endif
44 
45  const char *left_text;
46  char right_text[64];
47 
48  std::string center_text;
49 
50  unsigned left_width, right_width;
51 #ifndef NCMPC_MINI
52  unsigned center_width;
53 #endif
54 
55 public:
56  StatusBar(Point p, unsigned width);
57  ~StatusBar();
58 
60  return window;
61  }
62 
63  void SetMessage(const char *msg);
64  void ClearMessage();
65 
66  void OnResize(Point p, unsigned width);
67  void Update(const struct mpd_status *status,
68  const struct mpd_song *song);
69  void Paint() const;
70 
71 private:
72  bool OnClearMessageTimer();
73 };
74 
75 #endif
Definition: hscroll.hxx:33
StatusBar(Point p, unsigned width)
Window & GetWindow()
Definition: StatusBar.hxx:59
Definition: Window.hxx:28
void Update(const struct mpd_status *status, const struct mpd_song *song)
void SetMessage(const char *msg)
void ClearMessage()
Definition: StatusBar.hxx:36
void OnResize(Point p, unsigned width)
void Paint() const
Definition: Point.hxx:28