nux-1.16.0
|
00001 /* 00002 * Copyright 2010 Inalogic® Inc. 00003 * 00004 * This program is free software: you can redistribute it and/or modify it 00005 * under the terms of the GNU Lesser General Public License, as 00006 * published by the Free Software Foundation; either version 2.1 or 3.0 00007 * of the License. 00008 * 00009 * This program is distributed in the hope that it will be useful, but 00010 * WITHOUT ANY WARRANTY; without even the implied warranties of 00011 * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR 00012 * PURPOSE. See the applicable version of the GNU Lesser General Public 00013 * License for more details. 00014 * 00015 * You should have received a copy of both the GNU Lesser General Public 00016 * License along with this program. If not, see <http://www.gnu.org/licenses/> 00017 * 00018 * Authored by: Jay Taoko <jaytaoko@inalogic.com> 00019 * 00020 */ 00021 00022 #ifndef ABSTRACTBUTTON_H 00023 #define ABSTRACTBUTTON_H 00024 00025 #include "View.h" 00026 #include "NuxCore/Property.h" 00027 00028 namespace nux 00029 { 00030 enum State 00031 { 00032 NUX_STATE_ACTIVE = 0, 00033 NUX_STATE_NORMAL = 1, 00034 NUX_STATE_PRELIGHT = 2, 00035 NUX_STATE_SELECTED = 3, 00036 NUX_STATE_INSENSITIVE = 4 00037 }; 00038 00040 class AbstractButton : public View 00041 { 00042 NUX_DECLARE_OBJECT_TYPE(AbstractButton, View); 00043 public: 00044 AbstractButton(NUX_FILE_LINE_PROTO); 00045 ~AbstractButton(); 00046 00048 Property<bool> active; 00049 00051 sigc::signal<void, AbstractButton*> activated; 00052 00053 protected: 00054 bool togglable_; 00055 00057 // FIXME: Should be read only. 00058 nux::Property<State> state; 00059 00060 virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo); 00061 00062 void RecvMouseUp (int x, int y, unsigned long button_flags, unsigned long key_flags); 00063 void RecvMouseDown (int x, int y, unsigned long button_flags, unsigned long key_flags); 00064 void RecvMouseMove (int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags); 00065 void RecvMouseEnter (int x, int y, unsigned long button_flags, unsigned long key_flags); 00066 void RecvMouseLeave (int x, int y, unsigned long button_flags, unsigned long key_flags); 00067 void RecvClick (int x, int y, unsigned long button_flags, unsigned long key_flags); 00068 00069 private: 00070 void Init (); 00071 }; 00072 } 00073 00074 #endif // ABSTRACTBUTTON_H