nux-1.14.0
nux::BaseWindow Class Reference

#include <Nux/BaseWindow.h>

Inheritance diagram for nux::BaseWindow:
nux::View nux::InputArea nux::Area nux::InitiallyUnownedObject nux::Focusable nux::Object nux::Trackable nux::Introspectable nux::FloatingWindow nux::Tooltip nux::Dialog nux::PopUpWindow nux::ColorPickerDialog

List of all members.

Public Member Functions

 BaseWindow (const TCHAR *WindowName=TEXT(""), NUX_FILE_LINE_PROTO)
virtual AreaFindAreaUnderMouse (const Point &mouse_position, NuxEventType event_type)
virtual long ProcessEvent (IEvent &ievent, long TraverseInfo, long ProcessEventInfo)
virtual void Draw (GraphicsEngine &GfxContext, bool force_draw)
virtual void DrawContent (GraphicsEngine &GfxContext, bool force_draw)
virtual void PostDraw (GraphicsEngine &GfxContext, bool force_draw)
void AddWidget (View *ic)
void AddWidget (View *ic, int stretchfactor)
void AddWidget (std::list< View * > *ViewList)
virtual LayoutGetLayout ()
 Get the default layout of this view.
virtual bool SetLayout (Layout *layout)
 Set the default layout for this view.
void PushHigher (BaseWindow *floating_view)
 Push the view one level up the ViewWindow stack.
void PushLower (BaseWindow *floating_view)
 Push the view one level down the ViewWindow stack.
void PushToFront ()
 Push the view to the front of the ViewWindow stack.
void PushToBack ()
 Push the view to the back of the ViewWindow stack.
virtual void SetWindowSizeMatchLayout (bool b)
 Set the window size to respect the layout container.
bool IsSizeMatchContent () const
 Check if the window size is constrained to the layout container size.
virtual void ShowWindow (bool b, bool StartModal=false)
void StopModal ()
bool IsModal () const
bool IsVisible () const
virtual void SetGeometry (const Geometry &geo)
 Set Geometry.
void SetConfigureNotifyCallback (ConfigureNotifyCallback Callback, void *Data)
void SetBackgroundLayer (AbstractPaintLayer *layer)
void SetBackgroundColor (const Color &color)
void SetOpacity (float opacity)
float GetOpacity ()
void SetEnterFocusInputArea (InputArea *input_area)
 Set an InputArea to receive the keyboard focus when the BaseWIndow receives the NUX_WINDOW_ENTER_FOCUS event.
void * GetBackupTextureData (int &width, int &height, int &format)
 Get the backup texture data of this BaseWindow,.
NString GetWindowName ()

Public Attributes

nux::Property< bool > premultiply
sigc::signal< void, BaseWindow * > sigVisible
 Emit a signal when the BaseWindow becomes visible.
sigc::signal< void, BaseWindow * > sigHidden
 Emit a signal when the BaseWindow becomes hidden.

Protected Member Functions

void SetAcceptKeyNavFocus (bool accept)
virtual bool AcceptKeyNavFocus ()
virtual void PreLayoutManagement ()
virtual long PostLayoutManagement (long LayoutResult)
virtual void PositionChildLayout (float offsetX, float offsetY)
virtual void LayoutWindowElements ()
 Layout the window elements.
virtual void NotifyConfigurationChange (int Width, int Height)
int GetBorder () const
int GetTopBorder () const
void SetBorder (int border)
void SetTopBorder (int border)
bool ChildNeedsRedraw ()

Protected Attributes

bool accept_key_nav_focus_
ConfigureNotifyCallback m_configure_notify_callback
 Callback function to set the window position and size.
void * m_configure_notify_callback_data
 Callback data for ConfigureNotifyCallback.
Layoutm_layout
int m_TopBorder
int m_Border
boost::scoped_ptr
< AbstractPaintLayer
_paint_layer
bool _entering_visible_state
 the window is about to be made visible during event processing
bool _entering_hidden_state
 the window is about to be made hidden during event processing

Friends

class ComboBox_Logic_WindowView
class PopUpWindow
class WindowThread
class WindowCompositor

Detailed Description

A floating area on top of the main window. A BaseWindow is referenced by the WindowCompositor who calls Reference on the BaseWindow during registration.

Definition at line 67 of file BaseWindow.h.


Member Function Documentation

Area * nux::BaseWindow::FindAreaUnderMouse ( const Point mouse_position,
NuxEventType  event_type 
) [virtual]

Return the area under the mouse pointer.

Returns:
The Area under the mouse pointer.

Reimplemented from nux::View.

Reimplemented in nux::FloatingWindow.

Definition at line 124 of file BaseWindow.cpp.

References nux::Area::AcceptMouseWheelEvent(), nux::Layout::FindAreaUnderMouse(), and nux::Area::TestMousePointerInclusionFilterMouseWheel().

  {
    bool mouse_inside = TestMousePointerInclusionFilterMouseWheel(mouse_position, event_type);

    if(mouse_inside == false)
      return NULL;

    if(m_layout)
    {
      nuxAssert(m_layout->IsLayout());
      Area* found_area = m_layout->FindAreaUnderMouse(mouse_position, event_type);
      if(found_area)
        return found_area;
    }

    if((event_type == NUX_MOUSE_WHEEL) && (!AcceptMouseWheelEvent()))
      return NULL;
    return this;
  }
Layout * nux::BaseWindow::GetLayout ( ) [virtual]

Get the default layout of this view.

Get the default layout of this view.

Returns:
The default layout of this view.

Reimplemented from nux::View.

Definition at line 228 of file BaseWindow.cpp.

  {
    return m_layout;
  }
bool nux::BaseWindow::IsSizeMatchContent ( ) const [inline]

Check if the window size is constrained to the layout container size.

Check if the window size is constrained to the layout container size.

Returns:
If the return value is true, the window size is constrained by the size the layout container.

Definition at line 132 of file BaseWindow.h.

Referenced by nux::FloatingWindow::CanBreakLayout().

    {
      return _size_match_layout;
    }
void nux::BaseWindow::LayoutWindowElements ( ) [protected, virtual]

Layout the window elements.

Layout elements such as button on the title bar, and the resize widget according to the current geometry of the window. Also initiate the computation of the child layout if there is one.

Reimplemented in nux::Tooltip, and nux::FloatingWindow.

Definition at line 382 of file BaseWindow.cpp.

References nux::Area::GetGeometry().

  {
    // Define the geometry of some of the component of the window. Otherwise, if the composition layout is not set,
    // then the component won't be correctly placed after a SetGeometry. This can be redondant if the composition layout is set.
    Geometry base = GetGeometry();
  }
void nux::BaseWindow::NotifyConfigurationChange ( int  Width,
int  Height 
) [protected, virtual]

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

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

Reimplemented in nux::Tooltip.

Definition at line 470 of file BaseWindow.cpp.

References nux::Area::GetGeometry(), m_configure_notify_callback, m_configure_notify_callback_data, and SetGeometry().

  {
    Geometry geo = GetGeometry();

    if (m_configure_notify_callback)
    {
      (*m_configure_notify_callback) (GetGraphicsDisplay()->GetWindowWidth(), GetGraphicsDisplay()->GetWindowHeight(), geo, m_configure_notify_callback_data);

      if (geo.IsNull() )
      {
        nuxDebugMsg (TEXT ("[BaseWindow::NotifyConfigurationChange] Received an invalid Geometry.") );
        geo = GetGeometry();
      }
      else
      {
        Area::SetGeometry (geo);
        // Get the geometry adjusted with respect to min and max dimension of this area.
        geo = GetGeometry();
      }
    }
    else
    {
      return;
    }
  }
void nux::BaseWindow::PushHigher ( BaseWindow floating_view)

Push the view one level up the ViewWindow stack.

Push this view one level up the ViewWindow stack. Does it even if the view is hidden.

Definition at line 507 of file BaseWindow.cpp.

  {
    GetWindowCompositor().PushHigher (this, floating_view);
  }
void nux::BaseWindow::PushLower ( BaseWindow floating_view)

Push the view one level down the ViewWindow stack.

Push this view one level down the ViewWindow stack. Does it even if the view is hidden.

void nux::BaseWindow::PushToBack ( )

Push the view to the back of the ViewWindow stack.

Push this view to the back of the ViewWindow stack. Does it even if the view is hidden.

Definition at line 517 of file BaseWindow.cpp.

  {
    GetWindowCompositor().PushToBack (this);
  }
void nux::BaseWindow::PushToFront ( )

Push the view to the front of the ViewWindow stack.

Push this view to the top of the ViewWindow stack. Does it even if the view is hidden. If a valid ViewWindow has been forced at the top of the stack with a call to WindowCompositor::SetAlwaysOnFrontWindow(), then this view will be positioned one level below that view.

See also:
SetAlwaysOnFrontWindow ();

Definition at line 512 of file BaseWindow.cpp.

  {
    GetWindowCompositor().PushToFront (this);
  }
void nux::BaseWindow::SetConfigureNotifyCallback ( ConfigureNotifyCallback  Callback,
void *  Data 
)

Call this function to set a callback function that is called when this object is need to be resized or re-positioned.

Parameters:
CallbackFunction to be called to set the this object size and position.
DataThe callback data.

Definition at line 184 of file BaseWindow.cpp.

References m_configure_notify_callback, and m_configure_notify_callback_data.

void nux::BaseWindow::SetEnterFocusInputArea ( InputArea input_area)

Set an InputArea to receive the keyboard focus when the BaseWIndow receives the NUX_WINDOW_ENTER_FOCUS event.

See also:
_enter_focus_input_area.
Parameters:
input_areaAn InputArea pointer object. Must be a child of this BaseWindow.

Definition at line 532 of file BaseWindow.cpp.

References nux::Object::Reference(), and nux::Object::UnReference().

  {
    if (_enter_focus_input_area)
    {
      _enter_focus_input_area->UnReference ();
    }

    _enter_focus_input_area = input_area;
    if (_enter_focus_input_area)
      _enter_focus_input_area->Reference ();

  }
bool nux::BaseWindow::SetLayout ( Layout layout) [virtual]

Set the default layout for this view.

Set the default layout for this view.

Parameters:
layoutA Layout object.

Reimplemented from nux::View.

Definition at line 233 of file BaseWindow.cpp.

References nux::Area::GetGeometry(), nux::Area::SetGeometry(), and nux::View::SetLayout().

  {
    if (View::SetLayout (layout) == false)
      return false;

    m_layout = layout;
    Geometry geo = GetGeometry();
    Geometry layout_geo = Geometry (geo.x + m_Border, geo.y + m_TopBorder,
                                    geo.GetWidth() - 2 * m_Border, geo.GetHeight() - m_Border - m_TopBorder);
    m_layout->SetGeometry (layout_geo);

    // When this call returns the layout computation is done.
    ComputeChildLayout();
    // or use
    //GetWindowThread()->QueueObjectLayout(m_layout);

    return true;
  }
virtual void nux::BaseWindow::SetWindowSizeMatchLayout ( bool  b) [inline, virtual]

Set the window size to respect the layout container.

Set the window size to be such that the container layout size remains the same after ComputeSizeLayout2 is called on the layout. The window elements (title bar, minimize and close buttons) are positioned accordingly. The size grip is not responding anymore.

Parameters:
bIf b is true, the window size respect the size the layout container.

Definition at line 123 of file BaseWindow.h.

    {
      _size_match_layout = b;
    }

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