2017-10-20 02:00:49 +00:00
|
|
|
Class KFGUI_FloatingWindow extends KFGUI_Page
|
|
|
|
abstract;
|
|
|
|
|
|
|
|
var() string WindowTitle; // Title of this window.
|
|
|
|
var float DragOffset[2];
|
|
|
|
var KFGUI_FloatingWindowHeader HeaderComp;
|
|
|
|
var bool bDragWindow;
|
|
|
|
|
|
|
|
function InitMenu()
|
|
|
|
{
|
|
|
|
Super.InitMenu();
|
|
|
|
HeaderComp = new (Self) class'KFGUI_FloatingWindowHeader';
|
|
|
|
AddComponent(HeaderComp);
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function DrawMenu()
|
|
|
|
{
|
|
|
|
Owner.CurrentStyle.RenderFramedWindow(Self);
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2020-11-28 20:12:58 +00:00
|
|
|
if (HeaderComp!=None)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
HeaderComp.CompPos[3] = Owner.CurrentStyle.DefaultHeight;
|
|
|
|
HeaderComp.YSize = HeaderComp.CompPos[3] / CompPos[3]; // Keep header height fit the window height.
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2020-11-28 20:04:55 +00:00
|
|
|
function SetWindowDrag(bool bDrag)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
bDragWindow = bDrag;
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bDrag)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
DragOffset[0] = Owner.MousePosition.X-CompPos[0];
|
|
|
|
DragOffset[1] = Owner.MousePosition.Y-CompPos[1];
|
|
|
|
}
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function bool CaptureMouse()
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bDragWindow && HeaderComp!=None) // Always keep focus on window frame now!
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
MouseArea = HeaderComp;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return Super.CaptureMouse();
|
|
|
|
}
|
2020-11-28 21:54:57 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
function PreDraw()
|
|
|
|
{
|
2020-11-28 20:12:58 +00:00
|
|
|
if (bDragWindow)
|
2017-10-20 02:00:49 +00:00
|
|
|
{
|
|
|
|
XPosition = FClamp(Owner.MousePosition.X-DragOffset[0],0,InputPos[2]-CompPos[2]) / InputPos[2];
|
|
|
|
YPosition = FClamp(Owner.MousePosition.Y-DragOffset[1],0,InputPos[3]-CompPos[3]) / InputPos[3];
|
|
|
|
}
|
|
|
|
Super.PreDraw();
|
|
|
|
}
|
|
|
|
|
|
|
|
defaultproperties
|
|
|
|
{
|
2023-05-14 02:49:12 +00:00
|
|
|
|
2017-10-20 02:00:49 +00:00
|
|
|
}
|