Initial Commit

This commit is contained in:
2024-08-07 09:09:36 -04:00
commit ca445435a0
458 changed files with 41370 additions and 0 deletions

33
common/RUBBER.CPP Normal file
View File

@@ -0,0 +1,33 @@
#include <common/rubber.hpp>
#include <common/window.hpp>
#include <common/rect.hpp>
#include <common/point.hpp>
RubberControl::~RubberControl()
{
}
void RubberControl::calcRatios(GUIWindow &parentWindow)
{
Rect clientRect;
Rect controlRect;
Point screenPoint;
if(!controlWindow().isValid()||!parentWindow.isValid())return;
parentWindow.clientRect(clientRect);
controlWindow().clientRect(controlRect);
parentWindow.clientToScreen(clientRect);
controlWindow().clientToScreen(controlRect);
mRatios[Left]=((float)(controlRect.left()-clientRect.left())/(float)parentWindow.width());
mRatios[Top]=((float)(controlRect.top()-clientRect.top())/(float)parentWindow.height());
mRatios[Right]=((float)(clientRect.right()-controlRect.right())/(float)parentWindow.width());
mRatios[Bottom]=((float)(clientRect.bottom()-controlRect.bottom())/(float)parentWindow.height());
return;
}
void RubberControl::moveControl(GUIWindow &/*parentWindow*/,int width,int height)
{
Rect controlRect(mRatios[Left]*width,mRatios[Top]*height,width-(mRatios[Right]*width),height-(mRatios[Bottom]*height));
controlWindow().moveWindow(controlRect);
}