|
Rapicorn - Experimental UI Toolkit - Source Code 10.08.1
|
00001 /* Rapicorn 00002 * Copyright (C) 2005 Tim Janik 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * A copy of the GNU Lesser General Public License should ship along 00015 * with this library; if not, see http://www.gnu.org/copyleft/. 00016 */ 00017 #ifndef __RAPICORN_BUTTONS_HH__ 00018 #define __RAPICORN_BUTTONS_HH__ 00019 00020 #include <ui/container.hh> 00021 #include <ui/paintcontainers.hh> 00022 00023 namespace Rapicorn { 00024 00025 struct Activatable : virtual BaseObject { // FIXME: remove this? /* ActivateModel */ 00026 SignalVoid<Activatable> sig_changed; 00027 virtual bool check_activate (); 00028 virtual void activate (); 00029 }; 00030 00031 class ButtonAreaImpl : public virtual SingleContainerImpl, public virtual ButtonAreaIface, 00032 public virtual EventHandler, public virtual FocusFrame::Client { 00033 typedef Signal<ButtonAreaImpl, bool (), CollectorUntil0<bool> > SignalCheckActivate; 00034 typedef Signal<ButtonAreaImpl, void ()> SignalActivate; 00035 uint m_button, m_repeater; 00036 ClickType m_click_type; 00037 FocusFrame *m_focus_frame; 00038 String m_on_click[3]; 00039 virtual void dump_private_data (TestStream &tstream); 00040 bool activate_button_command (int button); 00041 bool activate_command (); 00042 void activate_click (int button, EventType etype); 00043 bool can_focus () const; 00044 bool register_focus_frame (FocusFrame &frame); 00045 void unregister_focus_frame (FocusFrame &frame); 00046 void reset (ResetMode mode = RESET_ALL); 00047 bool handle_event (const Event &event); 00048 public: 00049 explicit ButtonAreaImpl (); 00050 SignalCheckActivate sig_check_activate; 00051 SignalActivate sig_activate; 00052 virtual String on_click () const { return m_on_click[0]; } 00053 virtual void on_click (const String &command) { m_on_click[0] = string_strip (command); } 00054 virtual String on_click2 () const { return m_on_click[1]; } 00055 virtual void on_click2 (const String &command) { m_on_click[1] = string_strip (command); } 00056 virtual String on_click3 () const { return m_on_click[2]; } 00057 virtual void on_click3 (const String &command) { m_on_click[2] = string_strip (command); } 00058 virtual ClickType click_type () const { return m_click_type; } 00059 virtual void click_type (ClickType click_type) { reset(); m_click_type = click_type; } 00060 virtual const PropertyList& list_properties (); 00061 }; 00062 00063 } // Rapicorn 00064 00065 #endif /* __RAPICORN_BUTTONS_HH__ */
1.7.4