ncmpc  0.31
ListPage.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_LIST_PAGE_HXX
21 #define NCMPC_LIST_PAGE_HXX
22 
23 #include "Page.hxx"
24 #include "ListWindow.hxx"
25 
29 class ListPage : public Page {
30 protected:
32 
33 public:
34  ListPage(WINDOW *w, Size size)
35  :lw(w, size) {}
36 
37 public:
38  /* virtual methods from class Page */
39  void OnResize(Size size) override {
40  lw.Resize(size);
41  }
42 
43  bool OnCommand(struct mpdclient &, Command cmd) override {
44  if (lw.hide_cursor
45  ? lw.HandleScrollCommand(cmd)
46  : lw.HandleCommand(cmd)) {
47  SetDirty();
48  return true;
49  }
50 
51  return false;
52  }
53 
54 #ifdef HAVE_GETMOUSE
55  bool OnMouse(struct mpdclient &, Point p,
56  mmask_t bstate) override {
57  if (lw.HandleMouse(bstate, p.y)) {
58  SetDirty();
59  return true;
60  }
61 
62  return false;
63  }
64 
65 #endif
66 };
67 
68 #endif
void Resize(Size _size)
Command
Definition: Command.hxx:29
bool OnCommand(struct mpdclient &, Command cmd) override
Definition: ListPage.hxx:43
int y
Definition: Point.hxx:29
bool HandleScrollCommand(Command cmd)
Definition: ListPage.hxx:29
void SetDirty(bool _dirty=true)
Definition: Page.hxx:57
bool HandleCommand(Command cmd)
ListWindow lw
Definition: ListPage.hxx:31
bool hide_cursor
Definition: ListWindow.hxx:108
Definition: mpdclient.hxx:17
ListPage(WINDOW *w, Size size)
Definition: ListPage.hxx:34
Definition: Size.hxx:26
Definition: Point.hxx:28
void OnResize(Size size) override
Definition: ListPage.hxx:39
Definition: ListWindow.hxx:85
Definition: Page.hxx:36