Back to index

nux  3.0.0
test_empty_window.cpp
Go to the documentation of this file.
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 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 #include "Nux/Nux.h"
00022 #include "Nux/WindowThread.h"
00023 
00024 nux::TimeOutSignal *timeout_signal = NULL;
00025 
00026 void TimeOutCallback(void *data)
00027 {
00028   nux::WindowThread *thread = static_cast<nux::WindowThread*>(data);
00029   thread->ExitMainLoop();
00030 }
00031 
00032 void UserInterfaceInitialization(nux::NThread* thread, void* init_data)
00033 {
00034  
00035   nux::ColorLayer background(nux::Color(0xFF4D4D4D));
00036   static_cast<nux::WindowThread*>(thread)->SetWindowBackgroundPaintLayer(&background);
00037 
00038   timeout_signal = new nux::TimeOutSignal();
00039   timeout_signal->time_expires.connect(sigc::ptr_fun(TimeOutCallback));
00040   static_cast<nux::WindowThread*>(thread)->GetTimerHandler().AddTimerHandler(1000, timeout_signal, thread, NULL);
00041 }
00042 
00043 int main(int argc, char **argv)
00044 {
00045   // Initialize Nux subsystem
00046   nux::NuxInitialize (0);
00047 
00048   // Create a Window thread
00049   nux::WindowThread* wt = nux::CreateGUIThread(
00050     TEXT("Empty Window Test"),
00051     300,
00052     200,
00053     0,
00054     &UserInterfaceInitialization,
00055     0);
00056 
00057   // // Start the main loop
00058   wt->Run (0);
00059 
00060   delete wt;
00061   return 0;
00062 }