Btk
Btk::Container Class Reference

A Container of Widget. More...

#include <widget.hpp>

Inheritance diagram for Btk::Container:
Collaboration diagram for Btk::Container:

Public Types

typedef Function< bool(Event &)> Filter
 The event filter(return false to drop the event) More...
 

Public Member Functions

 Container (const Container &)=delete
 
template<class T , class ... Args>
T & add (Args &&...args)
 Add a widget to the Container. More...
 
bool add (Widget *w)
 
void clear ()
 Destroy all widget. More...
 
bool remove (Widget *widget)
 Remove the widget in the container. More...
 
bool detach (Widget *widget)
 Detach the widget in the container. More...
 
bool handle_click (MouseEvent &)
 
bool handle_whell (WheelEvent &)
 
bool handle_motion (MotionEvent &)
 
bool handle_keyboard (KeyEvent &)
 
bool handle_textinput (TextInputEvent &)
 
bool handle (Event &)
 Generic to dispatch event to widgets. More...
 
Function< bool(Event &)> & filter () noexcept
 Get the Container EventFilter. More...
 

Protected Member Functions

void set_focus_widget (Widget *)
 

Protected Attributes

Widgetfocus_widget = nullptr
 
Widgetdrag_widget = nullptr
 
Widgetcur_widget = nullptr
 
bool mouse_pressed = false
 The mouse is pressed. More...
 
bool drag_rejected = false
 
bool managed_window = false
 Manager by window. More...
 
Function< bool(Event &)> ev_filter
 Event filter. More...
 
WindowImplwindow
 
std::list< Widget * > widgets_list
 

Friends

class Window
 
class Widget
 
struct System
 
struct WindowImpl
 

Detailed Description

Member Typedef Documentation

◆ Filter

The event filter(return false to drop the event)

Member Function Documentation

◆ add()

template<class T , class ... Args>
T& Btk::Container::add ( Args &&...  args)
inline

Add a widget to the Container.

Template Parameters
T
Args
Parameters
args
Returns
The new widget ref

◆ clear()

void Btk::Container::clear ( )

Destroy all widget.

◆ detach()

bool Btk::Container::detach ( Widget widget)

Detach the widget in the container.

Parameters
widgetThe widget pointer
Returns
true Successed to Detach it
false The widget pointer is invaid

◆ filter()

Function<bool(Event&)>& Btk::Container::filter ( )
inlinenoexcept

Get the Container EventFilter.

Returns
Function<bool(Event&)>&

◆ handle()

bool Btk::Container::handle ( Event event)

Generic to dispatch event to widgets.

Returns
true
false

◆ remove()

bool Btk::Container::remove ( Widget widget)

Remove the widget in the container.

Parameters
widgetThe widget pointer
Returns
true Successed to remove it
false The widget pointer is invaid

Member Data Documentation

◆ ev_filter

Function<bool(Event&)> Btk::Container::ev_filter
protected

Event filter.

◆ managed_window

bool Btk::Container::managed_window = false
protected

Manager by window.

◆ mouse_pressed

bool Btk::Container::mouse_pressed = false
protected

The mouse is pressed.

Note
This value is used to check the drag status

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