nux-1.14.0
nux::WindowCompositor Class Reference

List of all members.

Classes

struct  RenderTargetTextures

Public Types

typedef ObjectWeakPtr< BaseWindowWeakBaseWindowPtr

Public Member Functions

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)
void SetKeyFocusArea (InputArea *area)
InputAreaGetKeyFocusArea ()
ObjectPtr
< IOpenGLFrameBufferObject > & 
GetWindowFrameBufferObject ()
ObjectPtr< IOpenGLBaseTextureGetScreenBlurTexture ()
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 TCHAR *TooltipText, int x, int y)
bool ValidateMouseInsideTooltipArea (int x, int y)
bool IsTooltipActive ()
void CancelTooltip ()
void SetAreaEventRoot (int x, int y)
const IEventGetCurrentEvent () const
void SetBackgroundPaintLayer (AbstractPaintLayer *bkg)
void SetAlwaysOnFrontWindow (BaseWindow *window)
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.

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

Friends

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

Detailed Description

Definition at line 45 of file WindowCompositor.h.


Member Function Documentation

bool nux::WindowCompositor::DisableExclusiveInputArea ( InputArea input_area)

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.
bool nux::WindowCompositor::EnableExclusiveInputArea ( InputArea input_area)

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.
BaseWindow* nux::WindowCompositor::GetProcessingTopView ( ) [inline]

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

Get the active ViewWindow during and event processing or rendering.

Definition at line 285 of file WindowCompositor.h.

References nux::ObjectWeakPtr< T >::GetPointer().

Referenced by nux::TimerHandler::AddTimerHandler(), RestoreRenderingSurface(), and nux::MenuPage::StartMenu().

    {
      return m_CurrentWindow.GetPointer();
    }
bool nux::WindowCompositor::GrabKeyboardAdd ( InputArea area)

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 2189 of file WindowCompositor.cpp.

References GetKeyboardGrabArea().

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

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

    if (GetWindow().KeyboardGrabData() != this)
    {
      result = GetWindow().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_->EmitEndKeyboardFocus();
        key_focus_area_->ResetUpwardPathToKeyFocusArea();

        if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
        {
          static_cast<InputArea*>(key_focus_area_)->OnKeyNavFocusChange.emit(key_focus_area_);
        }

        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;
  }
bool nux::WindowCompositor::GrabKeyboardRemove ( InputArea area)

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 2239 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())
    {
      GetWindow().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_->EmitEndKeyboardFocus();
        key_focus_area_->ResetUpwardPathToKeyFocusArea();

        if (key_focus_area_->Type().IsDerivedFromType(InputArea::StaticObjectType))
        {
          static_cast<InputArea*>(key_focus_area_)->OnKeyNavFocusChange.emit(key_focus_area_);
        }

        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;
  }
bool nux::WindowCompositor::GrabPointerAdd ( InputArea area)

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 2122 of file WindowCompositor.cpp.

References GetPointerGrabArea().

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

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

    if (result)
      pointer_grab_stack_.push_front(area);

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

    return result;
  }
bool nux::WindowCompositor::GrabPointerRemove ( InputArea area)

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 2145 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())
      GetWindow().UngrabPointer(this);
    
    // reset the mouse pointers areas.
    ResetMousePointerAreas();

    return true;
  }
bool nux::WindowCompositor::InExclusiveInputMode ( )

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

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

Definition at line 1228 of file WindowCompositor.cpp.

  {
    return _in_exclusive_input_mode;
  }
bool nux::WindowCompositor::IsTooltipActive ( )

Return true if there is a valid tooltip active.

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

Definition at line 1865 of file WindowCompositor.cpp.

  {
    NUX_RETURN_VALUE_IF_FALSE(m_TooltipArea, false);
    return true;
  }
void nux::WindowCompositor::ResetDnDArea ( )

Reset the DND focus area.

Set the DND focus area to NULL.

See also:
_dnd_area;

Definition at line 2091 of file WindowCompositor.cpp.

  {
    SetDnDArea(NULL);
  }
void nux::WindowCompositor::RestoreRenderingSurface ( )

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 2015 of file WindowCompositor.cpp.

References nux::GraphicsEngine::ApplyClippingRectangle(), nux::GpuDevice::CreateSystemCapableDeviceTexture(), GetProcessingTopView(), and nux::GraphicsEngine::SetOrthographicProjectionMatrix().

  {
    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);
        rt.depth_rt = GetGraphicsDisplay()->GetGpuDevice()->CreateSystemCapableDeviceTexture(buffer_width, buffer_height, 1, BITFMT_D24S8);
      }

      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();

      GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
      GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
      GetWindowThread()->GetGraphicsEngine().ApplyClippingRectangle();
      //GetWindowThread()->GetGraphicsEngine().ApplyModelViewMatrix(); ???
    }
    else
    {
      int buffer_width = GetWindowThread()->GetGraphicsEngine().GetWindowWidth();
      int buffer_height = GetWindowThread()->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();

      GetWindowThread()->GetGraphicsEngine().SetViewport(0, 0, buffer_width, buffer_height);
      GetWindowThread()->GetGraphicsEngine().SetOrthographicProjectionMatrix(buffer_width, buffer_height);
      GetWindowThread()->GetGraphicsEngine().ApplyClippingRectangle();
      //GetWindowThread()->GetGraphicsEngine().ApplyModelViewMatrix(); ???
    }
  }
void nux::WindowCompositor::SetAlwaysOnFrontWindow ( BaseWindow window)

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 1197 of file WindowCompositor.cpp.

  {
    _always_on_front_window = ObjectWeakPtr<BaseWindow> (window);

    EnsureAlwaysOnFrontWindow ();
  }
bool nux::WindowCompositor::ValidateMouseInsideTooltipArea ( int  x,
int  y 
)

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 1854 of file WindowCompositor.cpp.

References nux::Area::GetGeometry(), and nux::ObjectWeakPtr< T >::IsValid().

  {
    NUX_RETURN_VALUE_IF_FALSE(m_TooltipArea, false);
    NUX_RETURN_VALUE_IF_FALSE(_tooltip_window.IsValid(), false);

    Geometry geo = m_TooltipArea->GetGeometry();
    geo.OffsetPosition(_tooltip_window->GetBaseX(), _tooltip_window->GetBaseY());

    return geo.IsPointInside(x, y);
  }

Member Data Documentation

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 100 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 94 of file WindowCompositor.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends