passthrough.h

00001 // passthrough.h                -*-c++-*-
00002 //
00003 //  A widget that by default passes focus and cursor handling through to
00004 // a "currently focussed" widget.
00005 
00006 #ifndef PASSTHROUGH_H
00007 #define PASSTHROUGH_H
00008 
00009 #include "container.h"
00010 
00011 namespace cwidget
00012 {
00013   namespace widgets
00014   {
00015     class passthrough:public container
00016     {
00017       void gained_focus();
00018       void lost_focus();
00019 
00020     protected:
00021       virtual bool handle_key(const config::key &k);
00022 
00023       // These call focussed() and unfocussed() on the result of get_focus().
00024       // (convenience methods)
00025       //
00026       // Provided to make it easier to manage focus simply.
00027       void defocus();
00028       void refocus();
00029 
00030     protected:
00031       passthrough();
00032 
00033     public:
00034       // Returns the currently focussed widget, if any.
00035       virtual widget_ref get_focus()=0;
00036 
00037       widget_ref get_active_widget();
00038 
00039       virtual void dispatch_mouse(short id, int x, int y, int z, mmask_t bstate);
00040 
00041       virtual bool focus_me();
00042       virtual bool get_cursorvisible();
00043       virtual point get_cursorloc();
00044     };
00045 
00046     typedef util::ref_ptr<passthrough> passthrough_ref;
00047   }
00048 }
00049 
00050 #endif

Generated on Fri Feb 8 12:54:56 2008 for cwidget by  doxygen 1.5.4