cwidget  0.5.17
passthrough.h
1 // passthrough.h -*-c++-*-
2 //
3 // A widget that by default passes focus and cursor handling through to
4 // a "currently focussed" widget.
5 
6 #ifndef PASSTHROUGH_H
7 #define PASSTHROUGH_H
8 
9 #include "container.h"
10 
11 namespace cwidget
12 {
13  namespace widgets
14  {
15  class passthrough:public container
16  {
17  void gained_focus();
18  void lost_focus();
19 
20  protected:
21  virtual bool handle_key(const config::key &k);
22 
23  // These call focussed() and unfocussed() on the result of get_focus().
24  // (convenience methods)
25  //
26  // Provided to make it easier to manage focus simply.
27  void defocus();
28  void refocus();
29 
30  protected:
31  passthrough();
32 
33  public:
34  // Returns the currently focussed widget, if any.
35  virtual widget_ref get_focus()=0;
36 
38 
39  virtual void dispatch_mouse(short id, int x, int y, int z, mmask_t bstate);
40 
41  virtual bool focus_me();
42  virtual bool get_cursorvisible();
43  virtual point get_cursorloc();
44  };
45 
47  }
48 }
49 
50 #endif
Definition: widget.h:89
The namespace containing everything defined by cwidget.
Definition: columnify.cc:26
widget_ref get_active_widget()
Return the currently "active" child of this container, or NULL.
Definition: passthrough.cc:17
Definition: container.h:32
Represents a keystroke as seen by curses.
Definition: keybindings.h:42
Definition: passthrough.h:15
virtual bool handle_key(const config::key &k)
Handles a keypress in this widget.
Definition: passthrough.cc:91