Code-style consistency improvement:
Apply clang-format-all.sh using the _clang-format file through all the cpp/.h files. make sure not to apply it to certain serialization structures, since some parser expects the * as part of the name, instead of type. This commit contains no other changes aside from adding and applying clang-format-all.sh
This commit is contained in:
@@ -4,7 +4,6 @@
|
||||
See license in Gwen.h
|
||||
*/
|
||||
|
||||
|
||||
#include "Gwen/ToolTip.h"
|
||||
#include "Gwen/Utility.h"
|
||||
|
||||
@@ -13,49 +12,49 @@ using namespace Gwen::Controls;
|
||||
|
||||
namespace ToolTip
|
||||
{
|
||||
Base* g_ToolTip = NULL;
|
||||
Base* g_ToolTip = NULL;
|
||||
|
||||
void Enable( Controls::Base* pControl )
|
||||
void Enable(Controls::Base* pControl)
|
||||
{
|
||||
if (!pControl->GetToolTip())
|
||||
return;
|
||||
|
||||
g_ToolTip = pControl;
|
||||
}
|
||||
|
||||
void Disable(Controls::Base* pControl)
|
||||
{
|
||||
if (g_ToolTip == pControl)
|
||||
{
|
||||
if ( !pControl->GetToolTip() )
|
||||
return;
|
||||
|
||||
g_ToolTip = pControl;
|
||||
}
|
||||
|
||||
void Disable( Controls::Base* pControl )
|
||||
{
|
||||
if ( g_ToolTip == pControl )
|
||||
{
|
||||
g_ToolTip = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderToolTip( Skin::Base* skin )
|
||||
{
|
||||
if ( !g_ToolTip ) return;
|
||||
|
||||
Gwen::Renderer::Base* render = skin->GetRender();
|
||||
|
||||
Gwen::Point pOldRenderOffset = render->GetRenderOffset();
|
||||
Gwen::Point MousePos = Input::GetMousePosition();
|
||||
Gwen::Rect Bounds = g_ToolTip->GetToolTip()->GetBounds();
|
||||
|
||||
Gwen::Rect rOffset = Gwen::Rect( MousePos.x - Bounds.w * 0.5f, MousePos.y - Bounds.h - 10, Bounds.w, Bounds.h );
|
||||
rOffset = Utility::ClampRectToRect( rOffset, g_ToolTip->GetCanvas()->GetBounds() );
|
||||
|
||||
//Calculate offset on screen bounds
|
||||
render->AddRenderOffset( rOffset );
|
||||
render->EndClip();
|
||||
|
||||
skin->DrawToolTip( g_ToolTip->GetToolTip() );
|
||||
g_ToolTip->GetToolTip()->DoRender( skin );
|
||||
|
||||
render->SetRenderOffset( pOldRenderOffset );
|
||||
}
|
||||
|
||||
void ControlDeleted( Controls::Base* pControl )
|
||||
{
|
||||
Disable( pControl );
|
||||
g_ToolTip = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void RenderToolTip(Skin::Base* skin)
|
||||
{
|
||||
if (!g_ToolTip) return;
|
||||
|
||||
Gwen::Renderer::Base* render = skin->GetRender();
|
||||
|
||||
Gwen::Point pOldRenderOffset = render->GetRenderOffset();
|
||||
Gwen::Point MousePos = Input::GetMousePosition();
|
||||
Gwen::Rect Bounds = g_ToolTip->GetToolTip()->GetBounds();
|
||||
|
||||
Gwen::Rect rOffset = Gwen::Rect(MousePos.x - Bounds.w * 0.5f, MousePos.y - Bounds.h - 10, Bounds.w, Bounds.h);
|
||||
rOffset = Utility::ClampRectToRect(rOffset, g_ToolTip->GetCanvas()->GetBounds());
|
||||
|
||||
//Calculate offset on screen bounds
|
||||
render->AddRenderOffset(rOffset);
|
||||
render->EndClip();
|
||||
|
||||
skin->DrawToolTip(g_ToolTip->GetToolTip());
|
||||
g_ToolTip->GetToolTip()->DoRender(skin);
|
||||
|
||||
render->SetRenderOffset(pOldRenderOffset);
|
||||
}
|
||||
|
||||
void ControlDeleted(Controls::Base* pControl)
|
||||
{
|
||||
Disable(pControl);
|
||||
}
|
||||
} // namespace ToolTip
|
||||
|
||||
Reference in New Issue
Block a user