00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef STATUSCHOICE_H
00029 #define STATUSCHOICE_H
00030
00031 #include <string>
00032 #include <cwidget/generic/util/eassert.h>
00033
00034 #include "widget.h"
00035
00036 namespace cwidget
00037 {
00038 namespace config
00039 {
00040 class keybindings;
00041 }
00042
00043 namespace widgets
00044 {
00045 class statuschoice : public widget
00046 {
00047 std::wstring prompt;
00048 std::wstring choices;
00049
00050
00051
00052 protected:
00053 bool handle_key(const config::key &k);
00054
00055 statuschoice(const std::wstring &_prompt, const std::wstring &_choices)
00056 : widget(), prompt(_prompt), choices(_choices)
00057 {
00058 eassert(choices.size()>0);
00059 }
00060
00061 public:
00062 static util::ref_ptr<statuschoice> create(const std::wstring &prompt,
00063 const std::wstring &choices)
00064 {
00065 util::ref_ptr<statuschoice> rval(new statuschoice(prompt, choices));
00066 rval->decref();
00067 return rval;
00068 }
00069
00070 int width_request();
00071 int height_request(int w);
00072
00073 bool get_cursorvisible();
00074 point get_cursorloc();
00075
00076 bool focus_me() {return true;}
00077
00078 void paint(const style &st);
00079
00080 sigc::signal1<void, int> chosen;
00081
00082
00083
00084 static config::keybindings *bindings;
00085 static void init_bindings();
00086 };
00087
00088 typedef util::ref_ptr<statuschoice> statuschoice_ref;
00089 }
00090 }
00091
00092 #endif