Back to index

nux  3.0.0
test_graphics_display.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: Brandon Schaefer <brandontschaefer@gmail.com>
00018  *
00019  */
00020 
00021 #include <iostream>
00022 
00023 #include "Nux/Nux.h"
00024 #include "Nux/VLayout.h"
00025 #include "Nux/WindowThread.h"
00026 
00027 void ThreadWidgetInit(nux::NThread* thread, void* InitData)
00028 {
00029   nux::VLayout* layout = new nux::VLayout(NUX_TRACKER_LOCATION);
00030   nux::GetWindowThread()->SetLayout(layout);
00031 }
00032 
00033 int main(int argc, char **argv)
00034 {
00035     nux::NuxInitialize(0);
00036     // When the GUI thread is created, it creates the GraphicsDisplay.
00037     nux::WindowThread* wt = nux::CreateGUIThread(TEXT("Graphics Display"),
00038                                                  300, 200, 0, &ThreadWidgetInit, 0);
00039 
00040     // Test to see if the variable in GraphicsDisplay is initialized
00041     int result = 1;
00042     if (!nux::GetGraphicsDisplay()->PointerIsGrabbed())
00043     {
00044       // Zero return code is good.
00045       result = 0;
00046     }
00047     else
00048     {
00049       std::cerr << "FAIL: GraphicsDisplay hasn't correctly initialized.\n";
00050     }
00051 
00052     delete wt;
00053     return result;
00054 }