cwidget 0.5.18
minibuf_win.h
1// minibuf_win.h -*-c++-*-
2//
3// Copyright 2000-2001, 2004-2005 Daniel Burrows
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
16// along with this program; see the file COPYING. If not, write to
17// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18// Boston, MA 02111-1307, USA.
19//
20// Apologies for the lame name, but I couldn't think of anything else.
21//
22// This class provides basic support for a common UI theme: a widget with a
23// header and status line, where the status line can contain various widgets
24// for getting input, displaying messages, etc. (the header line will probably
25// vanish in the future)
26
27#ifndef MINIBUF_WIN_H
28#define MINIBUF_WIN_H
29
30#include <cwidget/style.h>
31
32#include "passthrough.h"
33#include "widget.h"
34
35#include <sigc++/connection.h>
36
37namespace cwidget
38{
39 namespace widgets
40 {
41 class minibuf;
42 class label;
43 class multiplex;
44
46 {
47 util::ref_ptr<label> status_lbl, header;
48
49 widget_ref main_widget;
50 // This is displayed in the center of the screen.
51
53
54 sigc::connection main_destroy_conn;
55
56 protected:
58 public:
59 static
61 {
63 rval->decref();
64 return rval;
65 }
66
68
69 void destroy();
70
71 void set_main_widget(const widget_ref &w);
72
73 int width_request();
74 int height_request(int w);
75 void layout_me();
76
77 virtual void paint(const style &st);
78
79 void show_header();
80 void show_status();
81 // Should mainly be used if it's necessary to force an update of the status
82 // line
83
84 void set_status(std::string new_status);
85 void set_header(std::string new_header);
86 // Set the status and header lines of the window, respectively.
87 // These routines do NOT call refresh()!
88
89 widget_ref get_focus();
90
91 static const style &retr_header_style() {return get_style("Header");}
92 static const style &retr_status_style() {return get_style("Status");}
93 void display_error(std::string err);
94
95 void add_widget(const widget_ref &widget);
96 // Adds a widget. Widgets are automatically shown if they're the first
97 // one to be added, otherwise show() should be called.
98 void rem_widget(const widget_ref &widget);
99 // Removes a widget
100
101 void show_all();
102 };
103
105 }
106}
107
108#endif
A "style" is a setting to be applied to a display element (widget, text, etc).
Definition: style.h:52
Definition: ref_ptr.h:20
Definition: minibuf_win.h:46
int height_request(int w)
Calculate the desired height of the widget, given its width.
Definition: minibuf_win.cc:118
void destroy()
Destroys the visible representation of this widget and disconnects it from any children that it may h...
Definition: minibuf_win.cc:58
int width_request()
Definition: minibuf_win.cc:100
virtual void paint(const style &st)
Display this widget.
Definition: minibuf_win.cc:146
void show_all()
Display this widget and all its subwidgets.
Definition: minibuf_win.cc:211
Definition: passthrough.h:16
The basic widget interface.
Definition: widget.h:107
The namespace containing everything defined by cwidget.
Definition: columnify.cc:28
const style & get_style(const std::string &name)
Look up a style in the global registry.
Definition: style.cc:30