| 1024 | //----------------------------------------------------------------------------- |
| 1025 | |
| 1026 | void GuiWindowCtrl::onMouseUp(const GuiEvent &event) |
| 1027 | { |
| 1028 | bool closing = mCloseButtonPressed; |
| 1029 | bool maximizing = mMaximizeButtonPressed; |
| 1030 | bool minimizing = mMinimizeButtonPressed; |
| 1031 | |
| 1032 | mCloseButtonPressed = false; |
| 1033 | mMaximizeButtonPressed = false; |
| 1034 | mMinimizeButtonPressed = false; |
| 1035 | |
| 1036 | TORQUE_UNUSED(event); |
| 1037 | mouseUnlock(); |
| 1038 | |
| 1039 | mMouseMovingWin = false; |
| 1040 | mMouseResizeWidth = false; |
| 1041 | mMouseResizeHeight = false; |
| 1042 | |
| 1043 | GuiControl *parent = getParent(); |
| 1044 | if (! parent) |
| 1045 | return; |
| 1046 | |
| 1047 | if( mIsMouseResizing ) |
| 1048 | { |
| 1049 | mIsMouseResizing = false; |
| 1050 | return; |
| 1051 | } |
| 1052 | |
| 1053 | Point2I localPoint = globalToLocalCoord(event.mousePoint); |
| 1054 | if (closing && mCloseButton.pointInRect(localPoint)) |
| 1055 | { |
| 1056 | // Here is where were going to put our other if statement |
| 1057 | // if the window closes, and there were only 2 windows in the array, then just delete the array and default there params |
| 1058 | // if not, delete the window from the array, default its params, and renumber the windows |
| 1059 | |
| 1060 | if( engineAPI::gUseConsoleInterop ) |
| 1061 | evaluate( mCloseCommand ); |
| 1062 | onClose_callback(); |
| 1063 | } |
| 1064 | else if (maximizing && mMaximizeButton.pointInRect(localPoint)) |
| 1065 | { |
| 1066 | if (mMaximized) |
| 1067 | { |
| 1068 | // Resize to the previous position and extent, bounded by the parent |
| 1069 | resize(Point2I(getMax(0, getMin(parent->getWidth() - mStandardBounds.extent.x, mStandardBounds.point.x)), |
| 1070 | getMax(0, getMin(parent->getHeight() - mStandardBounds.extent.y, mStandardBounds.point.y))), |
| 1071 | mStandardBounds.extent); |
| 1072 | // Set the flag |
| 1073 | mMaximized = false; |
| 1074 | |
| 1075 | onRestore_callback(); |
| 1076 | } |
| 1077 | else |
| 1078 | { |
| 1079 | // Only save the position if we're not minimized |
| 1080 | if (! mMinimized) |
| 1081 | mStandardBounds = getBounds(); |
| 1082 | else |
| 1083 | mMinimized = false; |
nothing calls this directly
no test coverage detected