Back to index

nux  3.0.0
Classes | Public Types | Public Member Functions | Public Attributes | Private Types | Private Member Functions | Private Attributes | Friends
nux::WindowCompositor Class Reference

A user interface composition class created by WindowThread. More...

#include <WindowCompositor.h>

Collaboration diagram for nux::WindowCompositor:
Collaboration graph
[legend]

List of all members.

Classes

struct  RenderTargetTextures

Public Types

typedef ObjectWeakPtr< BaseWindowWeakBaseWindowPtr

Public Member Functions

 WindowCompositor (WindowThread *window_thread)
 ~WindowCompositor ()
Geometry GetTooltipGeometry () const
 Get the Geometry of the tooltip based on the BaseWindow that initiated it.
Geometry GetTooltipMainWindowGeometry () const
 Get the Geometry of the tooltip based on the MainWindow.
void ProcessEvent (Event &event)
void MouseEventCycle (Event &event)
void DndEventCycle (Event &event)
Point GetMousePosition ()
 Get Mouse position relative to the top left corner of the window.
void KeyboardEventCycle (Event &event)
void MenuEventCycle (Event &event)
bool SetKeyFocusArea (InputArea *area, KeyNavDirection direction=KEY_NAV_NONE)
 Set the area that has the keyboard focus.
InputAreaGetKeyFocusArea ()
 Return the area that has the keyboard focus.
void SetReferenceFramebuffer (unsigned int fbo_object, Geometry fbo_geometry)
 Set and external fbo to draw Nux BaseWindow into.
bool RestoreReferenceFramebuffer ()
 Bind the reference opengl framebuffer object.
ObjectPtr
< IOpenGLFrameBufferObject > & 
GetWindowFrameBufferObject ()
void StartModalWindow (ObjectWeakPtr< BaseWindow >)
void StopModalWindow (ObjectWeakPtr< BaseWindow >)
void AddMenu (MenuPage *menu, BaseWindow *window, bool OverrideCurrentMenuChain=true)
void RemoveMenu (MenuPage *menu)
void CleanMenu ()
void PushModalWindow (ObjectWeakPtr< BaseWindow > window)
void SetWidgetDrawingOverlay (InputArea *ic, BaseWindow *OverlayWindow)
InputAreaGetWidgetDrawingOverlay ()
void SetTooltip (InputArea *TooltipArea, const char *TooltipText, int x, int y)
bool ValidateMouseInsideTooltipArea (int x, int y)
 Return true if the mouse is still inside the area that initiated the tooltip;.
bool IsTooltipActive ()
 Return true if there is a valid tooltip active.
void CancelTooltip ()
void SetAreaEventRoot (int x, int y)
void SetBackgroundPaintLayer (AbstractPaintLayer *bkg)
void SetAlwaysOnFrontWindow (BaseWindow *window)
 A special BaseWindow that is always on top of all other BaseWindow.
bool EnableExclusiveInputArea (InputArea *input_area)
 Enable the exclusive event input mode.
bool DisableExclusiveInputArea (InputArea *input_area)
 Disable the exclusive event input mode.
bool InExclusiveInputMode ()
 Return true if the system is in exclusive input event mode.
void RestoreRenderingSurface ()
 Set the rendering surface for the current rendering.
void * GetBackupTextureData (BaseWindow *base_window, int &width, int &height, int &format)
 Get the backup texture data of this BaseWindow,.
void ResetDnDArea ()
 Reset the DND focus area.
InputAreaGetDnDArea ()
BaseWindowGetProcessingTopView ()
 Get the top view that is being processed(event or rendering).
bool GrabPointerAdd (InputArea *area)
 Add an area at the top of the pointer grab stack.
bool GrabPointerRemove (InputArea *area)
 Remove an area from the pointer grab stack.
bool IsInPointerGrabStack (InputArea *area)
 Returns True if the area parameter is inside the pointer grab stack.
InputAreaGetPointerGrabArea ()
 Returns the area at the top of the pointer grab stack.
bool GrabKeyboardAdd (InputArea *area)
 Add an area at the top of the keyboard grab stack.
bool GrabKeyboardRemove (InputArea *area)
 Remove an area from the keyboard grab stack.
bool IsInKeyboardGrabStack (InputArea *area)
 Returns True if the area parameter is inside the keyboard grab stack.
InputAreaGetKeyboardGrabArea ()
 Returns the area at the top of the keyboard grab stack.
RenderTargetTexturesGetWindowBuffer (BaseWindow *window)
 Return the RenderTargetTextures structure of a BaseWindow.

Public Attributes

bool _enable_nux_new_event_architecture
Point _mouse_position_on_owner
Point _mouse_position
MenuPage_mouse_owner_menu_page
MenuPage_mouse_over_menu_page
bool _starting_menu_event_cycle
bool _menu_is_active
sigc::signal< void, BaseWindow * > sigVisibleViewWindow
 Signal emitted when a BaseWindow becomes visible.
sigc::signal< void, BaseWindow * > sigHiddenViewWindow
 Signal emitted when a BaseWindow becomes hidden.
ObjectPtr
< IOpenGLFrameBufferObject
m_FrameBufferObject

Private Types

typedef std::list
< WeakBaseWindowPtr
WindowList

Private Member Functions

void GetAreaUnderMouse (const Point &mouse_position, NuxEventType event_type, InputArea **area_under_mouse_pointer, BaseWindow **window)
 Traverse the widget tree and found the area that is right below the mouse pointer.
void FindKeyFocusArea (NuxEventType event_type, unsigned int key_symbol, unsigned int special_keys_state, InputArea **key_focus_area, BaseWindow **window)
 Traverse the widget tree and found the area has the key focus.
void FindKeyFocusAreaFrom (NuxEventType event_type, unsigned int key_symbol, unsigned int special_keys_state, InputArea *root_search_area, InputArea **key_focus_area, BaseWindow **window)
 Traverse the widget tree and found the area has the key focus, but start from a specified widget.
void ResetMousePointerAreas ()
AreaGetMouseOwnerArea ()
 Get the area upon which the mouse button is currently down.
void SetMouseOwnerArea (Area *area)
 Set the area upon which the mouse button is currently down.
void SetMouseOverArea (Area *area)
 Set the area that is right below the mouse pointer.
void SetMouseOwnerBaseWindow (BaseWindow *base_window)
 Set The BaseWindow of the area that is the mouse owner.
void OnMouseOverViewDestroyed (Object *area)
 Callback: called when mouse_over_area_ is destroyed.
void OnMouseOwnerViewDestroyed (Object *area)
 Callback: called when mouse_owner_area_ is destroyed.
void OnKeyNavFocusDestroyed (Object *area)
 Callback: called when key_focus_area_ is destroyed.
void OnMouseOwnerBaseWindowDestroyed (Object *area)
 Callback: called when mouse_owner_basewindow_connection_ is destroyed.
void SendKeyEvent (InputArea *input_area, NuxEventType event_type, unsigned int key_sym, unsigned long x11_key_code, unsigned long special_keys_state, const char *text, int key_repeat_count)
void Draw (bool SizeConfigurationEvent, bool force_draw)
 Render the interface.
void DrawPopup (bool force_draw)
void DrawMenu (bool force_draw)
void DrawOverlay (bool force_draw)
void DrawTooltip (bool force_draw)
void RenderTopViews (bool force_draw, std::list< ObjectWeakPtr< BaseWindow > > &WindowList, bool draw_modal)
 Render all top views.
void RenderTopViewContent (BaseWindow *window, bool force_draw)
 Render the content of a top view.
void RenderMainWindowComposition (bool force_draw)
void PresentBufferToScreen (ObjectPtr< IOpenGLBaseTexture > HWTexture, int x, int y, bool RenderToMainTexture, bool BluredBackground=false, float opacity=1.0f, bool premultiply=false)
 Render a textured quad the quad has the size of the texture.
void SetMainColorRT ()
 Set the main color render target as the texture to draw into.
void PushHigher (BaseWindow *top_floating_view, BaseWindow *bottom_floating_view, bool strict=false)
 Push a floating view just above another floating view.
void PushToFront (BaseWindow *bottom_floating_view)
 Push a floating view at the top of the stack.
void PushToBack (BaseWindow *bottom_floating_view)
 Push a floating view at the bottom of the stack.
BaseWindowGetSelectedWindow ()
 Returns the BaseWindow that is at the top of the BaseWindow stack, excluding the BaseWindow that is chosen to be always on to.
BaseWindowGetFocusAreaWindow ()
void SetProcessingTopView (BaseWindow *window)
 Set the top view that is about to be processed(event or rendering).
void SetFocusAreaWindow (BaseWindow *window)
void SetCurrentEvent (Event *event)
void EnsureAlwaysOnFrontWindow ()
void FormatRenderTargets (int width, int height)
void FloatingAreaConfigureNotify (int Width, int Height)
 Floating Area need to be informed when the main window has been resized.
void RegisterWindow (BaseWindow *)
void UnRegisterWindow (Object *)
void SetDnDArea (InputArea *area)
void ExecPendingExclusiveInputAreaAction ()
 Set the exclusive input area according to _pending_exclusive_input_mode_action.
InputAreaGetExclusiveInputArea ()
 Get the input area that has the exclusivity on events.
void BeforeDestructor ()
 Perform some action before destruction.
 WindowCompositor (const WindowCompositor &)
WindowCompositoroperator= (const WindowCompositor &)
WindowCompositoroperator& ()

Private Attributes

InputAreakey_focus_area_
 The InputArea that has the keyboard navigation focus.
InputAreamouse_owner_area_
InputAreamouse_over_area_
BaseWindowmouse_owner_base_window_
int dnd_safety_x_
int dnd_safety_y_
sigc::connection mouse_over_view_connection_
sigc::connection mouse_owner_view_connection_
sigc::connection mouse_owner_basewindow_connection_
sigc::connection key_focus_area_connection_
sigc::signal< void, Area
*, bool, KeyNavDirection
key_nav_focus_change
 This signal is similar to Area::key_nav_focus_change.
sigc::signal< void, Area * > key_nav_focus_activate
 This signal is similar to Area::key_nav_focus_activate.
ObjectPtr< IOpenGLBaseTexturem_MainColorRT
ObjectPtr< IOpenGLBaseTexturem_MainDepthRT
WeakBaseWindowPtr m_CurrentWindow
 BaseWindow where event processing or rendering is happening.
WeakBaseWindowPtr m_FocusAreaWindow
 The BaseWindow that contains the _mouse_focus_area.
WeakBaseWindowPtr m_MenuWindow
 The BaseWindow that owns the menu being displayed;.
Eventm_CurrentEvent
InputArea_mouse_over_area
 The base area that has the mouse directly over itself.
InputArea_previous_mouse_over_area
InputArea_dnd_area
 the area where the mouse is located during a DND action.
InputArea_exclusive_input_area
 The exclusive input area gets all events without exception(greedy).
bool _in_exclusive_input_mode
 _exclusive_input_area is true when there is an active greedy input area.
bool _pending_exclusive_input_mode_action
 The exclusive input mode starts after after events have been processed inside ProcessEvent().
bool inside_event_cycle_
 True while events are being processed inside ProcessEvent().
bool inside_rendering_cycle_
 True while inside the rendering cycle.
InputAreaOverlayDrawingCommand
WeakBaseWindowPtr m_OverlayWindow
 The window that owns the overlay;.
WeakBaseWindowPtr _tooltip_window
 The window that owns the tooltip;.
Geometry _tooltip_geometry
 The geometry of the entire tooltip It includes the decoration surrounding the text such as round corners.
Geometry _tooltip_mainwindow_geometry
 Same as _tooltip_geometry but based on the entire physical window of the application.
Geometry _tooltip_text_geometry
 The geometry of the text area of the tooltip.
Point _event_root
bool on_menu_closure_continue_with_event_
AbstractPaintLayerm_Background
WindowList _view_window_list
WindowList _modal_view_window_list
WeakBaseWindowPtr _always_on_front_window
 Floating view that always remains on top.
std::list< MenuPage * > * _menu_chain
WeakBaseWindowPtr m_SelectedWindow
 The BaseWindow where the last mouse down event happened.
std::map< BaseWindow *, struct
RenderTargetTextures
_window_to_texture_map
WeakBaseWindowPtr m_ModalWindow
Point m_MouseLastPos
Point m_MouseCurrentPos
bool m_PopupRemoved
bool m_MenuRemoved
bool m_MouseUp
bool m_MouseDown
int m_Width
int m_Height
NString m_TooltipText
InputAream_TooltipArea
int m_TooltipX
int m_TooltipY
unsigned int reference_fbo_
 The fbo to restore after Nux rendering in embedded mode.
Geometry reference_fbo_geometry_
std::list< InputArea * > pointer_grab_stack_
 Pointer grab stack.
std::list< InputArea * > keyboard_grab_stack_
 Keyboard grab stack.
WindowThreadwindow_thread_
 The WindowThread to which this object belongs.

Friends

class InputArea
class WindowThread
class TimerHandler
class MenuBar
class MenuPage
class BaseWindow
class HSplitter
class VSplitter
class TableCtrl
class View

Detailed Description

A user interface composition class created by WindowThread.

Definition at line 45 of file WindowCompositor.h.


Class Documentation

struct nux::WindowCompositor::RenderTargetTextures

Definition at line 395 of file WindowCompositor.h.

Collaboration diagram for nux::WindowCompositor::RenderTargetTextures:
Class Members
ObjectPtr< IOpenGLBaseTexture > color_rt
ObjectPtr< IOpenGLBaseTexture > depth_rt

Member Typedef Documentation

Definition at line 48 of file WindowCompositor.h.

Definition at line 588 of file WindowCompositor.h.


Constructor & Destructor Documentation

Definition at line 42 of file WindowCompositor.cpp.

  : window_thread_(window_thread)  
  , reference_fbo_(0)
  {
    m_FocusAreaWindow           = NULL;
    m_MenuWindow                = NULL;
    m_OverlayWindow             = NULL;
    _tooltip_window             = NULL;
    m_TooltipArea               = NULL;
    m_ModalWindow               = NULL;
    m_SelectedWindow            = NULL;
    _menu_chain                 = NULL;
    m_Background                = NULL;
    _tooltip_window             = NULL;
    m_OverlayWindow             = NULL;
    OverlayDrawingCommand       = NULL;
    m_CurrentWindow             = NULL;
    m_MenuWindow                = NULL;
    _mouse_over_area            = NULL;
    key_focus_area_             = NULL;
    _always_on_front_window     = NULL;
    inside_event_cycle_         = false;
    inside_rendering_cycle_     = false;
    _exclusive_input_area       = NULL;
    _in_exclusive_input_mode    = false;
    _pending_exclusive_input_mode_action = false;

    _dnd_area                   = NULL;
    mouse_over_area_            = NULL;
    mouse_owner_area_           = NULL;
    _mouse_over_menu_page       = NULL;
    _mouse_owner_menu_page      = NULL;
    mouse_owner_base_window_    = NULL;
    _starting_menu_event_cycle  = false;
    _menu_is_active             = false;
    _enable_nux_new_event_architecture   = true;
    on_menu_closure_continue_with_event_ = false;

    m_FrameBufferObject = GetGraphicsDisplay()->GetGpuDevice()->CreateFrameBufferObject();
    // Do not leave the Fbo binded. Deactivate it.
    m_FrameBufferObject->Deactivate();

    // At this stage, the size of the window may not be known yet.
    // FormatRenderTargets will be called the first time runtime gets into WindowThread::ExecutionLoop
    m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
    m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);

    _menu_chain = new std::list<MenuPage*>;
    m_PopupRemoved = false;
    m_MenuRemoved = false;
    m_ModalWindow = NULL;
    m_Background = new ColorLayer(Color(0xFF4D4D4D));
  }

Here is the call graph for this function:


Member Function Documentation

void nux::WindowCompositor::AddMenu ( MenuPage menu,
BaseWindow window,
bool  OverrideCurrentMenuChain = true 
)

Definition at line 1663 of file WindowCompositor.cpp.

  {
    if (_menu_chain->size() == 0)
    {
      // A menu is opening.
      _starting_menu_event_cycle = true;
      _menu_is_active = true;
    }

    std::list<MenuPage*>::iterator it = find(_menu_chain->begin(), _menu_chain->end(), menu);
    if (it == _menu_chain->end())
    {
      // When adding a MenuPage, make sure that it is a child of the MenuPage in _menu_chain->begin().
      if (_menu_chain->size())
      {
        if (menu->GetParentMenu() != (*_menu_chain->begin()))
        {
          if (OverrideCurrentMenuChain)
          {
            // Remove the current menu chain
            for (it = _menu_chain->begin(); it != _menu_chain->end(); it++)
            {
              // Stop all pages
              (*it)->StopMenu();
            }

            _menu_chain->clear();
          }
          else
          {
            // The MenuPage argument is not a descendent of the current menu chain.
            return;
          }
        }
      }

      m_MenuWindow = window;
      // The deepest menu is added in front of the list and tested first for events.
      _menu_chain->push_front(menu);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Perform some action before destruction.

Perform some action before destruction. This function should only be called from WindowThread::ThreadDtor(). It will invalidate the area that currently has the keyboard focus.

Definition at line 96 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1812 of file WindowCompositor.cpp.

  {
    _tooltip_window = NULL;
    m_TooltipArea = NULL;
    m_TooltipText = "";
  }

Definition at line 1727 of file WindowCompositor.cpp.

  {
    if (_menu_chain->size() == 0)
      return;

    std::list<MenuPage*>::iterator menu_it = _menu_chain->begin();

    while (menu_it != _menu_chain->end())
    {
      if ((*menu_it)->IsActive() == false)
      {
        menu_it = _menu_chain->erase(menu_it);
        m_MenuRemoved = true;
      }
      else
      {
        menu_it++;
      }
    }

    if (_menu_is_active && (_menu_chain->size() == 0))
    {
      _menu_is_active         = false;
      ResetMousePointerAreas();
      m_MenuWindow            = NULL;
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Disable the exclusive event input mode.

Disable the exclusive event input mode. It can only be disable if the current exclusive input area is passed as parameter.

See also:
EnableExclusiveInputArea.
Returns:
True, if the exclusive input mode was disabled.

Definition at line 310 of file WindowCompositor.cpp.

  {
    if (event.type == NUX_DND_MOVE)
    {
      InputArea* hit_area = NULL;
      BaseWindow* hit_base_window = NULL;

      GetAreaUnderMouse(Point(event.x, event.y), event.type, &hit_area, &hit_base_window);

      if (hit_area)
      {
        SetDnDArea(hit_area);
        hit_area->HandleDndMove(event);
      }
      else
      {
        ResetDnDArea();
      }
    }
    else if (event.type == NUX_DND_ENTER_WINDOW)
    {
      // do nothing for now
    }
    else if (event.type == NUX_DND_LEAVE_WINDOW)
    {
      ResetDnDArea();
    }
    else if (event.type == NUX_DND_DROP)
    {
      InputArea* current_dnd_area = GetDnDArea();
      if (current_dnd_area->GetAbsoluteGeometry().IsPointInside(event.x - event.x_root, event.y - event.y_root))
        current_dnd_area->HandleDndDrop(event);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::Draw ( bool  SizeConfigurationEvent,
bool  force_draw 
) [private]

Render the interface.

Definition at line 1235 of file WindowCompositor.cpp.

  {
    inside_rendering_cycle_ = true;
    if (!window_thread_->GetGraphicsDisplay().isWindowMinimized())
    {
      //int w, h;
      window_thread_->GetGraphicsEngine().GetContextSize(m_Width, m_Height);
      window_thread_->GetGraphicsEngine().SetViewport(0, 0, m_Width, m_Height);
      
      // Reset the Model view Matrix and the projection matrix
      window_thread_->GetGraphicsEngine().ResetProjectionMatrix();
      
      window_thread_->GetGraphicsEngine().ResetModelViewMatrixStack();
      window_thread_->GetGraphicsEngine().Push2DTranslationModelViewMatrix(0.0f, 0.0f, 0.0f);


      if (force_draw || SizeConfigurationEvent)
      {
        // We fall here after something dramatic has happen to the window such as a resizing. In this case
        // everything must be rendered. This is very costly and should happen rarely.
        if (!window_thread_->IsEmbeddedWindow())
          RenderMainWindowComposition(true);

        {
          RenderTopViews(true, _view_window_list, false);
          RenderTopViews(true, _modal_view_window_list, true);

          DrawMenu(true);
          DrawTooltip(true);
          DrawOverlay(true);
        }
      }
      else if (m_PopupRemoved || m_MenuRemoved)
      {
        // A popup removed cause the whole window to be dirty(at least some part of it).
        // So exchange DrawList with a real Draw.
        if (!window_thread_->IsEmbeddedWindow())
          RenderMainWindowComposition(false);

        {
          RenderTopViews(false, _view_window_list, false);
          RenderTopViews(false, _modal_view_window_list, true);

          DrawMenu(true);
          DrawTooltip(true);
          DrawOverlay(true);
        }
      }
      else
      {
        if (!window_thread_->IsEmbeddedWindow())
          RenderMainWindowComposition(false);

        {
          RenderTopViews(false, _view_window_list, false);
          RenderTopViews(false, _modal_view_window_list, true);

          DrawMenu(true);
          DrawTooltip(true);
          DrawOverlay(true);
        }
      }

      m_PopupRemoved = false;
      m_MenuRemoved = false;

      window_thread_->GetGraphicsEngine().Pop2DWindow();
    }
    inside_rendering_cycle_ = false;
  }

Here is the call graph for this function:

void nux::WindowCompositor::DrawMenu ( bool  force_draw) [private]

Definition at line 1306 of file WindowCompositor.cpp.

  {
    ObjectWeakPtr<BaseWindow> window = m_MenuWindow;

    if (window.IsValid())
    {
      //window_thread_->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_thread_->GetGraphicsEngine().GetWindowWidth(),
          window_thread_->GetGraphicsEngine().GetWindowHeight());
      window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    }
    else
    {
      window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_thread_->GetGraphicsEngine().GetWindowWidth(),
          window_thread_->GetGraphicsEngine().GetWindowHeight());
      window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    }

    std::list<MenuPage*>::reverse_iterator rev_it_menu;

    for (rev_it_menu = _menu_chain->rbegin(); rev_it_menu != _menu_chain->rend( ); rev_it_menu++)
    {
      SetProcessingTopView(m_MenuWindow.GetPointer());
      (*rev_it_menu)->ProcessDraw(window_thread_->GetGraphicsEngine(), force_draw);
      SetProcessingTopView(NULL);
    }

//     GetGraphicsDisplay()->GetGraphicsEngine()->SetContext(0, 0,
//                                             window_thread_->GetGraphicsEngine().GetWindowWidth(),
//                                             window_thread_->GetGraphicsEngine().GetWindowHeight());
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::DrawOverlay ( bool  force_draw) [private]

Definition at line 1338 of file WindowCompositor.cpp.

  {
    ObjectWeakPtr<BaseWindow> window = m_OverlayWindow;
    int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
    int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();

    if (window.IsValid())
    {
      //window_thread_->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    }
    else
      window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);

    if (OverlayDrawingCommand)
    {
      SetProcessingTopView(m_OverlayWindow.GetPointer());
      OverlayDrawingCommand->OverlayDrawing(window_thread_->GetGraphicsEngine());
      SetProcessingTopView(NULL);
    }

    //GetGraphicsDisplay()->GetGraphicsEngine()->SetContext(0, 0, buffer_width, buffer_height);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::DrawPopup ( bool  force_draw) [private]
void nux::WindowCompositor::DrawTooltip ( bool  force_draw) [private]

Definition at line 1363 of file WindowCompositor.cpp.

  {
    ObjectWeakPtr<BaseWindow> window = _tooltip_window;
    int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
    int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();

    if (window.IsValid())
    {
      //window_thread_->GetGraphicsEngine().SetContext(x, y, buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    }
    else
      window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);

    if (m_TooltipText.Size())
    {
        //SetProcessingTopView(_tooltip_window);
        GetPainter().PaintShape(window_thread_->GetGraphicsEngine(), _tooltip_geometry, Color(0xA0000000), eSHAPE_CORNER_ROUND10, true);
        GetPainter().PaintTextLineStatic(window_thread_->GetGraphicsEngine(), GetSysBoldFont(), _tooltip_text_geometry, m_TooltipText, Color(0xFFFFFFFF));
        //SetProcessingTopView(NULL);
    }

    //GetGraphicsDisplay()->GetGraphicsEngine()->SetContext(0, 0, buffer_width, buffer_height);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Enable the exclusive event input mode.

Set the exclusive event input area(

See also:
_exclusive_input_area). The greedy input area gets all input events(mouse and keyboard). The exclusive input mode can only be set if there is no exclusive input area already set. To disable the exclusive input move, call DisableExclusiveInputArea with the current exclusive input area as parameter. The exclusive event input mode can only change once during the processing of one event. The change it again, you have to wait for the next event cycle.
DisableExclusiveInputArea.
Returns:
True, if the exclusive input mode was enabled.

Definition at line 1206 of file WindowCompositor.cpp.

  {
    // Do not re-order while we are traversing the list of BaseWindow.
    if (inside_event_cycle_)
      return;

    if (_always_on_front_window == NULL)
      return;

    WindowList::iterator always_top_it = find(_view_window_list.begin(), _view_window_list.end(), _always_on_front_window);
    if ((always_top_it != _view_window_list.end()) &&
        (always_top_it != _view_window_list.begin()) &&
        _always_on_front_window.IsValid())
    {
      _view_window_list.erase(always_top_it);
      _view_window_list.push_front(_always_on_front_window);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Set the exclusive input area according to _pending_exclusive_input_mode_action.

Following the event processing cycle, it is necessary to setup the exclusive input area is _pending_exclusive_input_mode_action is true. The exclusive input area status always takes effect after the event processing cycle.

void nux::WindowCompositor::FindKeyFocusArea ( NuxEventType  event_type,
unsigned int  key_symbol,
unsigned int  special_keys_state,
InputArea **  key_focus_area,
BaseWindow **  window 
) [private]

Traverse the widget tree and found the area has the key focus.

Definition at line 819 of file WindowCompositor.cpp.

  {
    *key_focus_area = NULL;
    *window = NULL;

    // Go through the list of BaseWindos and find the first area over which the mouse pointer is.
    WindowList::iterator window_it;
    window_it = _view_window_list.begin();
    while ((*key_focus_area == NULL) && (window_it != _view_window_list.end()))
    {
      if ((*window_it).IsValid() && (*window_it)->IsVisible())
      {
        *key_focus_area = NUX_STATIC_CAST(InputArea*, (*window_it)->FindKeyFocusArea(event_type, key_symbol, special_keys_state));
        if (key_focus_area)
        {
          // We have found an area. We are going to exit the while loop.
          *window = (*window_it).GetPointer();
        }
      }
      ++window_it;
    }

    // If key_focus_area is NULL, then try the main window layout.
    if (*key_focus_area == NULL)
    {
      Layout* main_window_layout = window_thread_->GetLayout();
      if (main_window_layout)
      {
        *key_focus_area = NUX_STATIC_CAST(InputArea*, main_window_layout->FindKeyFocusArea(event_type, key_symbol, special_keys_state));
      }
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::FindKeyFocusAreaFrom ( NuxEventType  event_type,
unsigned int  key_symbol,
unsigned int  special_keys_state,
InputArea root_search_area,
InputArea **  key_focus_area,
BaseWindow **  window 
) [private]

Traverse the widget tree and found the area has the key focus, but start from a specified widget.

Definition at line 856 of file WindowCompositor.cpp.

  {
    *key_focus_area = NULL;
    *window = NULL;

    if (root_search_area == NULL)
    {
      return;
    }

    *key_focus_area = NUX_STATIC_CAST(InputArea*, root_search_area->FindKeyFocusArea(event_type, key_symbol, special_keys_state));
    if (key_focus_area)
    {
      *window = NUX_STATIC_CAST(BaseWindow*, root_search_area->GetTopLevelViewWindow());
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::FloatingAreaConfigureNotify ( int  Width,
int  Height 
) [private]

Floating Area need to be informed when the main window has been resized.

Parameters:
WidthNew width of the window.
HeightNew height of the window.

Definition at line 1958 of file WindowCompositor.cpp.

  {
    WindowList::iterator it;

    for (it = _view_window_list.begin(); it != _view_window_list.end(); it++)
    {
      if (!(*it).IsValid())
        continue;
      if ((*it)->IsVisible())
      {
        (*it)->NotifyConfigurationChange(Width, Height);
      }
    }
  }
void nux::WindowCompositor::FormatRenderTargets ( int  width,
int  height 
) [private]

Definition at line 1973 of file WindowCompositor.cpp.

  {
    int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
    int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();

    nuxAssert(buffer_width >= 1);
    nuxAssert(buffer_height >= 1);

    m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
    m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);

    // Clear the buffer the first time...
    m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
    m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));
    m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));
    m_FrameBufferObject->Activate();

    CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
    CHECKGL(glClearDepth(1.0f));
    CHECKGL(glClearStencil(0));
    CHECKGL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
    m_FrameBufferObject->Deactivate();
    CHECKGL(glClearColor(0.0f, 0.0f, 0.0f, 0.0f));
    CHECKGL(glClearDepth(1.0f));
    CHECKGL(glClearStencil(0));
    CHECKGL(glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));

//     m_BlurTexture   = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(Max(buffer_width, 1), Max(buffer_height, 1), 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
//     m_FullSceneMip0 = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(Max(buffer_width / 2, 1), Max(buffer_height / 2, 1), 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
//     m_FullSceneMip1 = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(Max(buffer_width / 4, 1), Max(buffer_height / 4, 1), 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
//     m_FullSceneMip2 = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(Max(buffer_width / 8, 1), Max(buffer_height / 8, 1), 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::GetAreaUnderMouse ( const Point mouse_position,
NuxEventType  event_type,
InputArea **  area_under_mouse_pointer,
BaseWindow **  window 
) [private]

Traverse the widget tree and found the area that is right below the mouse pointer.

Definition at line 210 of file WindowCompositor.cpp.

  {
    *area_under_mouse_pointer = NULL;

    // Go through the list of BaseWindo and find the first area over which the
    // mouse pointer is.
    WindowList::iterator window_it;

    for (window_it = _view_window_list.begin(); window_it != _view_window_list.end(); ++window_it)
    {
      if ((*window_it).IsValid() && (*window_it)->IsVisible())
      {
        InputArea* area = static_cast<InputArea*>((*window_it)->FindAreaUnderMouse(mouse_position, event_type));
        if (area)
        {
          *area_under_mouse_pointer = area;
          *window = (*window_it).GetPointer();
          return;
        }
      }
    }

    // If area_under_mouse_pointer is NULL, then the mouse pointer is not over
    // any of the BaseWindow. Try the main window layout.
    if (*area_under_mouse_pointer == NULL)
    {
      Layout* main_window_layout = window_thread_->GetLayout();
      if (main_window_layout)
        *area_under_mouse_pointer = static_cast<InputArea*>(main_window_layout->FindAreaUnderMouse(mouse_position, event_type));
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void * nux::WindowCompositor::GetBackupTextureData ( BaseWindow base_window,
int &  width,
int &  height,
int &  format 
)

Get the backup texture data of this BaseWindow,.

Definition at line 2058 of file WindowCompositor.cpp.

  {
    width = height = format = 0;

    NUX_RETURN_VALUE_IF_NULL(base_window, 0);

    std::map<BaseWindow*, struct RenderTargetTextures>::iterator it;

    it = _window_to_texture_map.find(base_window);

    if (it == _window_to_texture_map.end())
    {
      return 0;
    }

    if ((*it).second.color_rt.IsNull())
    {
      return 0;
    }

    return (*it).second.color_rt->GetSurfaceData(0, width, height, format);
  }

Here is the caller graph for this function:

Definition at line 2108 of file WindowCompositor.cpp.

  {
    return _dnd_area;
  }

Here is the caller graph for this function:

Get the input area that has the exclusivity on events.

Returns:
The input area that has the exclusivity on all events.

Definition at line 1225 of file WindowCompositor.cpp.

  {
    return _exclusive_input_area;
  }

Definition at line 470 of file WindowCompositor.h.

Here is the call graph for this function:

Returns the area at the top of the keyboard grab stack.

Definition at line 2326 of file WindowCompositor.cpp.

  {
    if (keyboard_grab_stack_.size() == 0)
      return NULL;

    return (*keyboard_grab_stack_.begin());
  }

Here is the caller graph for this function:

Return the area that has the keyboard focus.

Return the area that has the keyboard focus.

Returns:
The area that has the keyboard focus.

Definition at line 1947 of file WindowCompositor.cpp.

  {
    return key_focus_area_;
  }

Here is the caller graph for this function:

Get the area upon which the mouse button is currently down.

Definition at line 191 of file WindowCompositor.cpp.

  {
    return mouse_owner_area_;
  }

Get Mouse position relative to the top left corner of the window.

Definition at line 197 of file WindowCompositor.cpp.

  {
    return _mouse_position;
  }

Here is the caller graph for this function:

Returns the area at the top of the pointer grab stack.

Definition at line 2172 of file WindowCompositor.cpp.

  {
    if (pointer_grab_stack_.empty())
      return NULL;

    return (*pointer_grab_stack_.begin());
  }

Here is the caller graph for this function:

Get the top view that is being processed(event or rendering).

Get the active ViewWindow during and event processing or rendering.

Definition at line 330 of file WindowCompositor.h.

    {
      return m_CurrentWindow.GetPointer();
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Returns the BaseWindow that is at the top of the BaseWindow stack, excluding the BaseWindow that is chosen to be always on to.

See also:
m_SelectedWindow.
SetAlwaysOnFrontWindow

Definition at line 121 of file WindowCompositor.cpp.

Here is the call graph for this function:

Get the Geometry of the tooltip based on the BaseWindow that initiated it.

Definition at line 1802 of file WindowCompositor.cpp.

  {
    return _tooltip_geometry;
  }

Get the Geometry of the tooltip based on the MainWindow.

Definition at line 1807 of file WindowCompositor.cpp.

Definition at line 1761 of file WindowCompositor.cpp.

  {
    return OverlayDrawingCommand;
  }

Return the RenderTargetTextures structure of a BaseWindow.

Return the color and depth texture of a BaseWindow.

Parameters:
windowThe BaseWindow.
Returns:
A structure that contains the color and depth texture of a BaseWindow.

Definition at line 126 of file WindowCompositor.cpp.

  {
    static RenderTargetTextures invalid;
    std::map< BaseWindow*, RenderTargetTextures>::iterator it = _window_to_texture_map.find(window);

    if (it != _window_to_texture_map.end())
    {
      return it->second;
    }
    LOG_WARN(logger) << "No RenderTargetTextures for window.";
    return invalid;
  }

Here is the caller graph for this function:

Definition at line 230 of file WindowCompositor.h.

    {
      return m_FrameBufferObject;
    }

Add an area at the top of the keyboard grab stack.

Add an area at the top of the keyboard grab stack. The area at the top of the keyboard grab stack has the exclusivity on the keyboard events. And area can be added multiple times to the stack but not successively.

Parameters:
areaThe area to put at the top of the keyboard grab stack.
Returns:
True if the Area was successfully added at the top of the keyboard grab stack.

Definition at line 2180 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_NULL(area, false);
    bool result = true;

    if (GetKeyboardGrabArea() == area)
    {
      nuxDebugMsg("[WindowCompositor::GrabKeyboardAdd] The area already has the grab");
      return result;
    }

    if (window_thread_->GetGraphicsDisplay().KeyboardGrabData() != this)
    {
      result = window_thread_->GetGraphicsDisplay().GrabKeyboard(NULL, this, true);
    }
    
    if (result)
    {
      InputArea* current_keyboard_grab = GetKeyboardGrabArea();
      if (current_keyboard_grab)
        current_keyboard_grab->end_keyboard_grab.emit(current_keyboard_grab);

      keyboard_grab_stack_.push_front(area);
      
      // If there is any area with the key focus, cancel it.
      if (key_focus_area_)
      {
        key_focus_area_->end_key_focus.emit();
        key_focus_area_->ResetUpwardPathToKeyFocusArea();

        if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
        {
          // Signal emitted from the WindowCompositor.
          key_nav_focus_change.emit(key_focus_area_, false, KEY_NAV_NONE);
          // Signal emitted from the area itself.
          static_cast<InputArea*>(key_focus_area_)->key_nav_focus_change.emit(key_focus_area_, false, KEY_NAV_NONE);
          // nuxDebugMsg("[WindowCompositor::GrabKeyboardAdd] Area type '%s' named '%s': Lost key nav focus.",
          //   key_focus_area_->Type().name,
          //   key_focus_area_->GetBaseString().GetTCharPtr());

        }

        if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
        {
          static_cast<View*>(key_focus_area_)->QueueDraw();
        }
        key_focus_area_ = NULL;
      }
      // Must be called only after the area has been added to the front of keyboard_grab_stack_.
      SetKeyFocusArea(area);

      area->start_keyboard_grab.emit(area);
    }
    
    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Remove an area from the keyboard grab stack.

If the Area was added multiple time to the keyboard grab stack then the top most instance of the parameter area is removed.

Parameters:
areaThe area to remove from the top of the keyboard grab stack.
Returns:
True if the Area was successfully removed.

Definition at line 2237 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_NULL(area, false);

    std::list<InputArea*>::iterator it;

    // find the first instance of the area keyboard in the stack
    it = find(keyboard_grab_stack_.begin(), keyboard_grab_stack_.end(), area);

    if (it == keyboard_grab_stack_.end())
      return false;

    InputArea* current_keyboard_grab = (*it);
    bool has_grab = false;
    
    if (it == keyboard_grab_stack_.begin())
    {
      // At the top of the keyboard_grab_stack_. Means it has the keyboard grab.
      has_grab = true;
    }

    // First remove the area from the grab list
    keyboard_grab_stack_.erase(it);

    // Then emit end_keyboard_grab if the area had the keyboard grab
    if (has_grab && current_keyboard_grab)
    {
      current_keyboard_grab->end_keyboard_grab.emit(current_keyboard_grab);
    }

    if (keyboard_grab_stack_.empty())
    {
      window_thread_->GetGraphicsDisplay().UngrabKeyboard(this);
    }

    // Must be called only after the area has been added to the front of keyboard_grab_stack_.
    if (keyboard_grab_stack_.empty())
    {
      SetKeyFocusArea(NULL);
    }
    else
    {
      // If there is any area with the key focus, cancel it.
      if (key_focus_area_)
      {
        key_focus_area_->end_key_focus.emit();
        key_focus_area_->ResetUpwardPathToKeyFocusArea();

        if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
        {
          // Signal emitted from the WindowCompositor.
          key_nav_focus_change.emit(key_focus_area_, false, KEY_NAV_NONE);
          // Signal emitted from the area itself.
          static_cast<InputArea*>(key_focus_area_)->key_nav_focus_change.emit(key_focus_area_, false, KEY_NAV_NONE);
          // nuxDebugMsg("[WindowCompositor::GrabKeyboardRemove] Area type '%s' named '%s': Lost key nav focus.",
          //   key_focus_area_->Type().name,
          //   key_focus_area_->GetBaseString().GetTCharPtr());          
        }

        if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
        {
          static_cast<View*>(key_focus_area_)->QueueDraw();
        }
        key_focus_area_ = NULL;
      }
            
      it = keyboard_grab_stack_.begin();
      SetKeyFocusArea(*it);

      InputArea* new_keyboard_grab = (*it);
      new_keyboard_grab->start_keyboard_grab.emit(new_keyboard_grab);
    }
    
    return true;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Add an area at the top of the pointer grab stack.

Add an area at the top of the pointer grab stack. The area at the top of the pointer grab stack has the exclusivity on the pointer events. And area can be added multiple times to the stack but not successively.

Parameters:
areaThe area to put at the top of the pointer grab stack.
Returns:
True if the Area was successfully added at the top of the pointer grab stack.

Definition at line 2113 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_NULL(area, false);
    bool result = true;

    if (GetPointerGrabArea() == area)
    {
      nuxDebugMsg("[WindowCompositor::GrabPointerAdd] The area already has the grab");
      return result;
    }
    
    if (window_thread_->GetGraphicsDisplay().PointerGrabData() != this)
      result = window_thread_->GetGraphicsDisplay().GrabPointer(NULL, this, true);

    if (result)
      pointer_grab_stack_.push_front(area);

    // reset the mouse pointers areas.
    ResetMousePointerAreas();

    return result;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Remove an area from the pointer grab stack.

If the Area was added multiple time to the pointer grab stack then the top most instance of the parameter area is removed.

Parameters:
areaThe area to remove from the top of the pointer grab stack.
Returns:
True if the Area was successfully removed.

Definition at line 2136 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_NULL(area, false);

    std::list<InputArea*>::iterator it;

    // find the first instance of the area pointer in the stack
    it = find(pointer_grab_stack_.begin(), pointer_grab_stack_.end(), area);

    if (it == pointer_grab_stack_.end())
      return false;

    pointer_grab_stack_.erase(it);
    
    if (pointer_grab_stack_.empty())
      window_thread_->GetGraphicsDisplay().UngrabPointer(this);
    
    // reset the mouse pointers areas.
    ResetMousePointerAreas();

    return true;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Return true if the system is in exclusive input event mode.

Returns:
True if the system is in exclusive input mode.

Definition at line 1230 of file WindowCompositor.cpp.

Returns True if the area parameter is inside the keyboard grab stack.

Definition at line 2313 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_NULL(area, false);

    std::list<InputArea*>::iterator it;
    it = find(keyboard_grab_stack_.begin(), keyboard_grab_stack_.end(), area);

    if (it == keyboard_grab_stack_.end())
      return false;

    return true;
  }

Returns True if the area parameter is inside the pointer grab stack.

Definition at line 2159 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_NULL(area, false);

    std::list<InputArea*>::iterator it;
    it = find(pointer_grab_stack_.begin(), pointer_grab_stack_.end(), area);

    if (it == pointer_grab_stack_.end())
      return false;

    return true;
  }

Return true if there is a valid tooltip active.

Returns:
Return true if there is a valid tooltip active.

Definition at line 1830 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_FALSE(m_TooltipArea, false);
    return true;
  }

Definition at line 903 of file WindowCompositor.cpp.

  {
    InputArea* keyboard_event_grab_view = GetKeyboardGrabArea();

    InputArea* focus_area = NULL;   // The view under the mouse
    BaseWindow* base_window = NULL; // The BaseWindow below the mouse pointer.

    if (keyboard_event_grab_view)
    {
      // There is a keyboard grab.
      // Find the key focus area, under the keyboard grab area. That is to say, the key focus area is in the widget tree 
      // whose root is the keyboard grab area. This phase is known as the capture phase.
      
      FindKeyFocusAreaFrom(event.type, event.GetKeySym(), event.GetKeyState(),
        keyboard_event_grab_view,
        &focus_area,
        &base_window);
    }
    else
    {
      FindKeyFocusArea(event.type, event.GetKeySym(), event.GetKeyState(),
        &focus_area,
        &base_window);
    }

    KeyNavDirection direction = KEY_NAV_NONE;

    if (event.type == EVENT_KEY_DOWN)
    {
      switch(event.GetKeySym())
      {
      case NUX_VK_UP:
        direction = KEY_NAV_UP;
        break;
      case NUX_VK_DOWN:
        direction = KEY_NAV_DOWN;
        break;
      case NUX_VK_LEFT:
        direction = KEY_NAV_LEFT;
        break;
      case NUX_VK_RIGHT:
        direction = KEY_NAV_RIGHT;
        break;
      case NUX_VK_LEFT_TAB:
        direction = KEY_NAV_TAB_PREVIOUS;
        break;
      case NUX_VK_TAB:
        direction = KEY_NAV_TAB_NEXT;
        break;
      case NUX_VK_ENTER:
      case NUX_KP_ENTER:
        // Not sure if Enter should be a navigation key
        direction = KEY_NAV_ENTER;
        break;
      default:
        direction = KEY_NAV_NONE;
        break;
      }
    }

    if (focus_area)
    {
      SetKeyFocusArea(focus_area, direction);
    }
    else
    {
      SetKeyFocusArea(NULL, KEY_NAV_NONE);
    }

    if (key_focus_area_)
    {
      if (key_focus_area_->InspectKeyEvent(event.type, event.GetKeySym(), event.GetText()))
      {
        SendKeyEvent(key_focus_area_,
                    event.type,
                    event.GetKeySym(),
#if defined(NUX_OS_WINDOWS)
                    event.win32_keycode,
#elif defined(NUX_OS_LINUX)
                    event.x11_keycode,
#endif
                    event.GetKeyState(),
                    event.GetText(),
                    event.GetKeyRepeatCount());
      }
      else if (direction == KEY_NAV_NONE)
      {
        Area* parent = key_focus_area_->GetParentObject();

        while (parent && !parent->InspectKeyEvent(event.type, event.GetKeySym(), event.GetText()))
        {
          parent = parent->GetParentObject();
        }

        if (parent)
        {
          SendKeyEvent(static_cast<InputArea*>(parent),
            event.type,
            event.GetKeySym(),
#if defined(NUX_OS_WINDOWS)
            event.win32_keycode,
#elif defined(NUX_OS_LINUX)
            event.x11_keycode,
#endif
            event.GetKeyState(),
            event.GetText(),
            event.GetKeyRepeatCount());
        }
      }
      else if (event.type == NUX_KEYDOWN)
      {        
        if (direction == KEY_NAV_ENTER)
        {
          if (key_focus_area_ && key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
          {
            // Signal emitted from the WindowCompositor.
            key_nav_focus_activate.emit(key_focus_area_);
            // Signal emitted from the area itsel.
            static_cast<InputArea*>(key_focus_area_)->key_nav_focus_activate.emit(key_focus_area_);
          }
        }
        else
        {
          InputArea* key_nav_focus = NULL;
          Area* parent = key_focus_area_->GetParentObject();
          
          if (parent)
            key_nav_focus = NUX_STATIC_CAST(InputArea*, parent->KeyNavIteration(direction));
          
          while (key_nav_focus == NULL && parent != NULL)
          {
            parent = parent->GetParentObject();
            if (parent)
              key_nav_focus = NUX_STATIC_CAST(InputArea*, parent->KeyNavIteration(direction));
          }

          if (key_nav_focus)
          {
            SetKeyFocusArea(key_nav_focus, direction);
          }
        }
      }
    }
    else
    {
      // The event is for the Application itself
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 637 of file WindowCompositor.cpp.

  {
    // _mouse_owner_menu_page: the menu page that has the mouse down
    // _mouse_over_menu_page: the menu page that is directly below the mouse pointer

    _mouse_position = Point(event.x, event.y);

    if (_mouse_owner_menu_page == NULL)
    {
      if ((event.type == NUX_MOUSE_PRESSED) ||
        (event.type == NUX_MOUSE_RELEASED) ||
        (event.type == NUX_MOUSE_MOVE) ||
        (event.type == NUX_MOUSE_DOUBLECLICK) ||
        (event.type == NUX_MOUSE_WHEEL))
      {
        // Find the MenuPage under the mouse
        MenuPage* hit_menu_page = NULL;
        std::list<MenuPage*>::iterator menu_it;
        for (menu_it = _menu_chain->begin(); menu_it != _menu_chain->end(); menu_it++)
        {
          // The leaf of the menu chain is in the front of the list.
          hit_menu_page = NUX_STATIC_CAST(MenuPage*, (*menu_it)->FindAreaUnderMouse(Point(event.x, event.y), event.type));
          if (hit_menu_page)
          {
            break;
          }
        }

        Geometry hit_menu_page_geo;
        int hit_menu_page_x = 0;
        int hit_menu_page_y = 0;

        if (hit_menu_page)
        {
          hit_menu_page_geo = hit_menu_page->GetAbsoluteGeometry();
          hit_menu_page_x = event.x - hit_menu_page_geo.x;
          hit_menu_page_y = event.y - hit_menu_page_geo.y;
        }

        if (hit_menu_page && (event.type == NUX_MOUSE_RELEASED))
        {
          hit_menu_page->EmitMouseUpSignal(hit_menu_page_x, hit_menu_page_y, event.GetMouseState(), event.GetKeyState());

          (*_menu_chain->begin())->sigClosingMenu(*_menu_chain->begin());
          (*_menu_chain->begin())->StopMenu();
        }
        else if (hit_menu_page && (event.type == NUX_MOUSE_MOVE))
        {
          if (hit_menu_page != _mouse_over_menu_page)
          {
            if (_mouse_over_menu_page != 0)
            {
              Geometry geo = _mouse_over_menu_page->GetAbsoluteGeometry();
              int x = event.x - geo.x;
              int y = event.y - geo.y;

              _mouse_over_menu_page->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
            }

            _mouse_over_menu_page = hit_menu_page;
            _mouse_over_menu_page->EmitMouseEnterSignal(hit_menu_page_x, hit_menu_page_y, event.GetMouseState(), event.GetKeyState());
          }

          _mouse_over_menu_page->EmitMouseMoveSignal(hit_menu_page_x, hit_menu_page_y, event.dx, event.dy, event.GetMouseState(), event.GetKeyState());
        }
        else if (hit_menu_page && ((event.type == NUX_MOUSE_PRESSED) || (event.type == NUX_MOUSE_DOUBLECLICK)))
        {
          if (!hit_menu_page->DoubleClickEnabled())
          {

          }

          if (_mouse_over_menu_page && (hit_menu_page != _mouse_over_menu_page))
          {
            Geometry geo = _mouse_over_menu_page->GetAbsoluteGeometry();
            int x = event.x - geo.x;
            int y = event.y - geo.y;

            _mouse_over_menu_page->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
          }

          _mouse_over_menu_page = hit_menu_page;
          _mouse_owner_menu_page = hit_menu_page;
          _mouse_position_on_owner = Point(hit_menu_page_x, hit_menu_page_y);

          if (_mouse_over_menu_page != GetKeyFocusArea())
          {
            if (_mouse_over_menu_page->AcceptKeyboardEvent())
              SetKeyFocusArea(_mouse_over_menu_page);
          }

          _mouse_over_menu_page->EmitMouseDownSignal(hit_menu_page_x, hit_menu_page_y, event.GetMouseState(), event.GetKeyState());
        }
        else if (hit_menu_page && (event.type == NUX_MOUSE_WHEEL))
        {
          hit_menu_page->EmitMouseWheelSignal(hit_menu_page_x, hit_menu_page_y, event.wheel_delta, event.GetMouseState(), event.GetKeyState());
        }
        else if (hit_menu_page == NULL)
        {
          if (_mouse_over_menu_page)
          {
            Geometry geo = _mouse_over_menu_page->GetAbsoluteGeometry();
            int x = event.x - geo.x;
            int y = event.y - geo.y;

            _mouse_over_menu_page->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
          }

          if (event.type == NUX_MOUSE_PRESSED || event.type == NUX_MOUSE_DOUBLECLICK)
          {
            (*_menu_chain->begin())->sigClosingMenu(*_menu_chain->begin());
            (*_menu_chain->begin())->StopMenu();

            on_menu_closure_continue_with_event_ = (*_menu_chain->begin())->OnClosureContinueEventCycle();
          }
          _mouse_over_menu_page = 0;
        }
      }
    }
    else
    {
      // We should never get here for a NUX_MOUSE_PRESSED event.
      MenuPage* hit_menu_page = NULL;
      std::list<MenuPage*>::iterator menu_it;
      for (menu_it = _menu_chain->begin(); menu_it != _menu_chain->end(); menu_it++)
      {
        // The leaf of the menu chain is in the front of the list.
        hit_menu_page = NUX_STATIC_CAST(MenuPage*, (*menu_it)->FindAreaUnderMouse(Point(event.x, event.y), event.type));
        if (hit_menu_page)
        {
          break;
        }
      }

      Geometry mouse_owner_geo = _mouse_owner_menu_page->GetAbsoluteGeometry();
      int mouse_owner_x = event.x - mouse_owner_geo.x;
      int mouse_owner_y = event.y - mouse_owner_geo.y;

      // the mouse is down over a view
      if (event.type == NUX_MOUSE_MOVE)
      {
        int dx = mouse_owner_x - _mouse_position_on_owner.x;
        int dy = mouse_owner_y - _mouse_position_on_owner.y;

        _mouse_owner_menu_page->EmitMouseDragSignal(mouse_owner_x, mouse_owner_y, dx, dy, event.GetMouseState(), event.GetKeyState());

        if ((_mouse_over_menu_page == _mouse_owner_menu_page) && (hit_menu_page != _mouse_owner_menu_page))
        {
          _mouse_owner_menu_page->EmitMouseLeaveSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());
          _mouse_over_menu_page = hit_menu_page;
        }
        else if ((_mouse_over_menu_page != _mouse_owner_menu_page) && (hit_menu_page == _mouse_owner_menu_page))
        {
          _mouse_owner_menu_page->EmitMouseEnterSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());
          _mouse_over_menu_page = _mouse_owner_menu_page;
        }

        _mouse_position_on_owner = Point(mouse_owner_x, mouse_owner_y);
      }
      else if (event.type == NUX_MOUSE_RELEASED)
      {
        _mouse_owner_menu_page->EmitMouseUpSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());

        if (hit_menu_page == _mouse_owner_menu_page)
        {
          _mouse_owner_menu_page->EmitMouseClickSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());
          _mouse_over_menu_page = _mouse_owner_menu_page;
        }
        else
        {
          _mouse_over_menu_page = hit_menu_page;
        }

        (*_menu_chain->begin())->sigClosingMenu(*_menu_chain->begin());
        (*_menu_chain->begin())->StopMenu();

        _mouse_owner_menu_page = NULL;
        _mouse_position_on_owner = Point(0, 0);
      }
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 345 of file WindowCompositor.cpp.

  {
    // mouse_owner_area_: the view that has the mouse down
    // mouse_over_area_: the view that is directly below the mouse pointer

    int dx = event.x - _mouse_position.x;
    int dy = event.y - _mouse_position.y;

    _mouse_position = Point(event.x, event.y);

    if (mouse_owner_area_ == NULL)
    {
      // Context: The left mouse button is not down over an area.
      // We look for the area where the mouse pointer is located.
      
      // NUX_MOUSE_RELEASED is tipically processed in cases where mouse_owner_area_ is not NULL.
      // See below for the case when NUX_MOUSE_RELEASED is processed here while mouse_owner_area_ is NULL.
      if ((event.type == NUX_MOUSE_PRESSED) ||
        (event.type == NUX_MOUSE_MOVE) ||
        (event.type == NUX_MOUSE_DOUBLECLICK) ||
        (event.type == NUX_MOUSE_WHEEL) ||
        (event.type == NUX_WINDOW_MOUSELEAVE) ||
        (event.type == NUX_MOUSE_RELEASED))
      {
        InputArea* hit_view = NULL;         // The view under the mouse
        BaseWindow* hit_base_window = NULL; // The BaseWindow below the mouse pointer.

        // Look for the area below the mouse pointer in the BaseWindow.
        Area* pointer_grab_area = GetPointerGrabArea();
        if (pointer_grab_area)
        {
          // If there is a pending mouse pointer grab, test that area only
          hit_view = NUX_STATIC_CAST(InputArea*, pointer_grab_area->FindAreaUnderMouse(Point(event.x, event.y), event.type));
          if ((hit_view == NULL) && (event.type == NUX_MOUSE_PRESSED))
          {
            Geometry geo = pointer_grab_area->GetAbsoluteGeometry();
            int x = event.x - geo.x;
            int y = event.y - geo.y;

            NUX_STATIC_CAST(InputArea*, pointer_grab_area)->EmitMouseDownOutsideArea(x, y, event.GetMouseState(), event.GetKeyState());
          }
        }
        else
        {
          GetAreaUnderMouse(Point(event.x, event.y), event.type, &hit_view, &hit_base_window);
          SetMouseOwnerBaseWindow(hit_base_window);
        }

        Geometry hit_view_geo;
        int hit_view_x = 0;
        int hit_view_y = 0;

        if (hit_view)
        {
          hit_view_geo = hit_view->GetAbsoluteGeometry();
          hit_view_x = event.x - hit_view_geo.x;
          hit_view_y = event.y - hit_view_geo.y;
        }

        if (event.type == NUX_WINDOW_MOUSELEAVE)
        {
          if (mouse_over_area_ != NULL)
          {
            // The area where the mouse was in the previous cycle and the area returned by GetAreaUnderMouse are different.
            // The area from the previous cycle receive a "mouse leave signal".
            Geometry geo = mouse_over_area_->GetAbsoluteGeometry();
            int x = event.x - geo.x;
            int y = event.y - geo.y;

            mouse_over_area_->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
            SetMouseOverArea(NULL);
          }
        }
        else if (hit_view && (event.type == NUX_MOUSE_MOVE))
        {
          bool emit_delta = true;
          if (hit_view != mouse_over_area_)
          {
            if (mouse_over_area_ != NULL)
            {
              // The area where the mouse was in the previous cycle and the area returned by GetAreaUnderMouse are different.
              // The area from the previous cycle receive a "mouse leave signal".
              Geometry geo = mouse_over_area_->GetAbsoluteGeometry();
              int x = event.x - geo.x;
              int y = event.y - geo.y;

              mouse_over_area_->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
            }
            // The area we found under the mouse pointer receives a "mouse enter signal".
            SetMouseOverArea(hit_view);

            if (mouse_over_area_ != GetKeyFocusArea() &&
                mouse_over_area_ && mouse_over_area_->AcceptKeyNavFocusOnMouseEnter())
            {
              SetKeyFocusArea(mouse_over_area_);
            }
          
          
            mouse_over_area_->EmitMouseEnterSignal(hit_view_x, hit_view_y, event.GetMouseState(), event.GetKeyState());
            emit_delta = false;
          }

          // Send a "mouse mouse signal".
          mouse_over_area_->EmitMouseMoveSignal(hit_view_x, hit_view_y, emit_delta ? dx : 0, emit_delta ? dy : 0, event.GetMouseState(), event.GetKeyState());
        }
        else if (hit_view && ((event.type == NUX_MOUSE_PRESSED) || (event.type == NUX_MOUSE_DOUBLECLICK)))
        {
          if ((event.type == NUX_MOUSE_DOUBLECLICK) && (!hit_view->DoubleClickEnabled()))
          {
            // If the area does not accept double click events, transform the event into a mouse pressed.
            event.type = NUX_MOUSE_PRESSED;
          }

          bool emit_double_click_signal = false;
          if (mouse_over_area_ && (hit_view != mouse_over_area_))
          {
            // The area where the mouse was in the previous cycle and the area returned by GetAreaUnderMouse are different.
            // The area from the previous cycle receive a "mouse leave signal".
            // This case should be rare. I would happen if the mouse is over an area and that area is removed and reveals
            // a new area. If the next mouse event is a NUX_MOUSE_PRESSED, then the revealed area will be the one 
            // that is returned by GetAreaUnderMouse.
            Geometry geo = mouse_over_area_->GetAbsoluteGeometry();
            int x = event.x - geo.x;
            int y = event.y - geo.y;

            mouse_over_area_->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
          }
          else if (mouse_over_area_ && (hit_view == mouse_over_area_) && (event.type == NUX_MOUSE_DOUBLECLICK))
          {
            // Double click is emitted, if the second click happened on the same area as the first click.
            // This means mouse_over_area_ is not null and is equal to hit_view.
            emit_double_click_signal = true;
          }

          SetMouseOverArea(hit_view);
          SetMouseOwnerArea(hit_view);
          _mouse_position_on_owner = Point(hit_view_x, hit_view_y);

          // In the case of a mouse down event, if there is currently a keyboard event receiver and it is different
          // from the area returned by GetAreaUnderMouse, then stop that receiver from receiving anymore keyboard events and switch
          // make mouse_over_area_ the new receiver(if it accept keyboard events).
          if (mouse_over_area_ != GetKeyFocusArea() && 
              mouse_over_area_ && mouse_over_area_->AcceptKeyNavFocusOnMouseDown())
          {
            InputArea* grab_area = GetKeyboardGrabArea();
            if (grab_area)
            {
              if (mouse_over_area_->IsChildOf(grab_area) /*&& mouse_over_area_->AcceptKeyboardEvent()*/)
              {
                SetKeyFocusArea(mouse_over_area_);
              }
              else
              {
                SetKeyFocusArea(grab_area);
              }
            }
            else
            {
              SetKeyFocusArea(mouse_over_area_);
            }
          }

          if (emit_double_click_signal)
          {
            mouse_over_area_->EmitMouseDoubleClickSignal(hit_view_x, hit_view_y, event.GetMouseState(), event.GetKeyState());
          }
          else
          {
            mouse_over_area_->EmitMouseDownSignal(hit_view_x, hit_view_y, event.GetMouseState(), event.GetKeyState());
          }
        }
        else if (hit_view && (event.type == NUX_MOUSE_WHEEL))
        {
          hit_view->EmitMouseWheelSignal(hit_view_x, hit_view_y, event.wheel_delta, event.GetMouseState(), event.GetKeyState());
        }
        else if (hit_view && (event.type == NUX_MOUSE_RELEASED))
        {
          // We only get a NUX_MOUSE_RELEASED event when the mouse was pressed
          // over another area and released here. There are a few situations that can cause 
          // mouse_owner_area_ to be NULL on a NUX_MOUSE_RELEASED event:
          //  - The mouse down event happens on a area. That area is set into mouse_owner_area_.
          //    Then the area is destroyed, before the mouse is released.
          //  - The mouse down event happens. Then a call to AddGrabPointer triggers a call to 
          //    ResetMousePointerAreas. mouse_owner_area_ is then set to NULL.

          hit_view->EmitMouseUpSignal(hit_view_x, hit_view_y, event.GetMouseState(), event.GetKeyState());
        }
        else if (hit_view == NULL)
        {
          if (mouse_over_area_)
          {
            Geometry geo = mouse_over_area_->GetAbsoluteGeometry();
            int x = event.x - geo.x;
            int y = event.y - geo.y;

            // Mouse wheel events are stationary. The mouse can remain inside an area while the mouse wheel is spinning.
            // This shouldn't qualify as a mouse leave event.
            if (event.type != NUX_MOUSE_WHEEL)
            {
              mouse_over_area_->EmitMouseLeaveSignal(x, y, event.GetMouseState(), event.GetKeyState());
            }
          }

//           if (GetKeyFocusArea() && (event.type == NUX_MOUSE_PRESSED))
//           {
//             InputArea* grab_area = GetKeyFocusArea();
// 
//             if (grab_area)
//             {
//               SetKeyFocusArea(grab_area);
//             }
//             else
//             {
//               SetKeyFocusArea(NULL);
//             }
//           }
          SetMouseOverArea(NULL);
        }
      }
    }
    else
    {
      // Context: The left mouse button down over an area. All events goes to that area.
      // But we still need to know where the mouse is.

      InputArea* hit_view = NULL;         // The view under the mouse
      BaseWindow* hit_base_window = NULL; // The BaseWindow below the mouse pointer.

      GetAreaUnderMouse(Point(event.x, event.y), event.type, &hit_view, &hit_base_window);

      Geometry mouse_owner_geo = mouse_owner_area_->GetAbsoluteGeometry();
      int mouse_owner_x = event.x - mouse_owner_geo.x;
      int mouse_owner_y = event.y - mouse_owner_geo.y;

      // the mouse is down over a view
      if (event.type == NUX_MOUSE_MOVE)
      {
        int dx = mouse_owner_x - _mouse_position_on_owner.x;
        int dy = mouse_owner_y - _mouse_position_on_owner.y;

        if (mouse_owner_area_->_dnd_enabled_as_source)
        {
          dnd_safety_x_ += dx;
          dnd_safety_y_ += dy;

          if (abs(dnd_safety_y_) > 30 || abs(dnd_safety_x_) > 30)
          {
#ifdef NUX_OS_LINUX
            mouse_owner_area_->StartDragAsSource();
#endif
            ResetMousePointerAreas();
            return;
          }
        }
        else
        {
          mouse_owner_area_->EmitMouseDragSignal(mouse_owner_x, mouse_owner_y, dx, dy, event.GetMouseState(), event.GetKeyState());
        }

        if ((mouse_over_area_ == mouse_owner_area_) && (hit_view != mouse_owner_area_))
        {
          mouse_owner_area_->EmitMouseLeaveSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());
          SetMouseOverArea(hit_view);
        }
        else if ((mouse_over_area_ != mouse_owner_area_) && (hit_view == mouse_owner_area_))
        {
          mouse_owner_area_->EmitMouseEnterSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());
          SetMouseOverArea(mouse_owner_area_);
        }

        _mouse_position_on_owner = Point(mouse_owner_x, mouse_owner_y);
      }
      else if (event.type == NUX_MOUSE_RELEASED)
      {
        mouse_owner_area_->EmitMouseUpSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());

        if (hit_view == mouse_owner_area_)
        {
          mouse_owner_area_->EmitMouseClickSignal(mouse_owner_x, mouse_owner_y, event.GetMouseState(), event.GetKeyState());
          SetMouseOverArea(mouse_owner_area_);
        }
        else
        {
          SetMouseOverArea(hit_view);
        }

        SetMouseOwnerArea(NULL);
        _mouse_position_on_owner = Point(0, 0);
      }
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Callback: called when key_focus_area_ is destroyed.

Definition at line 1836 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Callback: called when mouse_over_area_ is destroyed.

Definition at line 245 of file WindowCompositor.cpp.

  {
    if (mouse_over_area_ == object)
    {
      mouse_over_area_ = NULL;
    }
  }

Here is the caller graph for this function:

Callback: called when mouse_owner_basewindow_connection_ is destroyed.

Definition at line 290 of file WindowCompositor.cpp.

  {
    if (mouse_owner_base_window_ == object)
    {
      mouse_owner_base_window_ = NULL;
    }
  }

Here is the caller graph for this function:

Callback: called when mouse_owner_area_ is destroyed.

Definition at line 265 of file WindowCompositor.cpp.

  {
    if (mouse_owner_area_ == object)
    {
      mouse_owner_area_ = NULL;
    }
  }

Here is the caller graph for this function:

WindowCompositor* nux::WindowCompositor::operator& ( ) [private]
WindowCompositor& nux::WindowCompositor::operator= ( const WindowCompositor ) [private]
void nux::WindowCompositor::PresentBufferToScreen ( ObjectPtr< IOpenGLBaseTexture HWTexture,
int  x,
int  y,
bool  RenderToMainTexture,
bool  BluredBackground = false,
float  opacity = 1.0f,
bool  premultiply = false 
) [private]

Render a textured quad the quad has the size of the texture.

The texture maybe the main window texture or a BaseWindow texture.

   @param HWTexture            Texture to render.
   @param x                    Coordinates of the top left corner of the quad.
   @param y                    Coordinates of the top left corner of the quad.
   @param RenderToMainTexture  If true, render to the main window texture. If false, render to the default back buffer.
   @param BluredBackground     If true, the texture is blended with the blurred version of the main window texture.

Definition at line 1596 of file WindowCompositor.cpp.

  {
    nuxAssert(HWTexture.IsValid());

    if (HWTexture.IsNull())
      return;

    int window_width, window_height;
    window_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
    window_height = window_thread_->GetGraphicsEngine().GetWindowHeight();


    if (RenderToMainTexture && (HWTexture != m_MainColorRT))
    {
      nuxAssert(m_MainColorRT->GetWidth() == window_width);
      nuxAssert(m_MainColorRT->GetHeight() == window_height);
      m_FrameBufferObject->FormatFrameBufferObject(window_width, window_height, BITFMT_R8G8B8A8);
      m_FrameBufferObject->SetRenderTarget( 0, m_MainColorRT->GetSurfaceLevel(0));
      m_FrameBufferObject->SetDepthSurface( m_MainDepthRT->GetSurfaceLevel(0));
      m_FrameBufferObject->Activate();
    }
    else
    {
      if (GetWindowThread()->IsEmbeddedWindow() && reference_fbo_)
      {
        // In the context of Unity, we may want Nux to restore a specific fbo and render the
        // BaseWindow texture into it. That fbo is called a reference framebuffer object. if a
        // Reference framebuffer object is present, Nux sets it.
        if (!RestoreReferenceFramebuffer())
        {
          nuxDebugMsg("[WindowCompositor::RenderTopViews] Setting the Reference fbo has failed.");
        }
      }
      else
      {
        GetGraphicsDisplay()->GetGpuDevice()->DeactivateFrameBuffer();
      }
    }

    window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, window_width, window_height);
    window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
    window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);

    // Render the MAINFBO
    {
      int src_width, src_height;
      src_width = HWTexture->GetWidth();
      src_height = HWTexture->GetHeight();

      TexCoordXForm texxform0;
      texxform0.FlipVCoord(true);

      if (premultiply)
      {
        window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(true, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
        GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, src_width, src_height, HWTexture, texxform0, Color(opacity, opacity, opacity, opacity));
      }
      else
      {
        window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(false);
        GetGraphicsDisplay()->GetGraphicsEngine()->QRP_1Tex(x, y, src_width, src_height, HWTexture, texxform0, Color(1.0f, 1.0f, 1.0f, opacity));
      }
      window_thread_->GetGraphicsEngine().GetRenderStates().SetBlend(false);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1053 of file WindowCompositor.cpp.

  {
    inside_event_cycle_ = true;
    if (_enable_nux_new_event_architecture)
    {
      if (((event.type >= NUX_MOUSE_PRESSED) && (event.type <= NUX_MOUSE_WHEEL)) ||
      (event.type == NUX_WINDOW_MOUSELEAVE))
      {
        bool menu_active = false;
        if (_menu_chain->size())
        {
          menu_active = true;
          MenuEventCycle(event);
          CleanMenu();
        }

        if ((menu_active && on_menu_closure_continue_with_event_) || !(menu_active))
        {
          MouseEventCycle(event);
        }

        on_menu_closure_continue_with_event_ = false;

        if (_starting_menu_event_cycle)
        {
          _starting_menu_event_cycle = false;
        }
      }
      else if ((event.type >= NUX_KEYDOWN) && (event.type <= NUX_KEYUP))
      {
        KeyboardEventCycle(event);
      }
      else if ((event.type >= NUX_DND_MOVE) && (event.type <= NUX_DND_LEAVE_WINDOW))
      {
        DndEventCycle(event);
      }
    }
    inside_event_cycle_ = false;
  }

Here is the call graph for this function:

void nux::WindowCompositor::PushHigher ( BaseWindow top_floating_view,
BaseWindow bottom_floating_view,
bool  strict = false 
) [private]

Push a floating view just above another floating view.

Note that only the top_floating_view is moving. The overall position of the reference view is not changing.

Parameters:
top_floating_viewThe view to place above bottom_floating_view.
top_floating_viewThe reference view that will be below top_floating_view.
strictIf true and top_floating_view is already above bottom_floating_view, then bring top_floating_view lower so that it is strictly above bottom_floating_view.

Definition at line 1153 of file WindowCompositor.cpp.

  {
    NUX_RETURN_IF_NULL(bottom_floating_view);
    NUX_RETURN_IF_NULL(top_floating_view);
    NUX_RETURN_IF_FALSE(bottom_floating_view != top_floating_view)

    WindowList::iterator it;
    WindowList::iterator it_top;
    WindowList::iterator it_bot;

    int i = 0;
    int top_pos = -1;
    int bot_pos = -1;

    for (it_top = _view_window_list.begin(), i = 0; it_top != _view_window_list.end(); it_top++, i++)
    {
      if (*it == bottom_floating_view)
      {
        it_bot = it;
        bot_pos = i;
      }

      if (*it == top_floating_view)
      {
        it_top = it;
        top_pos = i;
      }

      if ((top_pos >= 0) && (bot_pos >= 0))
        break;
    }

    if ((it_top == _view_window_list.end()) || (it_bot == _view_window_list.end()))
    {
      return;
    }

    if ((top_pos < bot_pos) && (strict == false))
    {
      _view_window_list.erase(it_top);
      _view_window_list.insert(it_bot, ObjectWeakPtr<BaseWindow> (top_floating_view));
    }

    EnsureAlwaysOnFrontWindow();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::PushToBack ( BaseWindow bottom_floating_view) [private]

Push a floating view at the bottom of the stack.

Definition at line 1133 of file WindowCompositor.cpp.

  {
    if (window == 0)
      return;

    if (window == _always_on_front_window)
      return;

    WindowList::iterator it = find(_view_window_list.begin(), _view_window_list.end(), window);

    if (it != _view_window_list.end())
    {
      _view_window_list.erase(it);
      _view_window_list.push_back(ObjectWeakPtr<BaseWindow> (window));
    }

    EnsureAlwaysOnFrontWindow();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::PushToFront ( BaseWindow bottom_floating_view) [private]

Push a floating view at the top of the stack.

Definition at line 1116 of file WindowCompositor.cpp.

  {
    if (window == 0)
      return;

    WindowList::iterator it = find(_view_window_list.begin(), _view_window_list.end(), window);

    if (it != _view_window_list.end())
    {
      _view_window_list.erase(it);
      _view_window_list.push_front(ObjectWeakPtr<BaseWindow> (window));
    }

    EnsureAlwaysOnFrontWindow();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::RegisterWindow ( BaseWindow window) [private]

Definition at line 139 of file WindowCompositor.cpp.

  {
    LOG_DEBUG_BLOCK(logger);
    if (!window)
      return;

    WindowList::iterator it = find(_view_window_list.begin(),
                                   _view_window_list.end(), window);
    if (it == _view_window_list.end())
    {
      _view_window_list.push_front(ObjectWeakPtr<BaseWindow>(window));
      m_SelectedWindow = window;

      RenderTargetTextures rt;

      // Don't size the texture to the dimension of the window yet. this will be done later.
      auto device = GetGraphicsDisplay()->GetGpuDevice();
      rt.color_rt = device->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
      rt.depth_rt = device->CreateSystemCapableDeviceTexture(2, 2, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);

      _window_to_texture_map[window] = rt;

      window->object_destroyed.connect(sigc::mem_fun(this, &WindowCompositor::UnRegisterWindow));
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 1706 of file WindowCompositor.cpp.

  {
    std::list<MenuPage*>::iterator it = find(_menu_chain->begin(), _menu_chain->end(), menu);

    if (it == _menu_chain->end())
    {
      return;
    }

    _menu_chain->erase(it);
    m_MenuRemoved = true;

    if (_menu_is_active && (_menu_chain->size() == 0))
    {
      // The menu is closed
      _menu_is_active         = false;
      ResetMousePointerAreas();
      m_MenuWindow            = NULL;
    }
  }

Here is the call graph for this function:

void nux::WindowCompositor::RenderMainWindowComposition ( bool  force_draw) [private]

Definition at line 1522 of file WindowCompositor.cpp.

  {
    int buffer_width, buffer_height;

    buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
    buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();

    if ((!m_MainColorRT.IsValid()) || (!m_MainDepthRT.IsValid()) || (m_MainColorRT->GetWidth() != buffer_width) || (m_MainColorRT->GetHeight() != buffer_height))
    {
      m_MainColorRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
      m_MainDepthRT = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
    }

    m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
    m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));
    m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));
    m_FrameBufferObject->Activate();

    window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);
    window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
    window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
    {
      CHECKGL(glClear(/*GL_COLOR_BUFFER_BIT |*/ GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
      //Begin 2D Drawing
      {
        if (force_draw)
        {
          GetPainter().PushDrawLayer(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background);
          //GetPainter().PushBackground(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background, true);

          window_thread_->ProcessDraw(window_thread_->GetGraphicsEngine(), true);

          nuxAssert(window_thread_->GetGraphicsEngine().GetNumberOfClippingRegions() == 0);
          GetPainter().PopBackground();
          GetPainter().EmptyBackgroundStack();
        }
        else
        {
          GetPainter().PushLayer(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background);
          //GetPainter().PushBackground(window_thread_->GetGraphicsEngine(), Geometry(0, 0, buffer_width, buffer_height), m_Background, false);

          window_thread_->ProcessDraw(window_thread_->GetGraphicsEngine(), false);

          nuxAssert(window_thread_->GetGraphicsEngine().GetNumberOfClippingRegions() == 0);
          GetPainter().PopBackground();
          GetPainter().EmptyBackgroundStack();
        }
      }
      // End 2D Drawing
    }

    if (key_focus_area_)
    {
      // key focus test
      Geometry geo= key_focus_area_->GetRootGeometry();
      //GetGraphicsDisplay()->GetGraphicsEngine()->QRP_Color(geo.x, geo.y, geo.width, geo.height, color::Blue);
    }

    window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
    m_FrameBufferObject->Deactivate();

    unsigned int window_width, window_height;
    window_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
    window_height = window_thread_->GetGraphicsEngine().GetWindowHeight();
    window_thread_->GetGraphicsEngine().EmptyClippingRegion();
    window_thread_->GetGraphicsEngine().SetOpenGLClippingRectangle(0, 0, window_width, window_height);
    window_thread_->GetGraphicsEngine().SetViewport(0, 0, window_width, window_height);
    window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(window_width, window_height);

    PresentBufferToScreen(m_MainColorRT, 0, 0, false);

  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::RenderTopViewContent ( BaseWindow window,
bool  force_draw 
) [private]

Render the content of a top view.

Definition at line 1389 of file WindowCompositor.cpp.

  {
    GetPainter().EmptyBackgroundStack();
    SetProcessingTopView(window);
    window->ProcessDraw(window_thread_->GetGraphicsEngine(), force_draw || window->IsRedrawNeeded());
    SetProcessingTopView(NULL);
    GetPainter().EmptyBackgroundStack();
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::RenderTopViews ( bool  force_draw,
std::list< ObjectWeakPtr< BaseWindow > > &  WindowList,
bool  draw_modal 
) [private]

Render all top views.

True if the entire surface of the backup rendering mush flushed. The list of top views. True if the top view that is modal is to be rendered.

Definition at line 1398 of file WindowCompositor.cpp.

  {
    // Before anything, deactivate the current frame buffer, set the viewport 
    // to the size of the display and call EmptyClippingRegion().
    // Then call GetScissorRect() to get the size of the global clipping area.
    // This is is hack until we implement SetGlobalClippingRectangle() (the opposite of SetGlobalClippingRectangle).
    GraphicsEngine& graphics_engine = window_thread_->GetGraphicsEngine();
    unsigned int window_width = graphics_engine.GetWindowWidth();
    unsigned int window_height = graphics_engine.GetWindowHeight();
    GetGraphicsDisplay()->GetGpuDevice()->DeactivateFrameBuffer();
    graphics_engine.SetViewport(0, 0, window_width, window_height);
    graphics_engine.EmptyClippingRegion();

    Geometry global_clip_rect = graphics_engine.GetScissorRect();
    global_clip_rect.y = window_height - global_clip_rect.y - global_clip_rect.height;

    // Always make a copy of the windows to render.  We have no control over
    // the windows we are actually drawing.  It has been observed that some
    // windows modify the windows stack during the draw process.
    //
    // So... we take a copy of the window list.  As much as I'd love to just
    // have BaseWindow* in the container, again, we have no control over the
    // windows we are drawing and one may just decide to unregister or destroy
    // another window mid-render.  Since we are contructing a copy of the
    // list, lets reverse it as we are constructing, as we want to draw the
    // windows from back to front.
    WindowList windows(windows_to_render.rbegin(), windows_to_render.rend());
    for (WindowList::iterator it = windows.begin(), end = windows.end(); it != end; ++it)
    {
      WeakBaseWindowPtr& window_ptr = *it;
      if (window_ptr.IsNull())
        continue;

      BaseWindow* window = window_ptr.GetPointer();
      if (!drawModal && window->IsModal())
        continue;

      if (window->IsVisible())
      {
        if (global_clip_rect.Intersect(window->GetGeometry()).IsNull())
        {
          // The global clipping area can be seen as a per monitor clipping
          // region. It is mostly used in embedded mode with compiz.  If we
          // get here, it means that the BaseWindow we want to render is not
          // in area of the monitor that compiz is currently rendering. So
          // skip it.
          continue;
        }

        RenderTargetTextures& rt = GetWindowBuffer(window);

        // Based on the areas that requested a rendering inside the
        // BaseWindow, render the BaseWindow or just use its cache.
        if (force_draw || window->IsRedrawNeeded() || window->ChildNeedsRedraw())
        {
          if (rt.color_rt.IsValid() /*&& rt.depth_rt.IsValid()*/)
          {
            int buffer_width = window->GetBaseWidth();
            int buffer_height = window->GetBaseHeight();

            if ((rt.color_rt->GetWidth() != buffer_width) ||
                (rt.color_rt->GetHeight() != buffer_height))
            {
              rt.color_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
              rt.depth_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
            }

            m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
            m_FrameBufferObject->SetRenderTarget( 0, rt.color_rt->GetSurfaceLevel(0));
            m_FrameBufferObject->SetDepthSurface( rt.depth_rt->GetSurfaceLevel(0));
            m_FrameBufferObject->Activate();
            graphics_engine.SetViewport(0, 0, buffer_width, buffer_height);
            graphics_engine.SetOrthographicProjectionMatrix(buffer_width, buffer_height);
            graphics_engine.EmptyClippingRegion();

            graphics_engine.SetOpenGLClippingRectangle(0, 0, buffer_width, buffer_height);

            CHECKGL( glClearColor(0, 0, 0, 0));
            GLuint clear_color_buffer_bit = (force_draw || window->IsRedrawNeeded()) ? GL_COLOR_BUFFER_BIT : 0;
            CHECKGL( glClear(clear_color_buffer_bit | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT));
          }
          else
          {
            int x = window->GetBaseX();
            int y = window->GetBaseY();
            Matrix4 mat;
            mat.Translate(x, y, 0);
            graphics_engine.SetOrthographicProjectionMatrix(window_width, window_height);
          }

          RenderTopViewContent(window, force_draw);
        }

        if (rt.color_rt.IsValid())
        {
          m_FrameBufferObject->Deactivate();

          // Nux is done rendering a BaseWindow into a texture. The previous call to Deactivate
          // has cancelled any opengl framebuffer object that was set.

          CHECKGL(glDepthMask(GL_FALSE));
          {
            graphics_engine.ApplyClippingRectangle();
            PresentBufferToScreen(rt.color_rt, window->GetBaseX(), window->GetBaseY(), false, false, window->GetOpacity(), window->premultiply());
          }
          CHECKGL(glDepthMask(GL_TRUE));
          graphics_engine.GetRenderStates().SetBlend(false);
        }

        window->_child_need_redraw = false;
      }
      else
      {
        // Invisible window, nothing to draw.
        window->_child_need_redraw = false;
        window->DoneRedraw();
      }
    }

    m_FrameBufferObject->Deactivate();
  }

Here is the caller graph for this function:

Reset the DND focus area.

Set the DND focus area to NULL.

See also:
_dnd_area;

Definition at line 2082 of file WindowCompositor.cpp.

  {
    SetDnDArea(NULL);
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 202 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Bind the reference opengl framebuffer object.

Returns:
True if no error was detected.

Definition at line 2340 of file WindowCompositor.cpp.

  {
    // It is assumed that the reference fbo contains valid textures.
    // Nux does the following:
    //    - Bind the reference fbo (reference_fbo_)
    //    - Call glDrawBuffer with GL_COLOR_ATTACHMENT0
    //    - Set the opengl viewport size (reference_fbo_geometry_)

    bool ok = false;

    CHECKGL(glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, reference_fbo_));
#ifndef NUX_OPENGLES_20
    CHECKGL(glDrawBuffer(GL_COLOR_ATTACHMENT0));
#endif
    CHECKGL(glViewport(reference_fbo_geometry_.x,
      reference_fbo_geometry_.y,
      reference_fbo_geometry_.width,
      reference_fbo_geometry_.height));

    // Nux does some sanity checks to make sure that the FBO is in good condition.
    GLenum status;
    status = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER_EXT);
    CHECKGL_MSG(glCheckFramebufferStatusEXT);

    switch(status)
    {
      case GL_FRAMEBUFFER_COMPLETE_EXT: // Everything's OK
        ok = true;
        break;
      case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT");
        ok = false;
        break;
      case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT");
        ok = false;
        break;
        // See issue(87) of http://www.opengl.org/registry/specs/EXT/framebuffer_object.txt
        //  case GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT:
        //      nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_DUPLICATE_ATTACHMENT_EXT");
        //      ok = false;
        //      break;
      case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT");
        ok = false;
        break;
#ifndef NUX_OPENGLES_20
      case GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT");
        ok = false;
        break;
      case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT");
        ok = false;
        break;
      case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT");
        ok = false;
        break;
#endif
      //  case GL_FRAMEBUFFER_STATUS_ERROR_EXT:
      //      nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_STATUS_ERROR_EXT");
      //      ok = false;
      //      break;
      case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
        nuxError("[GLFramebufferObject::IsValid] GL_FRAMEBUFFER_UNSUPPORTED_EXT");
        ok = false;
        break;
      default:
        nuxError("[GLFramebufferObject::IsValid] Unknown ERROR");
        ok = false;
    }    

    return ok;
  }

Here is the caller graph for this function:

Set the rendering surface for the current rendering.

This function is used to restore the rendering surface according to the system state. This is necessary after using a custom frame buffer object.

Definition at line 2006 of file WindowCompositor.cpp.

  {
    BaseWindow* top_view = GetProcessingTopView();

    if (top_view && inside_rendering_cycle_)
    {
      nuxAssert(top_view->Type().IsDerivedFromType(BaseWindow::StaticObjectType));

      RenderTargetTextures rt = GetWindowBuffer(top_view);

      int buffer_width = top_view->GetBaseWidth();
      int buffer_height = top_view->GetBaseHeight();

      nuxAssert(buffer_width >= 1);
      nuxAssert(buffer_height >= 1);

      if ((rt.color_rt->GetWidth() != buffer_width) || (rt.color_rt->GetHeight() != buffer_height))
      {
        rt.color_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_R8G8B8A8, NUX_TRACKER_LOCATION);
        rt.depth_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8, NUX_TRACKER_LOCATION);
      }

      m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
      m_FrameBufferObject->SetRenderTarget(0, rt.color_rt->GetSurfaceLevel(0));
      m_FrameBufferObject->SetDepthSurface(rt.depth_rt->GetSurfaceLevel(0));
      m_FrameBufferObject->Activate();

      window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().ApplyClippingRectangle();
      //window_thread_->GetGraphicsEngine().ApplyModelViewMatrix(); ???
    }
    else
    {
      int buffer_width = window_thread_->GetGraphicsEngine().GetWindowWidth();
      int buffer_height = window_thread_->GetGraphicsEngine().GetWindowHeight();

      nuxAssert(buffer_width >= 1);
      nuxAssert(buffer_height >= 1);
      // Restore Main Frame Buffer
      m_FrameBufferObject->FormatFrameBufferObject(buffer_width, buffer_height, BITFMT_R8G8B8A8);
      m_FrameBufferObject->SetRenderTarget(0, m_MainColorRT->GetSurfaceLevel(0));
      m_FrameBufferObject->SetDepthSurface(m_MainDepthRT->GetSurfaceLevel(0));
      m_FrameBufferObject->Activate();

      window_thread_->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
      window_thread_->GetGraphicsEngine().ApplyClippingRectangle();
      //window_thread_->GetGraphicsEngine().ApplyModelViewMatrix(); ???
    }
  }

Here is the call graph for this function:

void nux::WindowCompositor::SendKeyEvent ( InputArea input_area,
NuxEventType  event_type,
unsigned int  key_sym,
unsigned long  x11_key_code,
unsigned long  special_keys_state,
const char *  text,
int  key_repeat_count 
) [private]

Definition at line 878 of file WindowCompositor.cpp.

  {
    if (input_area == NULL)
      return;

    if (event_type == NUX_KEYDOWN)
    {
      input_area->EmitKeyEventSignal(event_type,
        key_sym,
        special_keys_state,
        text,
        key_repeat_count);
    }
    else if (event_type == NUX_KEYUP)
    {
      input_area->EmitKeyUpSignal(key_sym, x11_key_code, special_keys_state);
    }
  }

Here is the call graph for this function:

Here is the caller graph for this function:

A special BaseWindow that is always on top of all other BaseWindow.

It is even above the BaseWindow that is selected.

See also:
m_SelectedWindow,
GetSelectedWindow.

Definition at line 1199 of file WindowCompositor.cpp.

  {
    _always_on_front_window = ObjectWeakPtr<BaseWindow> (window);

    EnsureAlwaysOnFrontWindow();
  }

Here is the call graph for this function:

void nux::WindowCompositor::SetAreaEventRoot ( int  x,
int  y 
) [inline]

Definition at line 266 of file WindowCompositor.h.

    {
      _event_root = Point(x, y);
    }

Definition at line 1952 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::SetCurrentEvent ( Event event) [inline, private]

Definition at line 492 of file WindowCompositor.h.

    {
      m_CurrentEvent = event;
    }
void nux::WindowCompositor::SetDnDArea ( InputArea area) [private]

Definition at line 2087 of file WindowCompositor.cpp.

  {
#if defined(NUX_OS_LINUX)
    if (_dnd_area == area)
      return;

    if (_dnd_area)
    {
      _dnd_area->HandleDndLeave();
      _dnd_area->UnReference();
    }
    _dnd_area = area;
    
    if (_dnd_area)
    {
      _dnd_area->Reference();
      _dnd_area->HandleDndEnter();
    }
#endif
  }

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::SetFocusAreaWindow ( BaseWindow window) [inline, private]

Definition at line 487 of file WindowCompositor.h.

    {
      m_FocusAreaWindow = window;
    }

Set the area that has the keyboard focus.

Set the area that has the keyboard focus. If the area parameter is NULL,
the area that has the keyboard focus looses it and the function returns false.

Parameters:
Thearea that that gets the keyboard focus.
Thekey nav direction that initiated the focus to the provided area.
Returns:
True if the area succeeded to get the keyboard focus or it already has it.

Definition at line 1847 of file WindowCompositor.cpp.

  {
    InputArea* keyboard_grab_area = GetKeyboardGrabArea();

    if (keyboard_grab_area  && area && (area != keyboard_grab_area) && (!area->IsChildOf(keyboard_grab_area)))
    {
      // There is a keyboard grab pending. Only an area that is a child of the area that has
      // the keyboard grab can be set to receive keyboard events.
      nuxDebugMsg("[WindowCompositor::SetKeyFocusArea] There is a keyboard grab pending. Cannot change the keyboard event receiver.");
      return false;
    }

    if (key_focus_area_ == area)
    {
      // Already has the keyboard focus.
      return true;
    }

    if (area && (area->AcceptKeyNavFocus() == false))
    {
      // Area does not want the keyboard focus.
      return false;
    }

    if (key_focus_area_)
    {
      // This is the area that has the keyboard focus. Emit the signal 'end_key_focus'.
      key_focus_area_->end_key_focus.emit();

      // From the area that has the keyboard focus to the top level parent, delete the path that
      // leads to the keyboard focus area.
      key_focus_area_->ResetUpwardPathToKeyFocusArea();

      if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
      {
        // Signal emitted from the WindowCompositor.
        key_nav_focus_change.emit(key_focus_area_, false, direction);
        // Signal emitted from the area itself.
        static_cast<InputArea*>(key_focus_area_)->key_nav_focus_change.emit(key_focus_area_, false, direction);
        // nuxDebugMsg("[WindowCompositor::SetKeyFocusArea] Area type '%s' named '%s': Lost key nav focus.",
        //   key_focus_area_->Type().name,
        //   key_focus_area_->GetBaseString().GetTCharPtr());
      }

      if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
      {
        static_cast<View*>(key_focus_area_)->QueueDraw();
      }
    }

    if (area)
    {
      key_focus_area_ = area;

      // From the area that has the keyboard focus to the top level parent, mark the path that
      // leads to the keyboard focus area.
      key_focus_area_->SetPathToKeyFocusArea();

      // Emit the signal 'begin_key_focus'.
      key_focus_area_->begin_key_focus.emit();

      if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
      {
        // Signal emitted from the WindowCompositor.
        key_nav_focus_change.emit(key_focus_area_, true, direction);
        // Signal emitted from the area itself.
        static_cast<InputArea*>(key_focus_area_)->key_nav_focus_change.emit(key_focus_area_, true, direction);
        // nuxDebugMsg("[WindowCompositor::SetKeyFocusArea] Area type '%s' named '%s': Has key nav focus.",
        //   key_focus_area_->Type().name,
        //   key_focus_area_->GetBaseString().GetTCharPtr());
      }

      if (key_focus_area_->Type().IsDerivedFromType(View::StaticObjectType))
      {
        static_cast<View*>(key_focus_area_)->QueueDraw();
      }

      key_focus_area_->ChildFocusChanged.emit(key_focus_area_);

    }
    else
    {
      key_focus_area_ = NULL;
    }

    key_focus_area_connection_.disconnect();

    if (area)
    {
      key_focus_area_connection_ = area->object_destroyed.connect(sigc::mem_fun(this, &WindowCompositor::OnKeyNavFocusDestroyed));
    }

    if (key_focus_area_ == NULL)
    {
      return false;
    }

    return true;
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Set the main color render target as the texture to draw into.

void nux::WindowCompositor::SetMouseOverArea ( Area area) [private]

Set the area that is right below the mouse pointer.

Definition at line 253 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::SetMouseOwnerArea ( Area area) [private]

Set the area upon which the mouse button is currently down.

Definition at line 273 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

Set The BaseWindow of the area that is the mouse owner.

Definition at line 298 of file WindowCompositor.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void nux::WindowCompositor::SetProcessingTopView ( BaseWindow window) [inline, private]

Set the top view that is about to be processed(event or rendering).

Before event processing or rendering, this should be called to set the ViewWindow that is about to be processed. This function is used internally by the system.

Definition at line 480 of file WindowCompositor.h.

    {
      m_CurrentWindow = window;
    }

Here is the caller graph for this function:

void nux::WindowCompositor::SetReferenceFramebuffer ( unsigned int  fbo_object,
Geometry  fbo_geometry 
)

Set and external fbo to draw Nux BaseWindow into.

This external fbo will be restored after Nux completes it rendering. The external fbo is used only in embedded mode.
If the fbo_object parameter 0, then the reference fbo is invalid and will not be used.

Parameters:
fbo_objectThe opengl index of the fbo.
fbo_geometryThe geometry of the fbo.

Definition at line 2334 of file WindowCompositor.cpp.

  {
    reference_fbo_ = fbo_object;
    reference_fbo_geometry_ = fbo_geometry;
  }
void nux::WindowCompositor::SetTooltip ( InputArea TooltipArea,
const char *  TooltipText,
int  x,
int  y 
)

Definition at line 1755 of file WindowCompositor.cpp.

  {
    OverlayDrawingCommand = ic;
    m_OverlayWindow = OverlayWindow;
  }

Here is the caller graph for this function:

Definition at line 1093 of file WindowCompositor.cpp.

  {
    if (window == 0)
      return;

    WindowList::iterator it = find(_modal_view_window_list.begin(), _modal_view_window_list.end(), window);

    if (it == _modal_view_window_list.end())
    {
      _modal_view_window_list.push_front(window);
    }
  }

Here is the caller graph for this function:

Definition at line 1106 of file WindowCompositor.cpp.

  {
    if (_modal_view_window_list.size() > 0)
    {
      if (*_modal_view_window_list.begin() == window)
        _modal_view_window_list.pop_front();
    }
  }

Here is the caller graph for this function:

Definition at line 165 of file WindowCompositor.cpp.

  {
    LOG_DEBUG_BLOCK(logger);
    WeakBaseWindowPtr window(obj);
    if (window.IsNull())
      return;

    WindowList::iterator it = find(_view_window_list.begin(),
                                   _view_window_list.end(), window);
    if (it == _view_window_list.end())
    {
      // look for a weak pointer that has been cleared out.
      it = find(_view_window_list.begin(),
                _view_window_list.end(), WeakBaseWindowPtr());
    }

    if (it != _view_window_list.end())
    {
      _view_window_list.erase(it);

      if (_view_window_list.size())
        m_SelectedWindow = _view_window_list.front();
    }
    _window_to_texture_map.erase(window.GetPointer());
  }

Here is the call graph for this function:

Here is the caller graph for this function:

Return true if the mouse is still inside the area that initiated the tooltip;.

Parameters:
xThe mouse x coordinate on screen.
yThe mouse y coordinate on screen.
Returns:
Return true is the mouse is still inside the area.

Definition at line 1819 of file WindowCompositor.cpp.

Here is the call graph for this function:


Friends And Related Function Documentation

friend class BaseWindow [friend]

Definition at line 663 of file WindowCompositor.h.

friend class HSplitter [friend]

Definition at line 664 of file WindowCompositor.h.

friend class InputArea [friend]

Definition at line 658 of file WindowCompositor.h.

friend class MenuBar [friend]

Definition at line 661 of file WindowCompositor.h.

friend class MenuPage [friend]

Definition at line 662 of file WindowCompositor.h.

friend class TableCtrl [friend]

Definition at line 666 of file WindowCompositor.h.

friend class TimerHandler [friend]

Definition at line 660 of file WindowCompositor.h.

friend class View [friend]

Definition at line 667 of file WindowCompositor.h.

friend class VSplitter [friend]

Definition at line 665 of file WindowCompositor.h.

friend class WindowThread [friend]

Definition at line 659 of file WindowCompositor.h.


Member Data Documentation

Floating view that always remains on top.

Definition at line 591 of file WindowCompositor.h.

the area where the mouse is located during a DND action.

Definition at line 529 of file WindowCompositor.h.

Definition at line 69 of file WindowCompositor.h.

Definition at line 583 of file WindowCompositor.h.

The exclusive input area gets all events without exception(greedy).

The exclusive input area may decide to pass events down to other areas. If it does, the following restrictions apply:

  • The other input area cannot have the mouse focus.
  • They cannot have the keyboard focus.
  • No synthetic events: mouse click mouse drag
  • Only atomic events: mouse down mouse up mouse move mouse enter/leave

Definition at line 558 of file WindowCompositor.h.

_exclusive_input_area is true when there is an active greedy input area.

Definition at line 563 of file WindowCompositor.h.

Definition at line 593 of file WindowCompositor.h.

Definition at line 84 of file WindowCompositor.h.

Definition at line 590 of file WindowCompositor.h.

The base area that has the mouse directly over itself.

Definition at line 523 of file WindowCompositor.h.

Definition at line 82 of file WindowCompositor.h.

Definition at line 81 of file WindowCompositor.h.

Definition at line 73 of file WindowCompositor.h.

Definition at line 72 of file WindowCompositor.h.

The exclusive input mode starts after after events have been processed inside ProcessEvent().

This flags signals that some action are required to enable/disable the exclusive input mode.

Definition at line 569 of file WindowCompositor.h.

Definition at line 524 of file WindowCompositor.h.

Definition at line 83 of file WindowCompositor.h.

The geometry of the entire tooltip It includes the decoration surrounding the text such as round corners.

Definition at line 580 of file WindowCompositor.h.

Same as _tooltip_geometry but based on the entire physical window of the application.

Definition at line 581 of file WindowCompositor.h.

The geometry of the text area of the tooltip.

Definition at line 582 of file WindowCompositor.h.

The window that owns the tooltip;.

Definition at line 579 of file WindowCompositor.h.

Definition at line 589 of file WindowCompositor.h.

Definition at line 602 of file WindowCompositor.h.

Definition at line 185 of file WindowCompositor.h.

Definition at line 186 of file WindowCompositor.h.

True while events are being processed inside ProcessEvent().

Definition at line 572 of file WindowCompositor.h.

True while inside the rendering cycle.

Definition at line 575 of file WindowCompositor.h.

The InputArea that has the keyboard navigation focus.

The InputArea that has the mouse focus also has the keyboard focus. That is if _mouse_focus_area is not Null then _mouse_focus_area is equal to _mouse_focus_area;

Definition at line 180 of file WindowCompositor.h.

Definition at line 191 of file WindowCompositor.h.

sigc::signal<void, Area*> nux::WindowCompositor::key_nav_focus_activate [private]

This signal is similar to Area::key_nav_focus_activate.

It is emitted from the WindowCompositor. The user only needs to listen to this signal to find out the area that has has been activated through the keyboard (ENTER key has been pressed).

Definition at line 208 of file WindowCompositor.h.

sigc::signal<void, Area*, bool, KeyNavDirection> nux::WindowCompositor::key_nav_focus_change [private]

This signal is similar to Area::key_nav_focus_change.

It is emitted from the WindowCompositor. The user only needs to listen to this signal to find out the area that has received the keyboard focus.
The signal is received whether the area receiving or loosing the keyboard focus.
If the second parameter is true, it means the area is receiving the focus.
The third parameter of this signal indicates the keyboard action that triggered this area
to receive or loose the keyboard focus.

Definition at line 201 of file WindowCompositor.h.

Keyboard grab stack.

The head of the list is the top of the stack.

See also:
GrabKeyboardAdd, GrabKeyboardRemove.

Definition at line 640 of file WindowCompositor.h.

Definition at line 586 of file WindowCompositor.h.

Definition at line 521 of file WindowCompositor.h.

BaseWindow where event processing or rendering is happening.

Definition at line 518 of file WindowCompositor.h.

The BaseWindow that contains the _mouse_focus_area.

Definition at line 519 of file WindowCompositor.h.

Definition at line 235 of file WindowCompositor.h.

Definition at line 615 of file WindowCompositor.h.

Definition at line 515 of file WindowCompositor.h.

Definition at line 516 of file WindowCompositor.h.

Definition at line 609 of file WindowCompositor.h.

The BaseWindow that owns the menu being displayed;.

Definition at line 520 of file WindowCompositor.h.

Definition at line 604 of file WindowCompositor.h.

Definition at line 606 of file WindowCompositor.h.

Definition at line 611 of file WindowCompositor.h.

Definition at line 605 of file WindowCompositor.h.

Definition at line 610 of file WindowCompositor.h.

The window that owns the overlay;.

Definition at line 578 of file WindowCompositor.h.

Definition at line 608 of file WindowCompositor.h.

The BaseWindow where the last mouse down event happened.

This BaseWindow will be raised to the top of the stack.

See also:
GetSelectedWindow.

Definition at line 600 of file WindowCompositor.h.

Definition at line 618 of file WindowCompositor.h.

Definition at line 617 of file WindowCompositor.h.

Definition at line 619 of file WindowCompositor.h.

Definition at line 620 of file WindowCompositor.h.

Definition at line 614 of file WindowCompositor.h.

Definition at line 182 of file WindowCompositor.h.

Definition at line 188 of file WindowCompositor.h.

Definition at line 181 of file WindowCompositor.h.

Definition at line 183 of file WindowCompositor.h.

Definition at line 190 of file WindowCompositor.h.

Definition at line 189 of file WindowCompositor.h.

Definition at line 585 of file WindowCompositor.h.

Definition at line 577 of file WindowCompositor.h.

Pointer grab stack.

The head of the list is the top of the stack.

See also:
GrabPointerAdd, GrabPointerRemove.

Definition at line 632 of file WindowCompositor.h.

unsigned int nux::WindowCompositor::reference_fbo_ [private]

The fbo to restore after Nux rendering in embedded mode.

Definition at line 623 of file WindowCompositor.h.

Definition at line 624 of file WindowCompositor.h.

Signal emitted when a BaseWindow becomes hidden.

This signal is emitted after the BaseWindow has emitted it own sigHidden signal. Signal emitted when the BaseWindow becomes hidden.

Definition at line 116 of file WindowCompositor.h.

Signal emitted when a BaseWindow becomes visible.

This signal is emitted after the BaseWindow has emitted it own sigVisible signal. Signal emitted when the BaseWindow becomes visible.

Definition at line 110 of file WindowCompositor.h.

The WindowThread to which this object belongs.

Definition at line 643 of file WindowCompositor.h.


The documentation for this class was generated from the following files: