Back to index

nux  3.0.0
TestView.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2012 Inalogic Inc.
00003  *
00004  * This program is free software: you can redistribute it and/or modify it
00005  * under the terms of the GNU General Public License version 3, as published
00006  * by the  Free Software Foundation.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranties of
00010  * MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
00011  * PURPOSE.  See the GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * version 3 along with this program.  If not, see
00015  * <http://www.gnu.org/licenses/>
00016  *
00017  * Authored by: Jay Taoko <jaytaoko@inalogic.com>
00018  *
00019  */
00020 
00021 #ifndef TEST_VIEW_H
00022 #define TEST_VIEW_H
00023 
00024 #include "Nux/TextureArea.h"
00025 
00026 namespace nux {
00027 class TestView: public nux::View
00028 {
00029   NUX_DECLARE_OBJECT_TYPE(TestView, View);
00030 public:
00031   TestView(NUX_FILE_LINE_PROTO);
00032   ~TestView();
00033 
00034   nux::Color GetColor() const;
00035   bool AcceptKeyNavFocus() {return can_focus_;}
00036 
00037   void ResetEvents();
00038   void ResetKeyFocusEvents();
00039 
00040   void QueueDraw();
00041 
00042   bool can_focus_;
00043 
00044   bool has_focus_;
00045   bool registered_mouse_down_;
00046   bool registered_mouse_up_;
00047   bool registered_mouse_drag_;
00048   bool registered_mouse_click_;
00049   bool registered_mouse_double_click_;
00050   bool registered_mouse_move_;
00051   bool registered_mouse_enter_;
00052   bool registered_mouse_leave_;
00053   bool registered_object_destroyed_;
00054   
00055   bool registered_begin_keynav_focus_;
00056   bool registered_end_keynav_focus_;
00057 
00058   unsigned int calls_to_queue_draw_;
00059 
00060   nux::KeyNavDirection key_nav_direction_; 
00061   
00062 protected:
00063   nux::Color current_color_;
00064   nux::Color normal_color_;
00065   nux::Color mouse_down_color_;
00066   nux::Color mouse_drag_color_;
00067   nux::Color mouse_in_color_;
00068   nux::Color with_key_focus_color_;
00069   nux::Color without_key_focus_color_;
00070   
00071   bool mouse_in_;
00072   bool mouse_mouse_drag_;
00073   bool mouse_mouse_down_;
00074 
00075   void OnMouseDown(int x, int y, unsigned long button_flags, unsigned long key_flags);
00076   void OnMouseUp(int x, int y, unsigned long button_flags, unsigned long key_flags);
00077   void OnMouseDrag(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
00078   void OnMouseClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
00079   void OnMouseDoubleClick(int x, int y, unsigned long button_flags, unsigned long key_flags);
00080   void OnMouseMove(int x, int y, int dx, int dy, unsigned long button_flags, unsigned long key_flags);
00081   void OnMouseEnter(int x, int y, unsigned long button_flags, unsigned long key_flags);
00082   void OnMouseLeave(int x, int y, unsigned long button_flags, unsigned long key_flags);
00083   void OnKeyNavFocusChange(nux::Area* area, bool has_focus, nux::KeyNavDirection direction);
00084   void OnBeginKeyFocus();
00085   void OnEndKeyFocus();
00086   void OnObjectDestroyed(Object* object);
00087 
00088   void Draw(nux::GraphicsEngine& graphics_engine, bool force_draw);
00089 };
00090 
00091 }
00092 #endif // TEST_VIEW_H
00093