Btk
Btk::Window Class Reference

A Basic Window. More...

#include <window.hpp>

Inheritance diagram for Btk::Window:
Collaboration diagram for Btk::Window:

Public Types

typedef Signal< bool()> SignalClose
 
typedef Signal< bool(Event &)> SignalEvent
 
typedef Signal< void(int w, int h)> SignalResize
 
typedef Signal< void(std::string_view)> SignalDropFile
 

Public Member Functions

 Window (const Window &)=delete
 
 Window (Window &&win)
 
 Window (std::string_view title, int w, int h)
 Construct a new Window object. More...
 
WindowImplimpl () const noexcept
 Get window impl. More...
 
bool add (Widget *ptr)
 Add widget to window. More...
 
template<class T , class ... Args>
T & add (Args &&...args)
 A helper template to add widget. More...
 
void update ()
 Update widgets position. More...
 
void lock ()
 Lock the window before access it. More...
 
void unlock ()
 Unlock thw window. More...
 
void done ()
 Show window and set Widget postions. More...
 
void move (int x, int y)
 Move the window. More...
 
void show ()
 Make the window visiable. More...
 
void draw ()
 Redraw the window. More...
 
void close ()
 Send a close request. More...
 
bool mainloop ()
 Enter the main event loop. More...
 
bool exists () const
 Check the window is exist. More...
 
PixBuf pixbuf ()
 Get window's pixbuf. More...
 
void set_title (std::string_view title)
 Set the title. More...
 
void set_icon (std::string_view file)
 Set the icon. More...
 
void set_icon (const PixBuf &pixbuf)
 Set the icon. More...
 
void set_fullscreen (bool val=true)
 Set the fullscreen. More...
 
void set_resizeable (bool val=true)
 Set the resizeable. More...
 
void set_transparent (float value)
 Set the background transparent. More...
 
template<class ... T>
Connection on_close (T &&...args)
 
template<class ... T>
Connection on_resize (T &&...args)
 
template<class ... T>
Connection on_dropfile (T &&...args)
 
SignalClosesig_close ()
 
SignalEventsig_event ()
 
SignalResizesig_resize ()
 
SignalDropFilesig_dropfile ()
 
void set_cursor ()
 Set the cursor to default. More...
 
void set_cursor (const PixBuf &pixbuf, int hot_x=0, int hot_y=0)
 Set the cursor. More...
 
int w () const noexcept
 
int h () const noexcept
 
Font font () const
 
Containercontainer () const
 Get Container refer. More...
 
- Public Member Functions inherited from Btk::HasSlots
 HasSlots (const HasSlots &)=delete
 
void disconnect_all ()
 

Additional Inherited Members

- Public Attributes inherited from Btk::HasSlots
std::list< Connection_connections
 

Detailed Description

A Basic Window.

Constructor & Destructor Documentation

◆ Window()

Btk::Window::Window ( std::string_view  title,
int  w,
int  h 
)

Construct a new Window object.

Parameters
titleThe window title
wThe window width
hThw window height

Member Function Documentation

◆ add() [1/2]

bool Btk::Window::add ( Widget ptr)

Add widget to window.

Parameters
ptrThe widget pointer(It can be nullptr)
Returns
true The ptr is not nullptr
false The ptr is nullptr

◆ add() [2/2]

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

A helper template to add widget.

Template Parameters
TThe widget type
ArgsThe args to want to pass to construc it
Parameters
argsThe args
Returns
T& The widget reference

◆ close()

void Btk::Window::close ( )

Send a close request.

Note
Is is safe to call in multithreading without lock it

◆ container()

Container & Btk::Window::container ( ) const

Get Container refer.

Returns
Container&

◆ done()

void Btk::Window::done ( )

Show window and set Widget postions.

◆ draw()

void Btk::Window::draw ( )

Redraw the window.

Note
Is is safe to call in multithreading without lock it

◆ exists()

bool Btk::Window::exists ( ) const

Check the window is exist.

Returns
true The window is exists
false The window is not exists

◆ impl()

WindowImpl* Btk::Window::impl ( ) const
inlinenoexcept

Get window impl.

Returns
WindowImpl*

◆ lock()

void Btk::Window::lock ( )

Lock the window before access it.

◆ mainloop()

bool Btk::Window::mainloop ( )

Enter the main event loop.

Returns
true The event loop finished normally
false Double call

◆ move()

void Btk::Window::move ( int  x,
int  y 
)

Move the window.

Parameters
xThe new x
yThe new y

◆ pixbuf()

PixBuf Btk::Window::pixbuf ( )

Get window's pixbuf.

Returns
PixBuf

◆ set_cursor() [1/2]

void Btk::Window::set_cursor ( )

Set the cursor to default.

◆ set_cursor() [2/2]

void Btk::Window::set_cursor ( const PixBuf pixbuf,
int  hot_x = 0,
int  hot_y = 0 
)

Set the cursor.

Parameters
pixbufThe image pixelbuf
hot_xThe cursor's x
hot_yThe cursor's y

◆ set_fullscreen()

void Btk::Window::set_fullscreen ( bool  val = true)

Set the fullscreen.

Parameters
valThe fullscreen flags

◆ set_icon() [1/2]

void Btk::Window::set_icon ( std::string_view  file)

Set the icon.

Parameters
fileThe image file name

◆ set_icon() [2/2]

void Btk::Window::set_icon ( const PixBuf pixbuf)

Set the icon.

Parameters
pixbufThe image pixbuf

◆ set_resizeable()

void Btk::Window::set_resizeable ( bool  val = true)

Set the resizeable.

Parameters
valThe resizeable flags

◆ set_title()

void Btk::Window::set_title ( std::string_view  title)

Set the title.

Parameters
titleThe new title

◆ set_transparent()

void Btk::Window::set_transparent ( float  value)

Set the background transparent.

Note
Some platform unsupport it
Parameters
valThe transparent value

◆ show()

void Btk::Window::show ( )

Make the window visiable.

◆ unlock()

void Btk::Window::unlock ( )

Unlock thw window.

◆ update()

void Btk::Window::update ( )

Update widgets position.


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