Back to index

nux  3.0.0
test-scrollview.cpp
Go to the documentation of this file.
00001 /*
00002  * Copyright 2011 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: Andrea Azzarone <azzaronea@gmail.com>
00018  *
00019  */
00020  
00021 #include "Nux/Nux.h"
00022 #include "test-scrollview.h"
00023 
00024 /*
00025   TestScrollView:
00026     This class is a Nux scrollview that process the mouse wheel events
00027     to make sure that everyghing work well.
00028 */
00029 
00030 NUX_IMPLEMENT_OBJECT_TYPE(TestScrollView);
00031 
00032 TestScrollView::TestScrollView(NUX_FILE_LINE_DECL)
00033   : nux::ScrollView(NUX_FILE_LINE_PARAM)
00034   , registered_scroll_(false)
00035   , normal_color_(nux::color::Green)
00036   , current_color_(normal_color_)
00037 {
00038   EnableVerticalScrollBar(true);
00039   EnableHorizontalScrollBar(true);
00040   
00041   scrolling.connect(sigc::mem_fun(this, &TestScrollView::OnScrolling));
00042 }
00043 
00044 TestScrollView::~TestScrollView()
00045 {
00046 
00047 }
00048 
00049 void TestScrollView::ResetEvents()
00050 {   
00051   registered_scroll_ = false;
00052   
00053   current_color_ = normal_color_; 
00054 }
00055 
00056 nux::Color TestScrollView::GetColor() const
00057 {
00058   return current_color_;
00059 }
00060 
00061 void TestScrollView::Draw(nux::GraphicsEngine &graphics_engine, bool force_draw)
00062 {
00063   nux::Geometry geo = GetGeometry();
00064   graphics_engine.QRP_Color(geo.x, geo.y, geo.width, geo.height, current_color_);
00065 }
00066 
00067 void TestScrollView::OnScrolling(int hscroll, int vscroll)
00068 {
00069   registered_scroll_ = true;
00070 
00071   QueueDraw();
00072 }
00073