Back to index

nux  3.0.0
Nux.h
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 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 
00023 #ifndef NUX_H
00024 #define NUX_H
00025 
00026 #include "NuxCore/NuxCore.h"
00027 #include "NuxCore/Error.h"
00028 #include "NuxCore/FilePath.h"
00029 #include "NuxCore/Color.h"
00030 #include "NuxCore/Rect.h"
00031 #include "NuxCore/Point.h"
00032 #include "NuxCore/Size.h"
00033 
00034 #include "NuxCore/ObjectPtr.h"
00035 
00036 #include "NuxCore/Math/Constants.h"
00037 #include "NuxCore/Math/Vector3.h"
00038 #include "NuxCore/Math/Vector4.h"
00039 #include "NuxCore/Math/Matrix3.h"
00040 #include "NuxCore/Math/Matrix4.h"
00041 #include "NuxCore/Math/Spline.h"
00042 
00043 #include <sigc++/trackable.h>
00044 #include <sigc++/signal.h>
00045 #include <sigc++/functors/ptr_fun.h>
00046 #include <sigc++/functors/mem_fun.h>
00047 #include <sigc++/adaptors/bind.h>
00048 #include <sigc++/functors/slot.h>
00049 
00050 #include <glib.h>
00051 
00052 #define NUX_USE_GLIB_LOOP_ON_WINDOWS
00053 //#define NUX_DISABLE_GLIB_LOOP
00054 
00055 #include "Utils.h"
00056 #include "WidgetMetrics.h"
00057 #include "Area.h"
00058 #include "InputArea.h"
00059 #include "Theme.h"
00060 #include "Painter.h"
00061 #include "View.h"
00062 #include "AbstractThread.h"
00063 #include "WindowThread.h"
00064 #include "WindowCompositor.h"
00065 #include "Timeline.h"
00066 #include "SystemThread.h"
00067 
00068 
00069 
00070 namespace nux
00071 {
00072   class WindowThread;
00073   class SystemThread;
00074   class WindowCompositor;
00075   class TimerHandler;
00076 
00077   void NuxInitialize(const char *CommandLine);
00078 
00080 
00090   WindowThread *CreateGUIThread(const char *window_title,
00091                                 int width,
00092                                 int height,
00093                                 WindowThread *parent = NULL,
00094                                 ThreadUserInitFunc user_init_func = NULL,
00095                                 void *data = NULL);
00096 
00098 
00120   WindowThread *CreateNuxWindow(const char *window_title,
00121     int width,
00122     int height,
00123     WindowStyle window_border_style = WINDOWSTYLE_NORMAL,
00124     AbstractThread *parent = NULL,
00125     bool modal = false,
00126     ThreadUserInitFunc user_init_func = NULL,
00127     void *data = NULL);
00128 
00130 
00150   WindowThread *CreateNuxWindowNewThread(const char *window_title,
00151     int width,
00152     int height,
00153     WindowStyle window_border_style = WINDOWSTYLE_NORMAL,
00154     AbstractThread *parent = NULL,
00155     bool modal = false,
00156     ThreadUserInitFunc user_init_func = NULL,
00157     void *data = NULL);
00158 
00159 #if defined(NUX_OS_WINDOWS)
00160 
00161   WindowThread *CreateFromForeignWindow(HWND WindowHandle, HDC WindowDCHandle,
00162                                         HGLRC OpenGLRenderingContext,
00163                                         ThreadUserInitFunc user_init_func,
00164                                         void *data);
00165 #elif defined(NUX_OS_LINUX)
00166 
00167 #ifdef NUX_OPENGLES_20
00168   WindowThread *CreateFromForeignWindow (Window X11Window, EGLContext OpenGLContext,
00169                                          ThreadUserInitFunc user_init_func,
00170                                          void *data);
00171 #else
00172   WindowThread *CreateFromForeignWindow (Window X11Window, GLXContext OpenGLContext,
00173                                          ThreadUserInitFunc user_init_func,
00174                                          void *data);
00175 #endif
00176 #endif
00177 
00178   // Create a window thread that is a child of the Parent. This thread has a window.
00188   WindowThread *CreateWindowThread(WindowStyle window_style,
00189                                    const char *window_title,
00190                                    int width,
00191                                    int height,
00192                                    WindowThread *parent,
00193                                    ThreadUserInitFunc user_init_func = NULL,
00194                                    void *data = NULL);
00195 
00196   // Create a Modal window thread that is a child of the Parent. This thread has a window.
00206   WindowThread *CreateModalWindowThread(WindowStyle window_style,
00207                                         const char *window_title,
00208                                         int width,
00209                                         int height,
00210                                         WindowThread *parent,
00211                                         ThreadUserInitFunc user_init_func = NULL,
00212                                         void *data = NULL);
00213 
00214 // Create a simple thread
00215   SystemThread *CreateSystemThread(AbstractThread *parent = NULL,
00216                                    ThreadUserInitFunc user_init_func = NULL,
00217                                    void *data = NULL);
00218 
00219 /*  ThreadState GetThreadState(unsigned int ThreadID);*/
00220 
00221 
00222   ObjectPtr<FontTexture> GetSysFont();
00223   ObjectPtr<FontTexture> GetSysBoldFont();
00224 
00225   WindowThread      *GetWindowThread();
00226   WindowThread      *GetThreadNuxWindow();
00227 
00228   WindowCompositor  &GetWindowCompositor();
00229   BasePainter       &GetPainter();
00230   UXTheme           &GetTheme();
00231   TimerHandler      &GetTimer();
00232 
00233 #define  gPainter nux::GetPainter() // deprecated
00234 #define  gTheme   nux::GetTheme()   // deprecated
00235 
00236   inlDeclareThreadLocalStorage(NThread *, 0, ThreadLocal_InalogicAppImpl);
00237 
00238 }
00239 
00240 #endif // NUX_H