2017-11-23 22:44:20 +01:00
|
|
|
#pragma once
|
2017-11-23 23:37:52 +01:00
|
|
|
#include "c-sync.hh"
|
2017-11-23 22:44:20 +01:00
|
|
|
#include "ui-mousectrl.hh"
|
|
|
|
|
|
|
|
|
|
|
|
class T_UISync : public A_MouseCtrl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
T_UISync( );
|
2017-11-24 09:51:05 +01:00
|
|
|
~T_UISync( );
|
2017-11-23 22:44:20 +01:00
|
|
|
|
2017-11-24 10:08:41 +01:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
bool& overridesWindowEnabled( ) noexcept
|
|
|
|
{ return ovWindow_; }
|
|
|
|
void makeOverridesWindow( );
|
|
|
|
|
2017-11-24 10:08:41 +01:00
|
|
|
using F_Override = std::function<
|
|
|
|
void( A_SyncOverride& , uint32_t& , T_StringBuilder& ) >;
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
F_Override uiFor( A_SyncOverride& target ) const noexcept;
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2017-11-24 10:08:41 +01:00
|
|
|
void updateTime( ) noexcept;
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
2017-11-23 22:44:20 +01:00
|
|
|
void delegateMouse( T_String const& id ,
|
2017-11-24 09:51:05 +01:00
|
|
|
P_MouseCtrl delegate ) noexcept;
|
|
|
|
void clearMouseDelegate( ) noexcept;
|
2017-11-23 22:44:20 +01:00
|
|
|
|
|
|
|
bool isCurrentDelegate( T_String const& delegate ) noexcept
|
|
|
|
{ return mouseDelegateName_ == delegate; }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
void handleDragAndDrop(
|
|
|
|
ImVec2 const& move ,
|
2017-11-24 11:48:08 +01:00
|
|
|
T_KbdMods modifiers ,
|
2017-11-23 22:44:20 +01:00
|
|
|
T_MouseButtons buttons ) noexcept override;
|
|
|
|
void handleWheel(
|
|
|
|
float wheel ,
|
2017-11-24 11:48:08 +01:00
|
|
|
T_KbdMods modifiers ,
|
2017-11-23 22:44:20 +01:00
|
|
|
T_MouseButtons buttons ) noexcept override;
|
|
|
|
|
|
|
|
private:
|
2017-11-24 10:08:41 +01:00
|
|
|
bool ovWindow_{ false }; // Overrides window open
|
|
|
|
T_KeyValueTable< T_String , F_Override > sovuis_; // Override UI table
|
|
|
|
|
|
|
|
T_String mouseDelegateName_{ }; // Name and pointer for mouse delegation
|
2017-11-23 22:44:20 +01:00
|
|
|
T_OwnPtr< A_MouseCtrl > mouseDelegate_{ };
|
2017-11-24 10:08:41 +01:00
|
|
|
|
|
|
|
bool playingPrevious_{ false }; // Was it playing before?
|
|
|
|
float lastFrame_{ 0 }; // Time of last frame
|
2017-11-23 22:44:20 +01:00
|
|
|
};
|