mirror of
https://github.com/nillerusr/source-engine.git
synced 2026-08-07 17:29:36 +00:00
GameUI: fix propotional scale
This commit is contained in:
@@ -226,7 +226,6 @@ KeyBindingMap_t::~KeyBindingMap_t()
|
||||
class CKeyBindingsMgr
|
||||
{
|
||||
public:
|
||||
|
||||
CKeyBindingsMgr() :
|
||||
m_Bindings( 0, 0, KeyBindingContextHandleLessFunc ),
|
||||
m_nKeyBindingContexts( 0 )
|
||||
@@ -1450,8 +1449,10 @@ void Panel::SetParent(Panel *newParent)
|
||||
//-----------------------------------------------------------------------------
|
||||
void Panel::SetParent(VPANEL newParent)
|
||||
{
|
||||
|
||||
if (newParent)
|
||||
{
|
||||
|
||||
ipanel()->SetParent(GetVPanel(), newParent);
|
||||
}
|
||||
else
|
||||
@@ -1459,19 +1460,19 @@ void Panel::SetParent(VPANEL newParent)
|
||||
ipanel()->SetParent(GetVPanel(), NULL);
|
||||
}
|
||||
|
||||
if (GetVParent() && !IsPopup())
|
||||
if (GetVParent() )
|
||||
{
|
||||
SetProportional(ipanel()->IsProportional(GetVParent()));
|
||||
if( ipanel()->IsProportional(GetVParent()) )
|
||||
SetProportional(true);
|
||||
|
||||
// most of the time KBInput == parents kbinput
|
||||
if (ipanel()->IsKeyBoardInputEnabled(GetVParent()) != IsKeyBoardInputEnabled())
|
||||
if( IsPopup() )
|
||||
{
|
||||
SetKeyBoardInputEnabled(ipanel()->IsKeyBoardInputEnabled(GetVParent()));
|
||||
}
|
||||
// most of the time KBInput == parents kbinput
|
||||
if (ipanel()->IsKeyBoardInputEnabled(GetVParent()) != IsKeyBoardInputEnabled())
|
||||
SetKeyBoardInputEnabled(ipanel()->IsKeyBoardInputEnabled(GetVParent()));
|
||||
|
||||
if (ipanel()->IsMouseInputEnabled(GetVParent()) != IsMouseInputEnabled())
|
||||
{
|
||||
SetMouseInputEnabled(ipanel()->IsMouseInputEnabled(GetVParent()));
|
||||
if (ipanel()->IsMouseInputEnabled(GetVParent()) != IsMouseInputEnabled())
|
||||
SetMouseInputEnabled(ipanel()->IsMouseInputEnabled(GetVParent()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,8 @@ ScrollBar::ScrollBar(Panel *parent, const char *panelName, bool vertical) : Pane
|
||||
m_pOverriddenButtons[0] = NULL;
|
||||
m_pOverriddenButtons[1] = NULL;
|
||||
|
||||
int width = IsProportional() ? scheme()->GetProportionalScaledValue(SCROLLBAR_DEFAULT_WIDTH) : SCROLLBAR_DEFAULT_WIDTH;
|
||||
|
||||
if (vertical)
|
||||
{
|
||||
// FIXME: proportional changes needed???
|
||||
@@ -158,7 +160,7 @@ ScrollBar::ScrollBar(Panel *parent, const char *panelName, bool vertical) : Pane
|
||||
_button[0]->SetTextInset(0, 1);
|
||||
_button[1]->SetTextInset(0, -1);
|
||||
|
||||
SetSize(SCROLLBAR_DEFAULT_WIDTH, 64);
|
||||
SetSize(width, 64);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -168,7 +170,7 @@ ScrollBar::ScrollBar(Panel *parent, const char *panelName, bool vertical) : Pane
|
||||
_button[0]->SetTextInset(0, 0);
|
||||
_button[1]->SetTextInset(0, 0);
|
||||
|
||||
SetSize(64, SCROLLBAR_DEFAULT_WIDTH);
|
||||
SetSize(64, width);
|
||||
}
|
||||
|
||||
Panel::SetPaintBorderEnabled(true);
|
||||
|
||||
@@ -230,7 +230,6 @@ void Slider::SetInverted( bool bInverted )
|
||||
m_bInverted = bInverted;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// Purpose: Send a message to interested parties when the slider moves
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -386,9 +385,9 @@ void Slider::GetTrackRect( int& x, int& y, int& w, int& h )
|
||||
GetPaintSize( wide, tall );
|
||||
|
||||
x = 0;
|
||||
y = 8;
|
||||
y = IsProportional() ? scheme()->GetProportionalScaledValue( 8.f ) : 8;;
|
||||
w = wide - (int)_nobSize;
|
||||
h = 4;
|
||||
h = IsProportional() ? scheme()->GetProportionalScaledValue( 4.f ) : 4;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -524,7 +523,7 @@ void Slider::DrawNob()
|
||||
#endif
|
||||
surface()->DrawSetColor(col);
|
||||
|
||||
int nobheight = 16;
|
||||
int nobheight = IsProportional() ? scheme()->GetProportionalScaledValue( 16.f ) : 16.f;
|
||||
|
||||
surface()->DrawFilledRect(
|
||||
_nobPos[0],
|
||||
@@ -941,7 +940,7 @@ void Slider::SetButtonOffset(int buttonOffset)
|
||||
|
||||
void Slider::SetThumbWidth( int width )
|
||||
{
|
||||
_nobSize = (float)width;
|
||||
_nobSize = IsProportional() ? scheme()->GetProportionalScaledValue( (float)width) : (float)width;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user