nux-0.9.46
|
#include <Nux/WindowThread.h>
Data Structures | |
struct | _EventInspectorStorage |
struct | ThreadInfo |
Public Member Functions | |
WindowThread (const TCHAR *WindowTitle, unsigned int width, unsigned int height, AbstractThread *Parent, bool Modal) | |
~WindowThread () | |
void | SetLayout (Layout *layout) |
Set the layout for this window thread. | |
void | TerminateThread () |
void | RunUserInterface () |
Start running the user interface. | |
virtual long | ProcessEvent (IEvent &event, long TraverseInfo, long ProcessEventInfo) |
void | ProcessDraw (GraphicsEngine &GfxContext, bool force_draw) |
void | SetWindowTitle (const TCHAR *WindowTitle) |
GraphicsDisplay & | GetWindow () const |
GraphicsEngine & | GetGraphicsEngine () const |
BasePainter & | GetPainter () const |
TimerHandler & | GetTimerHandler () const |
UXTheme & | GetTheme () const |
void | SetWindowSize (int width, int height) |
void | SetWindowBackgroundPaintLayer (AbstractPaintLayer *bkg) |
void | RequestRedraw () |
void | ClearRedrawFlag () |
bool | IsRedrawNeeded () const |
void | AddToDrawList (View *view) |
void | ClearDrawList () |
std::vector< Geometry > | GetDrawList () |
void | QueueMainLayout () |
Causes the Main layout to be recomputed. | |
bool | QueueObjectLayout (Area *area) |
Schedule a size computation cycle on an area before the rendering is performed. | |
void | AddObjectToRefreshList (Area *area) |
Deprecated. Replace with QueueObjectLayout. | |
bool | RemoveObjectFromLayoutQueue (Area *area) |
Remove an area from the list of object whose size was scheduled to be computed before the rendering cycle. | |
bool | RemoveObjectFromRefreshList (Area *area) |
Deprecated. Use RemoveObjectFromLayoutQueue. | |
void | RemoveQueuedLayout () |
Empty the queue of objects set for layout computation. | |
void | ComputeElementLayout (Area *bo, bool recurse_to_top_level_layout=false) |
Compute the layout of a specific element. | |
bool | IsInsideLayoutCycle () const |
Return true if the process is inside a layout cycle. | |
bool | IsComputingLayout () const |
Deprecated. Replace with IsInsideLayoutCycle. | |
bool | IsWaitingforModalWindow () |
bool | IsModalWindow () |
void | SetWindowStyle (WindowStyle wstyle) |
WindowStyle | GetWindowStyle () const |
virtual ThreadState | Start (void *arg=NULL) |
WindowCompositor & | GetWindowCompositor () |
float | GetFrameRate () const |
t_u32 | GetFrameCounter () const |
t_u32 | GetFramePeriodeCounter () const |
bool | IsEmbeddedWindow () |
void | RenderInterfaceFromForeignCmd (nux::Geometry *clip) |
virtual unsigned int | Run (void *) |
virtual bool | ThreadCtor () |
virtual bool | ThreadDtor () |
Layout * | GetMainLayout () |
Get the main layout of this thread. | |
void | AddTimeline (Timeline *timeline) |
void | RemoveTimeline (Timeline *timeline) |
bool | ProcessTimelines (GTimeVal *frame_time) |
void | StartMasterClock () |
void | StopMasterClock () |
void | NuxMainLoopQuit () |
void | SetFakeEventMode (bool enable) |
bool | InFakeEventMode () const |
void | ReadyFakeEventProcessing (void *) |
bool | ReadyForNextFakeEvent () const |
int | InstallEventInspector (EventInspector function, void *data) |
Set an event inspector function. | |
bool | RemoveEventInspector (int event_inspector_id) |
Remove an event inspector. | |
bool | RemoveEventInspector (EventInspector function) |
Remove an event inspector. | |
bool | CallEventInspectors (Event *event) |
Call event inspectors. | |
void | SetFocusedArea (Area *focused_area) |
Data Fields | |
long | _last_timeline_frame_time_sec |
long | _last_timeline_frame_time_usec |
void * | m_InitData |
void * | m_ExitData |
sigc::signal< void > | RedrawRequested |
bool | _inside_main_loop |
bool | _inside_timer_loop |
bool | _pending_wake_up_timer |
TimerFunctor * | _async_wake_up_functor |
TimerHandle | _async_wake_up_timer |
bool | _ready_for_next_fake_event |
bool | _processing_fake_event |
bool | _fake_event_mode |
TimerFunctor * | _fake_event_call_back |
TimerHandle | _fake_event_timer |
Protected Member Functions | |
void | ReconfigureLayout () |
Compute the layout of this window thread. | |
void | AsyncWakeUpCallback (void *) |
void | EnableMouseKeyboardInput () |
void | DisableMouseKeyboardInput () |
t_u32 | ExecutionLoop () |
virtual ThreadState | StartChildThread (NThread *thread, bool Modal) |
virtual void | AddChildThread (NThread *) |
virtual void | RemoveChildThread (NThread *) |
virtual void | ChildHasFinished (NThread *app) |
virtual void | TerminateAllChildThread () |
virtual ThreadState | SuspendChildGraphics (WindowThread *app) |
Protected Attributes | |
bool | m_bWaitForModalWindow |
WindowThread * | m_ModalWindowThread |
std::list< ThreadInfo * > | m_ChildThreadInfo |
Friends | |
class | BasePainter |
class | SystemThread |
class | TimerHandler |
WindowThread * | CreateGUIThread (const TCHAR *WindowTitle, t_u32 width, t_u32 height, WindowThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData) |
Create a main graphics thread. This thread has a window and no parent window (The Parent parameter should always be null). | |
WindowThread * | CreateWindowThread (WindowStyle WndStyle, const TCHAR *WindowTitle, t_u32 width, t_u32 height, WindowThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData) |
WindowThread * | CreateModalWindowThread (WindowStyle WndStyle, const TCHAR *WindowTitle, t_u32 width, t_u32 height, WindowThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData) |
SystemThread * | CreateSystemThread (AbstractThread *Parent, ThreadUserInitFunc UserInitFunc, void *InitData) |
nux::WindowThread::WindowThread | ( | const TCHAR * | WindowTitle, |
unsigned int | width, | ||
unsigned int | height, | ||
AbstractThread * | Parent, | ||
bool | Modal | ||
) |
nux::WindowThread::~WindowThread | ( | ) |
virtual void nux::WindowThread::AddChildThread | ( | NThread * | ) | [protected, virtual] |
Implements nux::AbstractThread.
void nux::WindowThread::AddObjectToRefreshList | ( | Area * | area | ) |
Deprecated. Replace with QueueObjectLayout.
void nux::WindowThread::AddTimeline | ( | Timeline * | timeline | ) |
Add a timeline to our window
void nux::WindowThread::AddToDrawList | ( | View * | view | ) |
void nux::WindowThread::AsyncWakeUpCallback | ( | void * | ) | [protected] |
bool nux::WindowThread::CallEventInspectors | ( | Event * | event | ) |
Call event inspectors.
Call event inspectors to have a look at the event.
virtual void nux::WindowThread::ChildHasFinished | ( | NThread * | app | ) | [protected, virtual] |
Implements nux::AbstractThread.
void nux::WindowThread::ClearDrawList | ( | ) |
void nux::WindowThread::ClearRedrawFlag | ( | ) |
void nux::WindowThread::ComputeElementLayout | ( | Area * | bo, |
bool | recurse_to_top_level_layout = false |
||
) |
Compute the layout of a specific element.
Immediate size negotiation for a View or a layout.
void nux::WindowThread::DisableMouseKeyboardInput | ( | ) | [protected] |
Enable Win32 Mouse and Keyboard inputs for this window thread and its child thread that are also window (not SystemThread).
void nux::WindowThread::EnableMouseKeyboardInput | ( | ) | [protected] |
Suspend Win32 Mouse and Keyboard inputs for this window thread and its child thread that are also window (not SystemThread).
t_u32 nux::WindowThread::ExecutionLoop | ( | ) | [protected] |
std::vector<Geometry> nux::WindowThread::GetDrawList | ( | ) |
t_u32 nux::WindowThread::GetFrameCounter | ( | ) | const |
t_u32 nux::WindowThread::GetFramePeriodeCounter | ( | ) | const |
float nux::WindowThread::GetFrameRate | ( | ) | const |
GraphicsEngine& nux::WindowThread::GetGraphicsEngine | ( | ) | const [inline] |
References nux::GraphicsDisplay::GetGraphicsEngine().
Layout* nux::WindowThread::GetMainLayout | ( | ) |
Get the main layout of this thread.
BasePainter& nux::WindowThread::GetPainter | ( | ) | const [inline] |
UXTheme& nux::WindowThread::GetTheme | ( | ) | const [inline] |
TimerHandler& nux::WindowThread::GetTimerHandler | ( | ) | const [inline] |
GraphicsDisplay& nux::WindowThread::GetWindow | ( | ) | const [inline] |
WindowCompositor& nux::WindowThread::GetWindowCompositor | ( | ) | [inline] |
WindowStyle nux::WindowThread::GetWindowStyle | ( | ) | const [inline] |
bool nux::WindowThread::InFakeEventMode | ( | ) | const |
Return True if the system is in accepting fake events.
int nux::WindowThread::InstallEventInspector | ( | EventInspector | function, |
void * | data | ||
) |
Set an event inspector function.
Inspect all events and returns the action to be taken for the event (process or discard).
If function as already been added, return its unique id.
If function is null, return 0.
function | Event inspector function callback. |
data | User defined data. |
bool nux::WindowThread::IsComputingLayout | ( | ) | const [inline] |
Deprecated. Replace with IsInsideLayoutCycle.
References IsInsideLayoutCycle().
bool nux::WindowThread::IsEmbeddedWindow | ( | ) |
bool nux::WindowThread::IsInsideLayoutCycle | ( | ) | const |
Return true if the process is inside a layout cycle.
Referenced by IsComputingLayout().
bool nux::WindowThread::IsModalWindow | ( | ) | [inline] |
References m_bWaitForModalWindow.
bool nux::WindowThread::IsRedrawNeeded | ( | ) | const |
bool nux::WindowThread::IsWaitingforModalWindow | ( | ) | [inline] |
References m_bWaitForModalWindow.
void nux::WindowThread::NuxMainLoopQuit | ( | ) |
void nux::WindowThread::ProcessDraw | ( | GraphicsEngine & | GfxContext, |
bool | force_draw | ||
) |
virtual long nux::WindowThread::ProcessEvent | ( | IEvent & | event, |
long | TraverseInfo, | ||
long | ProcessEventInfo | ||
) | [virtual] |
bool nux::WindowThread::ProcessTimelines | ( | GTimeVal * | frame_time | ) |
void nux::WindowThread::QueueMainLayout | ( | ) |
Causes the Main layout to be recomputed.
Causes the main layout to be recomputed. This will happen just before the next draw cycle.
bool nux::WindowThread::QueueObjectLayout | ( | Area * | area | ) |
Schedule a size computation cycle on an area before the rendering is performed.
This list contains the area whose size need to be computed.
area | The object that will perform a size computation cycle. |
void nux::WindowThread::ReadyFakeEventProcessing | ( | void * | ) |
Called when the timer set in PumpFakeEventIntoPipe expires.This is the signal that the main thread is ready to process the fake event.
bool nux::WindowThread::ReadyForNextFakeEvent | ( | ) | const |
Fake events are processed one after the other. While this function return false, PumpFakeEventIntoPipe should not be called.
void nux::WindowThread::ReconfigureLayout | ( | ) | [protected] |
Compute the layout of this window thread.
Reconfigure the layout of this window. Start by setting the size of the layout to the size of this window. ReconfigureLayout is executed following an event of type NUX_SIZE_CONFIGURATION or a call to QueueMainLayout.
virtual void nux::WindowThread::RemoveChildThread | ( | NThread * | ) | [protected, virtual] |
Implements nux::AbstractThread.
bool nux::WindowThread::RemoveEventInspector | ( | int | event_inspector_id | ) |
Remove an event inspector.
Remove the event inspector identified by the provided unique id.
event_inspector_id | Unique id for the event inspector. |
bool nux::WindowThread::RemoveEventInspector | ( | EventInspector | function | ) |
Remove an event inspector.
Remove the event inspector identified by the provided function.
function | Event inspector function callback. |
bool nux::WindowThread::RemoveObjectFromLayoutQueue | ( | Area * | area | ) |
Remove an area from the list of object whose size was scheduled to be computed before the rendering cycle.
area | The object to remove form the list. |
bool nux::WindowThread::RemoveObjectFromRefreshList | ( | Area * | area | ) |
Deprecated. Use RemoveObjectFromLayoutQueue.
void nux::WindowThread::RemoveQueuedLayout | ( | ) |
Empty the queue of objects set for layout computation.
The queue was filled with calls to QueueObjectLayout.
void nux::WindowThread::RemoveTimeline | ( | Timeline * | timeline | ) |
void nux::WindowThread::RenderInterfaceFromForeignCmd | ( | nux::Geometry * | clip | ) |
void nux::WindowThread::RequestRedraw | ( | ) |
virtual unsigned int nux::WindowThread::Run | ( | void * | ) | [virtual] |
Info: Override this method.
This function should contain the body/code of your thread. Notice the signature is similar to that of any worker thread function except for the calling convention.
Implements nux::AbstractThread.
void nux::WindowThread::RunUserInterface | ( | ) |
Start running the user interface.
void nux::WindowThread::SetFakeEventMode | ( | bool | enable | ) |
Enable the processing of fake events set through PumpFakeEventIntoPipe. Disable the processing of mouse up/down events coming from the display server. Process other mouse events normaly.
enable | True to enable fake events. |
void nux::WindowThread::SetFocusedArea | ( | Area * | focused_area | ) |
Sets the focused item on the screen
void nux::WindowThread::SetLayout | ( | Layout * | layout | ) |
Set the layout for this window thread.
layout | The layout of the user interface. |
void nux::WindowThread::SetWindowBackgroundPaintLayer | ( | AbstractPaintLayer * | bkg | ) |
void nux::WindowThread::SetWindowSize | ( | int | width, |
int | height | ||
) |
void nux::WindowThread::SetWindowStyle | ( | WindowStyle | wstyle | ) | [inline] |
void nux::WindowThread::SetWindowTitle | ( | const TCHAR * | WindowTitle | ) | [inline] |
virtual ThreadState nux::WindowThread::Start | ( | void * | arg = NULL | ) | [virtual] |
Info: Starts the thread.
This function starts the thread pointed by m_pThreadFunc with default attributes
Reimplemented from nux::NThread.
virtual ThreadState nux::WindowThread::StartChildThread | ( | NThread * | thread, |
bool | Modal | ||
) | [protected, virtual] |
Implements nux::AbstractThread.
void nux::WindowThread::StartMasterClock | ( | ) |
void nux::WindowThread::StopMasterClock | ( | ) |
virtual ThreadState nux::WindowThread::SuspendChildGraphics | ( | WindowThread * | app | ) | [protected, virtual] |
virtual void nux::WindowThread::TerminateAllChildThread | ( | ) | [protected, virtual] |
Implements nux::AbstractThread.
void nux::WindowThread::TerminateThread | ( | ) |
virtual bool nux::WindowThread::ThreadCtor | ( | ) | [virtual] |
Constructor-like function for the thread. Will be called by EntryPoint before executing the thread body. For the main window, ThreadCtor is called in nux::CreateMainWindow. ThreadCtor creates and initialize the following elements:
Reimplemented from nux::NThread.
virtual bool nux::WindowThread::ThreadDtor | ( | ) | [virtual] |
Destructor-like function for the thread. Will be called by EntryPoint after executing the thread body. After ThreadDtor is called, m_ThreadDtorCalled is set to true. ThreadDtor is also called in the destructor of the WindowThread but is protected by m_ThreadDtorCalled so it is not called twice. In the case of the main window, ThreadDtor is called in the destructor of WindowThread.
Reimplemented from nux::NThread.
friend class BasePainter [friend] |
WindowThread* CreateGUIThread | ( | const TCHAR * | WindowTitle, |
t_u32 | width, | ||
t_u32 | height, | ||
WindowThread * | Parent, | ||
ThreadUserInitFunc | UserInitFunc, | ||
void * | InitData | ||
) | [friend] |
Create a main graphics thread. This thread has a window and no parent window (The Parent parameter should always be null).
WindowThread* CreateModalWindowThread | ( | WindowStyle | WndStyle, |
const TCHAR * | WindowTitle, | ||
t_u32 | width, | ||
t_u32 | height, | ||
WindowThread * | Parent, | ||
ThreadUserInitFunc | UserInitFunc, | ||
void * | InitData | ||
) | [friend] |
SystemThread* CreateSystemThread | ( | AbstractThread * | Parent, |
ThreadUserInitFunc | UserInitFunc, | ||
void * | InitData | ||
) | [friend] |
WindowThread* CreateWindowThread | ( | WindowStyle | WndStyle, |
const TCHAR * | WindowTitle, | ||
t_u32 | width, | ||
t_u32 | height, | ||
WindowThread * | Parent, | ||
ThreadUserInitFunc | UserInitFunc, | ||
void * | InitData | ||
) | [friend] |
friend class SystemThread [friend] |
friend class TimerHandler [friend] |
bool nux::WindowThread::m_bWaitForModalWindow [protected] |
Referenced by IsModalWindow(), and IsWaitingforModalWindow().
std::list< ThreadInfo * > nux::WindowThread::m_ChildThreadInfo [protected] |
Reimplemented from nux::AbstractThread.
This pointer maybe set by the user in ThreadInitFunc and reused in ThreadExitFunc
Reimplemented from nux::AbstractThread.
WindowThread* nux::WindowThread::m_ModalWindowThread [protected] |
sigc::signal<void> nux::WindowThread::RedrawRequested |