demotool/window.hh
Emmanuel BENOîT 89d125761a UI - Some refactoring
Basically trying to separate stuff from window.hh
2017-11-23 12:46:48 +01:00

52 lines
1.4 KiB
C++

#pragma once
#include "dialogs.hh"
#include "mousectrl.hh"
/*= WINDOW MANAGEMENT ========================================================*/
struct T_Window
{
T_Window( );
~T_Window( );
//----------------------------------------------------------------------
void pushDialog( P_ModalDialog dialog ) noexcept
{ modals_.add( std::move( dialog ) ); }
void msgbox( char const* title ,
char const* text ,
T_MessageBox::F_Handler handler = { } ,
T_MessageBox::T_Buttons buttons = T_MessageBox::BT_OK )
{ pushDialog( NewOwned< T_MessageBox >( title , text , handler , buttons ) ); }
void msgbox( T_String const& title ,
T_String const& text ,
T_MessageBox::F_Handler handler = { } ,
T_MessageBox::T_Buttons buttons = T_MessageBox::BT_OK )
{ pushDialog( NewOwned< T_MessageBox >( title , text , handler , buttons ) ); }
//----------------------------------------------------------------------
ImFont* defaultFont( ) const noexcept
{ return defaultFont_; }
ImFont* smallFont( ) const noexcept
{ return smallFont_; }
//----------------------------------------------------------------------
void startFrame( const bool capture ,
ImVec2 const& mouseInitial ) const;
void warpMouse( ImVec2 const& pos ) const;
void swap( ) const;
void handleDialogs( ) noexcept;
private:
SDL_Window * window;
SDL_GLContext gl;
ImFont* defaultFont_;
ImFont* smallFont_;
T_AutoArray< P_ModalDialog , 8 > modals_;
};