From 8022ae9ee5d83653a86503534de85c5161414f0b Mon Sep 17 00:00:00 2001 From: DevGeniusCode <136935333+DevGeniusCode@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:19:01 +0300 Subject: [PATCH 1/3] unify(client): Move GUI window managers and message boxes to Core (#2617) --- Core/GameEngine/CMakeLists.txt | 24 +- .../Include/GameClient/AnimateWindowManager.h | 0 .../Include/GameClient/ExtendedMessageBox.h | 0 .../Include/GameClient/GameWindowID.h | 0 .../Include/GameClient/GameWindowManager.h | 0 .../GameEngine/Include/GameClient/HotKey.h | 0 .../Include/GameClient/MessageBox.h | 0 .../GameClient/GUI/AnimateWindowManager.cpp | 0 .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 0 .../GUI/GUICallbacks/MessageBox.cpp | 0 .../GameClient/GUI/GameWindowManager.cpp | 0 .../Source/GameClient/GameClientDispatch.cpp | 0 .../GameClient/MessageStream/HotKey.cpp | 0 Generals/Code/GameEngine/CMakeLists.txt | 24 +- .../Include/GameClient/AnimateWindowManager.h | 235 - .../Include/GameClient/ExtendedMessageBox.h | 69 - .../Include/GameClient/GameWindowID.h | 83 - .../Include/GameClient/GameWindowManager.h | 414 -- .../GameEngine/Include/GameClient/HotKey.h | 112 - .../Include/GameClient/MessageBox.h | 46 - .../GameClient/GUI/AnimateWindowManager.cpp | 422 -- .../GUI/GUICallbacks/ExtendedMessageBox.cpp | 308 -- .../GUI/GUICallbacks/MessageBox.cpp | 265 -- .../GameClient/GUI/GameWindowManager.cpp | 4064 ----------------- .../Source/GameClient/GameClientDispatch.cpp | 56 - .../GameClient/MessageStream/HotKey.cpp | 231 - GeneralsMD/Code/GameEngine/CMakeLists.txt | 24 +- scripts/cpp/unify_move_files.py | 13 + 28 files changed, 49 insertions(+), 6341 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/AnimateWindowManager.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ExtendedMessageBox.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GameWindowID.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GameWindowManager.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/HotKey.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/MessageBox.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GameClientDispatch.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/MessageStream/HotKey.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GameWindowID.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/HotKey.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/MessageBox.h delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 5b119043772..b1499ffa387 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -142,7 +142,7 @@ set(GAMEENGINE_SRC Include/Common/XferLoad.h Include/Common/XferSave.h Include/GameClient/Anim2D.h -# Include/GameClient/AnimateWindowManager.h + Include/GameClient/AnimateWindowManager.h # Include/GameClient/CampaignManager.h Include/GameClient/ChallengeGenerals.h Include/GameClient/ClientInstance.h @@ -164,7 +164,7 @@ set(GAMEENGINE_SRC Include/GameClient/DrawGroupInfo.h # Include/GameClient/EstablishConnectionsMenu.h # Include/GameClient/Eva.h -# Include/GameClient/ExtendedMessageBox.h + Include/GameClient/ExtendedMessageBox.h # Include/GameClient/FontDesc.h Include/GameClient/FXList.h # Include/GameClient/Gadget.h @@ -184,8 +184,8 @@ set(GAMEENGINE_SRC Include/GameClient/GameText.h Include/GameClient/GameWindow.h Include/GameClient/GameWindowGlobal.h -# Include/GameClient/GameWindowID.h -# Include/GameClient/GameWindowManager.h + Include/GameClient/GameWindowID.h + Include/GameClient/GameWindowManager.h Include/GameClient/GameWindowTransitions.h Include/GameClient/GlobalLanguage.h Include/GameClient/GraphDraw.h @@ -193,7 +193,7 @@ set(GAMEENGINE_SRC # Include/GameClient/GUICommandTranslator.h Include/GameClient/HeaderTemplate.h # Include/GameClient/HintSpy.h -# Include/GameClient/HotKey.h + Include/GameClient/HotKey.h Include/GameClient/Image.h Include/GameClient/IMEManager.h # Include/GameClient/InGameUI.h @@ -204,7 +204,7 @@ set(GAMEENGINE_SRC Include/GameClient/LoadScreen.h # Include/GameClient/LookAtXlat.h Include/GameClient/MapUtil.h -# Include/GameClient/MessageBox.h + Include/GameClient/MessageBox.h # Include/GameClient/MetaEvent.h Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h Include/GameClient/Module/BeaconClientUpdate.h @@ -705,11 +705,11 @@ set(GAMEENGINE_SRC # Source/GameClient/Eva.cpp Source/GameClient/FXList.cpp # Source/GameClient/GameClient.cpp -# Source/GameClient/GameClientDispatch.cpp + Source/GameClient/GameClientDispatch.cpp Source/GameClient/GameText.cpp Source/GameClient/GlobalLanguage.cpp Source/GameClient/GraphDraw.cpp -# Source/GameClient/GUI/AnimateWindowManager.cpp + Source/GameClient/GUI/AnimateWindowManager.cpp Source/GameClient/GUI/ChallengeGenerals.cpp # Source/GameClient/GUI/ControlBar/ControlBar.cpp # Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -739,14 +739,14 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GameFont.cpp Source/GameClient/GUI/GameWindow.cpp Source/GameClient/GUI/GameWindowGlobal.cpp -# Source/GameClient/GUI/GameWindowManager.cpp + Source/GameClient/GUI/GameWindowManager.cpp # Source/GameClient/GUI/GameWindowManagerScript.cpp Source/GameClient/GUI/GameWindowTransitions.cpp # Source/GameClient/GUI/GameWindowTransitionsStyles.cpp # Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp # Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp # Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp -# Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp + Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp # Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp # Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp # Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -792,7 +792,7 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp -# Source/GameClient/GUI/GUICallbacks/MessageBox.cpp + Source/GameClient/GUI/GUICallbacks/MessageBox.cpp # Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp Source/GameClient/GUI/HeaderTemplate.cpp Source/GameClient/GUI/IMEManager.cpp @@ -812,7 +812,7 @@ set(GAMEENGINE_SRC # Source/GameClient/MessageStream/CommandXlat.cpp # Source/GameClient/MessageStream/GUICommandTranslator.cpp # Source/GameClient/MessageStream/HintSpy.cpp -# Source/GameClient/MessageStream/HotKey.cpp + Source/GameClient/MessageStream/HotKey.cpp # Source/GameClient/MessageStream/LookAtXlat.cpp # Source/GameClient/MessageStream/MetaEvent.cpp # Source/GameClient/MessageStream/PlaceEventTranslator.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/Core/GameEngine/Include/GameClient/AnimateWindowManager.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/AnimateWindowManager.h rename to Core/GameEngine/Include/GameClient/AnimateWindowManager.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h b/Core/GameEngine/Include/GameClient/ExtendedMessageBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h rename to Core/GameEngine/Include/GameClient/ExtendedMessageBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowID.h b/Core/GameEngine/Include/GameClient/GameWindowID.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowID.h rename to Core/GameEngine/Include/GameClient/GameWindowID.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Core/GameEngine/Include/GameClient/GameWindowManager.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GameWindowManager.h rename to Core/GameEngine/Include/GameClient/GameWindowManager.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h b/Core/GameEngine/Include/GameClient/HotKey.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/HotKey.h rename to Core/GameEngine/Include/GameClient/HotKey.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/MessageBox.h b/Core/GameEngine/Include/GameClient/MessageBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/MessageBox.h rename to Core/GameEngine/Include/GameClient/MessageBox.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Core/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp rename to Core/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Core/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp rename to Core/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp b/Core/GameEngine/Source/GameClient/GameClientDispatch.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp rename to Core/GameEngine/Source/GameClient/GameClientDispatch.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/Core/GameEngine/Source/GameClient/MessageStream/HotKey.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp rename to Core/GameEngine/Source/GameClient/MessageStream/HotKey.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 539e7711fa1..304a5fc104e 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -129,7 +129,7 @@ set(GAMEENGINE_SRC # Include/Common/XferLoad.h # Include/Common/XferSave.h # Include/GameClient/Anim2D.h - Include/GameClient/AnimateWindowManager.h +# Include/GameClient/AnimateWindowManager.h # Include/GameClient/ChallengeGenerals.h Include/GameClient/CampaignManager.h # Include/GameClient/ClientInstance.h @@ -151,7 +151,7 @@ set(GAMEENGINE_SRC # Include/GameClient/DrawGroupInfo.h Include/GameClient/EstablishConnectionsMenu.h Include/GameClient/Eva.h - Include/GameClient/ExtendedMessageBox.h +# Include/GameClient/ExtendedMessageBox.h Include/GameClient/FontDesc.h # Include/GameClient/FXList.h Include/GameClient/Gadget.h @@ -171,8 +171,8 @@ set(GAMEENGINE_SRC # Include/GameClient/GameText.h # Include/GameClient/GameWindow.h # Include/GameClient/GameWindowGlobal.h - Include/GameClient/GameWindowID.h - Include/GameClient/GameWindowManager.h +# Include/GameClient/GameWindowID.h +# Include/GameClient/GameWindowManager.h # Include/GameClient/GameWindowTransitions.h # Include/GameClient/GlobalLanguage.h # Include/GameClient/GraphDraw.h @@ -180,7 +180,7 @@ set(GAMEENGINE_SRC Include/GameClient/GUICommandTranslator.h # Include/GameClient/HeaderTemplate.h Include/GameClient/HintSpy.h - Include/GameClient/HotKey.h +# Include/GameClient/HotKey.h # Include/GameClient/Image.h # Include/GameClient/IMEManager.h Include/GameClient/InGameUI.h @@ -191,7 +191,7 @@ set(GAMEENGINE_SRC # Include/GameClient/LoadScreen.h Include/GameClient/LookAtXlat.h # Include/GameClient/MapUtil.h - Include/GameClient/MessageBox.h +# Include/GameClient/MessageBox.h Include/GameClient/MetaEvent.h # Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h # Include/GameClient/Module/BeaconClientUpdate.h @@ -649,11 +649,11 @@ set(GAMEENGINE_SRC Source/GameClient/Eva.cpp # Source/GameClient/FXList.cpp Source/GameClient/GameClient.cpp - Source/GameClient/GameClientDispatch.cpp +# Source/GameClient/GameClientDispatch.cpp # Source/GameClient/GameText.cpp # Source/GameClient/GlobalLanguage.cpp # Source/GameClient/GraphDraw.cpp - Source/GameClient/GUI/AnimateWindowManager.cpp +# Source/GameClient/GUI/AnimateWindowManager.cpp # Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -683,14 +683,14 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GameFont.cpp # Source/GameClient/GUI/GameWindow.cpp # Source/GameClient/GUI/GameWindowGlobal.cpp - Source/GameClient/GUI/GameWindowManager.cpp +# Source/GameClient/GUI/GameWindowManager.cpp Source/GameClient/GUI/GameWindowManagerScript.cpp # Source/GameClient/GUI/GameWindowTransitions.cpp Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp - Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -735,7 +735,7 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp - Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/MessageBox.cpp Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp # Source/GameClient/GUI/HeaderTemplate.cpp # Source/GameClient/GUI/IMEManager.cpp @@ -755,7 +755,7 @@ set(GAMEENGINE_SRC Source/GameClient/MessageStream/CommandXlat.cpp Source/GameClient/MessageStream/GUICommandTranslator.cpp Source/GameClient/MessageStream/HintSpy.cpp - Source/GameClient/MessageStream/HotKey.cpp +# Source/GameClient/MessageStream/HotKey.cpp Source/GameClient/MessageStream/LookAtXlat.cpp Source/GameClient/MessageStream/MetaEvent.cpp Source/GameClient/MessageStream/PlaceEventTranslator.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h deleted file mode 100644 index aad9e80b7a2..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/AnimateWindowManager.h +++ /dev/null @@ -1,235 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: AnimateWindowManager.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Mar 2002 -// -// Filename: AnimateWindowManager.h -// -// author: Chris Huybregts -// -// purpose: The Animate Window class will be used by registering a window with -// the manager with stating what kind of animation to do. Then on every -// update, we'll move the windows. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Lib/BaseType.h" -#include "Common/SubsystemInterface.h" -#include "Common/GameMemory.h" - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class GameWindow; -class ProcessAnimateWindowSlideFromBottom; -class ProcessAnimateWindowSlideFromBottomTimed; -class ProcessAnimateWindowSlideFromTop; -class ProcessAnimateWindowSlideFromLeft; -class ProcessAnimateWindowSlideFromRight; -class ProcessAnimateWindowSlideFromRightFast; -class ProcessAnimateWindowSpiral; -class ProcessAnimateWindowSlideFromTopFast; -class ProcessAnimateWindowSideSelect; -class ProcessAnimateWindow; - -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -enum AnimTypes CPP_11(: Int) -{ - WIN_ANIMATION_NONE = 0, - WIN_ANIMATION_SLIDE_RIGHT, - WIN_ANIMATION_SLIDE_RIGHT_FAST, - WIN_ANIMATION_SLIDE_LEFT, - WIN_ANIMATION_SLIDE_TOP, - WIN_ANIMATION_SLIDE_BOTTOM, - WIN_ANIMATION_SPIRAL, - WIN_ANIMATION_SLIDE_BOTTOM_TIMED, - WIN_ANIMATION_SLIDE_TOP_FAST, - WIN_ANIMATION_COUNT -} ; - -//----------------------------------------------------------------------------- -// TheSuperHackers @build xezon 14/03/2025 Puts class into namespace to avoid name collision with AnimateWindow function in WinUser.h -namespace wnd -{ -class AnimateWindow : public MemoryPoolObject -{ - MEMORY_POOL_GLUE_WITH_USERLOOKUP_CREATE(AnimateWindow, "AnimateWindow") -public: - AnimateWindow(); - //~AnimateWindow(); - - static AnimateWindow* createNewInstance() - { - return newInstance(AnimateWindow); - } - - void setAnimData( ICoord2D startPos, ICoord2D endPos, ICoord2D curPos, ICoord2D restPos, Coord2D vel, UnsignedInt startTime, UnsignedInt endTime); - - ICoord2D getStartPos(); ///< Get the Start Position 2D coord - ICoord2D getCurPos(); ///< Get the Current Position 2D coord - ICoord2D getEndPos(); ///< Get the End Position 2D coord - ICoord2D getRestPos(); ///< Get the Rest Position 2D coord - GameWindow *getGameWindow(); ///< Get the GameWindow that will be animating - AnimTypes getAnimType(); ///< Get the Animation type - UnsignedInt getDelay(); ///< Get the Time Delay - Coord2D getVel(); ///< Get the Velocity Position 2D coord - UnsignedInt getStartTime(); ///< Get the start time of the time-based anim - UnsignedInt getEndTime(); ///< Get the end time of the time-based anim - - void setStartPos( ICoord2D starPos); ///< Set the Start Position 2D coord - void setCurPos( ICoord2D curPos); ///< Set the Current Position 2D coord - void setEndPos( ICoord2D endPos); ///< Set the End Position 2D coord - void setRestPos( ICoord2D restPos); ///< Set the Rest Position 2D coord - void setGameWindow( GameWindow *win); ///< Set the GameWindow that will be animating - void setAnimType( AnimTypes animType); ///< Set the Animation type - void setDelay( UnsignedInt delay); ///< Set the Time Delay - void setVel( Coord2D vel); ///< Set the Velocity Position 2D coord - void setStartTime( UnsignedInt t); ///< Set the start time of the time-based anim - void setEndTime( UnsignedInt t); ///< Set the end time of the time-based anim - - void setFinished(Bool finished); ///< Set if the animation has finished - Bool isFinished(); ///< Return if the animation has finished or not. - void setNeedsToFinish( Bool needsToFinish); ///< set if we need this animation to finish for the manager to return true - Bool needsToFinish(); ///< set if the animation has finished - -private: - UnsignedInt m_delay; ///< Holds the delay time in which the animation will start (in milliseconds) - ICoord2D m_startPos; ///< Holds the starting position of the animation - ///<(usually is also the end position of the animation when the animation is reversed) - ICoord2D m_endPos; ///< Holds the target End Position (usually is the same as the rest position) - ICoord2D m_curPos; ///< It's Current Position - ICoord2D m_restPos; ///< When the Manager Resets, It sets the window's position to this position - GameWindow *m_win; ///< the window that this animation is happening on - Coord2D m_vel; ///< the Velocity of the animation - UnsignedInt m_startTime; ///< time we started the time-based anim - UnsignedInt m_endTime; ///< time we should end the time-based anim - AnimTypes m_animType; ///< The type of animation that will happen - Bool m_needsToFinish; ///< Flag to tell the manager if we need to finish before it's done with it's animation - Bool m_isFinished; ///< We're finished -}; -} // namespace wnd - - - -//----------------------------------------------------------------------------- -typedef std::list AnimateWindowList; - -//----------------------------------------------------------------------------- -class AnimateWindowManager : public SubsystemInterface -{ -public: - AnimateWindowManager(); - virtual ~AnimateWindowManager() override; - - // Inhertited from subsystem ==================================================================== - virtual void init() override; - virtual void reset() override; - virtual void update() override; - //=============================================================================================== - - void registerGameWindow(GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt ms = 0, UnsignedInt delayMs = 0); // Registers a new window to animate. - Bool isFinished(); ///< Are all the animations that need to be finished, finished? - void reverseAnimateWindow(); ///< tell each animation type to setup the windows to run in reverse - void resetToRestPosition(); ///< Reset all windows to their rest position - Bool isReversed(); ///< Returns whether or not we're in our reversed state. - Bool isEmpty(); -private: - AnimateWindowList m_winList; ///< A list of AnimationWindows that we don't care if their finished animating - AnimateWindowList m_winMustFinishList; ///< A list of AnimationWindows that we do care about - Bool m_needsUpdate; ///< If we're done animating all our monitored windows, then this will be false - Bool m_reverse; ///< Are we in a reverse state? - ProcessAnimateWindowSlideFromRight *m_slideFromRight; ///< Holds the process in which the windows slide from the right - ProcessAnimateWindowSlideFromRightFast *m_slideFromRightFast; - ProcessAnimateWindowSlideFromTop *m_slideFromTop; ///< Holds the process in which the windows slide from the Top - ProcessAnimateWindowSlideFromLeft *m_slideFromLeft; ///< Holds the process in which the windows slide from the Left - ProcessAnimateWindowSlideFromBottom *m_slideFromBottom; ///< Holds the process in which the windows slide from the Bottom - ProcessAnimateWindowSpiral *m_spiral; ///< Holds the process in which the windows Spiral onto the screen - ProcessAnimateWindowSlideFromBottomTimed *m_slideFromBottomTimed; ///< Holds the process in which the windows slide from the Bottom in a time-based fashion - ProcessAnimateWindowSlideFromTopFast *m_slideFromTopFast; ///< holds the process in wich the windows slide from the top,fast - ProcessAnimateWindow *getProcessAnimate( AnimTypes animType); ///< returns the process for the kind of animation we need. - -}; - -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -namespace wnd -{ - inline ICoord2D AnimateWindow::getStartPos() { return m_startPos; }; - inline ICoord2D AnimateWindow::getCurPos() { return m_curPos; }; - inline ICoord2D AnimateWindow::getEndPos() { return m_endPos; }; - inline ICoord2D AnimateWindow::getRestPos() { return m_restPos; }; - inline GameWindow *AnimateWindow::getGameWindow(){ return m_win; }; - inline AnimTypes AnimateWindow::getAnimType() { return m_animType; }; - inline UnsignedInt AnimateWindow::getDelay() { return m_delay; }; - inline Coord2D AnimateWindow::getVel() { return m_vel; }; - inline UnsignedInt AnimateWindow::getStartTime() { return m_startTime; }; - inline UnsignedInt AnimateWindow::getEndTime() { return m_endTime; }; - - inline void AnimateWindow::setStartPos( ICoord2D startPos) { m_startPos = startPos; }; - inline void AnimateWindow::setCurPos( ICoord2D curPos) { m_curPos = curPos; }; - inline void AnimateWindow::setEndPos( ICoord2D endPos) { m_endPos = endPos; }; - inline void AnimateWindow::setRestPos( ICoord2D restPos) { m_restPos = restPos; }; - inline void AnimateWindow::setGameWindow( GameWindow *win) { m_win = win; }; - inline void AnimateWindow::setAnimType( AnimTypes animType) { m_animType = animType; }; - inline void AnimateWindow::setDelay( UnsignedInt delay) { m_delay = delay; }; - inline void AnimateWindow::setVel( Coord2D vel) { m_vel = vel; }; - inline void AnimateWindow::setStartTime( UnsignedInt t ) { m_startTime = t; } - inline void AnimateWindow::setEndTime( UnsignedInt t ) { m_endTime = t; } - - inline void AnimateWindow::setFinished( Bool finished) { m_isFinished = finished; }; - inline Bool AnimateWindow::isFinished() { return m_isFinished; }; - inline void AnimateWindow::setNeedsToFinish( Bool needsToFinish) { m_needsToFinish = needsToFinish; }; - inline Bool AnimateWindow::needsToFinish() { return m_needsToFinish; }; -} // namespace wnd - - inline Bool AnimateWindowManager::isFinished() { return !m_needsUpdate; }; - inline Bool AnimateWindowManager::isReversed() { return m_reverse; }; - inline Bool AnimateWindowManager::isEmpty(){return (m_winList.empty() && m_winMustFinishList.empty()); } -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h b/Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h deleted file mode 100644 index 25c13a718f8..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ExtendedMessageBox.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ExtendedMessageBox.h ///////////////////////////////////////////////////////////////////// -// Author: Matt Campbell, January 2003 -// Description: We go quiet in 1 day, gold in 15. Poor time to rewrite message boxes, so -// we get this file instead. Phooey. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/GameWindowManager.h" - -// return codes for message box callbacks -enum MessageBoxReturnType CPP_11(: Int) { - MB_RETURN_CLOSE, - MB_RETURN_KEEPOPEN -}; - -typedef MessageBoxReturnType (* MessageBoxFunc)( void *userData ); - -// WindowExMessageBoxData --------------------------------------------------------- -/** Data attached to each extended Message box window */ -//----------------------------------------------------------------------------- -struct WindowExMessageBoxData -{ - MessageBoxFunc yesCallback; ///. -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameWindowID.h /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GameWindowID.h -// -// Created: Colin Day, July 2001 -// -// Desc: Game window ID definitions, this is so we can uniquely -// identify any window in the game and pass messages from -// anywhere to anywhere else instantly -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -#define GWID_INVALID 0 - -#define GWID_SIDEBAR 100 - -#define GWID_SIDEBAR_1 101 -#define GWID_SIDEBAR_2 102 -#define GWID_SIDEBAR_3 103 -#define GWID_SIDEBAR_4 104 -#define GWID_SIDEBAR_5 105 -#define GWID_SIDEBAR_6 106 -#define GWID_SIDEBAR_7 107 -#define GWID_SIDEBAR_8 108 -#define GWID_SIDEBAR_9 109 -#define GWID_SIDEBAR_10 110 -#define GWID_SIDEBAR_11 111 -#define GWID_SIDEBAR_12 112 - -#define GWID_SIDEBAR_TAB_1 151 -#define GWID_SIDEBAR_TAB_2 152 -#define GWID_SIDEBAR_TAB_3 153 -#define GWID_SIDEBAR_TAB_4 154 - -#define GWID_SIDEBAR_RADAR 175 - -// INLINING /////////////////////////////////////////////////////////////////// - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h b/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h deleted file mode 100644 index a3a4f53a4a6..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GameWindowManager.h +++ /dev/null @@ -1,414 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameWindowManager.h ////////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Desc: The game window manager is the interface for interacting with -// the windowing system for purposes of any menus, or GUI -// controls. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "Common/STLTypedefs.h" -#include "Common/SubsystemInterface.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/Gadget.h" - -class GameWindow; - -//------------------------------------------------------------------------------------------------- -/** Window layout info is a structure that can be passed to the load function of - * a window script. After the script is loaded, this parameter (if present) - * will contain information about the script file at a global level such - * as what file version was loaded, global layout callbacks, etc */ -//------------------------------------------------------------------------------------------------- -enum { MAX_LAYOUT_FUNC_LEN = 256 }; - -typedef std::list GameWindowList; - -class WindowLayoutInfo -{ - -public: - WindowLayoutInfo(); - - UnsignedInt version; ///< file version that was loaded - WindowLayoutInitFunc init; ///< init method (if specified) - WindowLayoutUpdateFunc update; ///< update method (if specified) - WindowLayoutShutdownFunc shutdown; ///< shutdown method (if specified) - AsciiString initNameString; ///< init method in flavor of string name - AsciiString updateNameString; ///< update method in string flavor - AsciiString shutdownNameString; ///< shutdown method in string flavor, mmm! - std::list windows; ///< list of top-level windows in the layout -}; - -//------------------------------------------------------------------------------------------------- -/** There exists a singleton GameWindowManager that defines how we can - * interact with the game windowing system */ -//------------------------------------------------------------------------------------------------- -class GameWindowManager : public SubsystemInterface -{ - -friend class GameWindow; - -public: - - GameWindowManager(); - virtual ~GameWindowManager() override; - - //----------------------------------------------------------------------------------------------- - virtual void init() override; ///< initialize function - virtual void reset() override; ///< reset the system - virtual void update() override; ///< update method, called once per frame - - virtual GameWindow *allocateNewWindow() = 0; ///< new game window - - void linkWindow( GameWindow *window ); ///< link into master list - void unlinkWindow( GameWindow *window ); ///< unlink from master list - void unlinkChildWindow( GameWindow *window ); ///< remove child from parent list - void insertWindowAheadOf( GameWindow *window, GameWindow *aheadOf ); ///< add window to list 'ahead of' - - virtual GameWinDrawFunc getPushButtonImageDrawFunc() = 0; - virtual GameWinDrawFunc getPushButtonDrawFunc() = 0; - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() = 0; - virtual GameWinDrawFunc getCheckBoxDrawFunc() = 0; - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() = 0; - virtual GameWinDrawFunc getRadioButtonDrawFunc() = 0; - virtual GameWinDrawFunc getTabControlImageDrawFunc() = 0; - virtual GameWinDrawFunc getTabControlDrawFunc() = 0; - virtual GameWinDrawFunc getListBoxImageDrawFunc() = 0; - virtual GameWinDrawFunc getListBoxDrawFunc() = 0; - virtual GameWinDrawFunc getComboBoxImageDrawFunc() = 0; - virtual GameWinDrawFunc getComboBoxDrawFunc() = 0; - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() = 0; - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() = 0; - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() = 0; - virtual GameWinDrawFunc getVerticalSliderDrawFunc() = 0; - virtual GameWinDrawFunc getProgressBarImageDrawFunc() = 0; - virtual GameWinDrawFunc getProgressBarDrawFunc() = 0; - virtual GameWinDrawFunc getStaticTextImageDrawFunc() = 0; - virtual GameWinDrawFunc getStaticTextDrawFunc() = 0; - virtual GameWinDrawFunc getTextEntryImageDrawFunc() = 0; - virtual GameWinDrawFunc getTextEntryDrawFunc() = 0; - - //--------------------------------------------------------------------------- - - virtual GameWinDrawFunc getDefaultDraw(); ///< return default draw func - virtual GameWinSystemFunc getDefaultSystem(); ///< return default system func - virtual GameWinInputFunc getDefaultInput(); ///< return default input func - virtual GameWinTooltipFunc getDefaultTooltip(); ///< return default tooltip func - - //--------------------------------------------------------------------------- - // MessageBox creation - virtual GameWindow *gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback ); - - virtual GameWindow *gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback, Bool useLogo ); - - - //--------------------------------------------------------------------------- - // gadget creation - virtual GameWindow *gogoGadgetPushButton( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetCheckbox( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetRadioButton( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - RadioButtonData *rData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetTabControl( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - TabControlData *rData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetListBox( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - ListboxData *listboxData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetSlider( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - SliderData *sliderData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetProgressBar( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetStaticText( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - TextData *textData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetTextEntry( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - EntryData *entryData, - GameFont *defaultFont, Bool defaultVisual ); - virtual GameWindow *gogoGadgetComboBox( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - WinInstanceData *instData, - ComboBoxData *comboBoxDataTemplate, - GameFont *defaultFont, Bool defaultVisual ); - - /** Use this method to assign the default images to gadgets as - * they area created */ - virtual void assignDefaultGadgetLook( GameWindow *gadget, - GameFont *defaultFont, - Bool assignVisual ); - - //--------------------------------------------------------------------------- - // Creating windows - /// create new window(s) from .wnd file ... see definition for what is returned - virtual GameWindow *winCreateFromScript( AsciiString filename, WindowLayoutInfo *info = nullptr ); - - /// create new window(s) from .wnd file and wrap in a WindowLayout - virtual WindowLayout *winCreateLayout( AsciiString filename ); - - /// free temporary strings to make the memory leak manager happy. - virtual void freeStaticStrings(); - - /// create a new window by setting up parameters and callbacks - virtual GameWindow *winCreate( GameWindow *parent, UnsignedInt status, - Int x, Int y, Int width, Int height, - GameWinSystemFunc system, - WinInstanceData *instData = nullptr ); - - //--------------------------------------------------------------------------- - // Manipulating windows in the system - virtual Int winDestroy( GameWindow *window ); ///< destroy this window - virtual Int winDestroyAll(); ///< destroy all windows in the system - virtual GameWindow *winGetWindowList(); ///< get head of master list - - /// hide all windows in a certain range of id's (inclusive ); - virtual void hideWindowsInRange( GameWindow *baseWindow, Int first, Int last, - Bool hideFlag ); - /// enable all windows in a range of id's (inclusive) - virtual void enableWindowsInRange( GameWindow *baseWindow, Int first, Int last, - Bool enableFlag ); - - /// this gets called from winHide() when a window hides itself - virtual void windowHiding( GameWindow *window ); - - virtual void winRepaint(); ///< draw GUI in reverse order - - virtual void winNextTab( GameWindow *window ); ///< give keyboard focus to the next window in the tab list - - virtual void winPrevTab( GameWindow *window ); ///< give keyboard focus to the previous window in the tab list - - virtual void registerTabList( GameWindowList tabList ); ///< we have to register a Tab List - virtual void clearTabList(); ///< we's gotz ta clear the tab list yo! - - // -------------------------------------------------------------------------- - /// process a single mouse event - virtual WinInputReturnCode winProcessMouseEvent( GameWindowMessage msg, - ICoord2D *mousePos, - void *data ); - /// process a singke key event - virtual WinInputReturnCode winProcessKey( UnsignedByte key, - UnsignedByte state ); - // -------------------------------------------------------------------------- - - virtual GameWindow *winGetFocus(); ///< return window that has the focus - virtual Int winSetFocus( GameWindow *window ); ///< set this window as has focus - virtual void winSetGrabWindow( GameWindow *window ); ///< set the grab window - virtual GameWindow *winGetGrabWindow(); ///< who is currently 'held' by mouse - virtual void winSetLoneWindow( GameWindow *window ); ///< set the open window - - // Finds the top-level window at the mouse position that matches the required and forbidden status masks. - virtual GameWindow* findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); - static bool isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask); - - virtual Bool isEnabled( GameWindow *win ); ///< is window or parents enabled - virtual Bool isHidden( GameWindow *win ); ///< is parent or parents hidden - virtual void addWindowToParent( GameWindow *window, GameWindow *parent ); - virtual void addWindowToParentAtEnd( GameWindow *window, GameWindow *parent ); - - /// sends a system message to specified window - virtual WindowMsgHandledType winSendSystemMsg( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - - /// sends an input message to the specified window - virtual WindowMsgHandledType winSendInputMsg( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - - /** get the window pointer from id, starting at 'window' and searching - down the hierarchy. If 'window' is nullptr then all windows will - be searched */ - virtual GameWindow *winGetWindowFromId( GameWindow *window, Int id ); - virtual Int winCapture( GameWindow *window ); ///< captures the mouse - virtual Int winRelease( GameWindow *window ); ///< release mouse capture - virtual GameWindow *winGetCapture(); ///< current mouse capture settings - - virtual Int winSetModal( GameWindow *window ); ///< put at top of modal stack - virtual Int winUnsetModal( GameWindow *window ); /**< take window off modal stack, if window is - not at top of stack and error will occur */ - - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - // The following public functions you should implement change the guts - // for to work with your application. Rather than draw images, or do string - // operations with native methods, the game window system will always call - // these methods to get the work done it needs - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - - /// draw image, coord are in screen and should be kepth within that box specified - virtual void winDrawImage( const Image *image, Int startX, Int startY, Int endX, Int endY, Color color = 0xFFFFFFFF ); - /// draw filled rect, coords are absolute screen coords - virtual void winFillRect( Color color, Real width, Int startX, Int startY, Int endX, Int endY ); - /// draw rect outline, coords are absolute screen coords - virtual void winOpenRect( Color color, Real width, Int startX, Int startY, Int endX, Int endY ); - /// draw line, coords are absolute screen coords - virtual void winDrawLine( Color color, Real width, Int startX, Int startY, Int endX, Int endY ); - /// Make a color representation out of RGBA components - virtual Color winMakeColor( UnsignedByte red, UnsignedByte green, UnsignedByte blue, UnsignedByte alpha ); - /** Find an image reference and return a pointer to its image, you may - recreate all Image structs to suit your project */ - virtual const Image *winFindImage( const char *name ); - virtual Int winFontHeight( GameFont *font ); ///< get height of font in pixels - virtual Int winIsDigit( Int c ); ///< is character a digit - virtual Int winIsAscii( Int c ); ///< is character a digit - virtual Int winIsAlNum( Int c ); ///< is character alpha-numeric - virtual void winFormatText( GameFont *font, UnicodeString text, Color color, - Int x, Int y, Int width, Int height ); - virtual void winGetTextSize( GameFont *font, UnicodeString text, - Int *width, Int *height, Int maxWidth ); - virtual UnicodeString winTextLabelToText( AsciiString label ); ///< convert localizable text label to real text - virtual GameFont *winFindFont( AsciiString fontName, Int pointSize, Bool bold ); ///< get a font given a name - - /// @todo just for testing, remov this - Bool initTestGUI(); - - virtual GameWindow *getWindowUnderCursor( Int x, Int y, Bool ignoreEnabled = FALSE ); ///< find the top window at the given coordinates - - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - //--------------------------------------------------------------------------- - ///////////////////////////////////////////////////////////////////////////// - //--------------------------------------------------------------------------- - -protected: - - void processDestroyList(); ///< process windows waiting to be killed - - Int drawWindow( GameWindow *window ); ///< draw this window - - void dumpWindow( GameWindow *window ); ///< for debugging - - GameWindow *m_windowList; // list of all top level windows - GameWindow *m_windowTail; // last in windowList - - GameWindow *m_destroyList; // list of windows to destroy - - GameWindow *m_currMouseRgn; // window that mouse is over - GameWindow *m_mouseCaptor; // window that captured mouse - GameWindow *m_keyboardFocus; // window that has input focus - ModalWindow *m_modalHead; // top of windows in the modal stack - GameWindow *m_grabWindow; // window that grabbed the last down event - GameWindow *m_loneWindow; // Set if we just opened a Lone Window - GameWindowList m_tabList; // we have to register a tab list to make a tab list. - const Image *m_cursorBitmap; - UnsignedInt m_captureFlags; - -}; - -// INLINE ///////////////////////////////////////////////////////////////////////////////////////// -inline GameWinDrawFunc GameWindowManager::getDefaultDraw() { return GameWinDefaultDraw; } -inline GameWinSystemFunc GameWindowManager::getDefaultSystem() { return GameWinDefaultSystem; } -inline GameWinInputFunc GameWindowManager::getDefaultInput() { return GameWinDefaultInput; } -inline GameWinTooltipFunc GameWindowManager::getDefaultTooltip() { return GameWinDefaultTooltip; } - -// EXTERN ///////////////////////////////////////////////////////////////////////////////////////// -extern GameWindowManager *TheWindowManager; ///< singleton extern definition -extern UnsignedInt WindowLayoutCurrentVersion; ///< current version of our window layouts - -// this function lets us generically pass button selections to our parent, we may -// frequently want to do this because we want windows grouped on child windows for -// convenience, but only want one logical system procedure responding to them all -extern WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ); -extern WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ); - -// TheSuperHackers @feature helmutbuhler 24/04/2025 -// GameWindowManager that does nothing. Used for Headless Mode. -class GameWindowManagerDummy : public GameWindowManager -{ -public: - virtual GameWindow *winGetWindowFromId(GameWindow *window, Int id) override; - virtual GameWindow *winCreateFromScript(AsciiString filenameString, WindowLayoutInfo *info) override; - - virtual GameWindow *allocateNewWindow() override { return newInstance(GameWindowDummy); } - - virtual GameWinDrawFunc getPushButtonImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getPushButtonDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getCheckBoxImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getCheckBoxDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getRadioButtonImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getRadioButtonDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTabControlImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTabControlDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getListBoxImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getListBoxDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getComboBoxImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getComboBoxDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getHorizontalSliderImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getHorizontalSliderDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getVerticalSliderImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getVerticalSliderDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getProgressBarImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getProgressBarDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getStaticTextImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getStaticTextDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTextEntryImageDrawFunc() override { return nullptr; } - virtual GameWinDrawFunc getTextEntryDrawFunc() override { return nullptr; } -}; diff --git a/Generals/Code/GameEngine/Include/GameClient/HotKey.h b/Generals/Code/GameEngine/Include/GameClient/HotKey.h deleted file mode 100644 index 3c9cade4eef..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/HotKey.h +++ /dev/null @@ -1,112 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - - -// FILE: HotKey.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: HotKey.h -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "Common/SubsystemInterface.h" -#include "Common/MessageStream.h" -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class AsciiString; -class GameWindow; -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class HotKeyTranslator : public GameMessageTranslator -{ -public: - virtual GameMessageDisposition translateGameMessage(const GameMessage *msg) override; - virtual ~HotKeyTranslator() override { } -}; - -//----------------------------------------------------------------------------- -class HotKey -{ -public: - HotKey(); - GameWindow *m_win; - AsciiString m_key; - // we may need a checkmark system. -}; - -//----------------------------------------------------------------------------- -class HotKeyManager : public SubsystemInterface -{ -public: - HotKeyManager(); - virtual ~HotKeyManager() override; - // Inherited from subsystem interface ----------------------------------------------------------- - virtual void init() override; ///< Initialize the Hotkey system - virtual void update() override {} ///< A No-op for us - virtual void reset() override; ///< Reset - //----------------------------------------------------------------------------------------------- - - void addHotKey( GameWindow *win, const AsciiString& key); - Bool executeHotKey( const AsciiString& key); // called fromt eh HotKeyTranslator - - AsciiString searchHotKey( const AsciiString& label); - AsciiString searchHotKey( const UnicodeString& uStr ); - -private: - typedef std::map HotKeyMap; - HotKeyMap m_hotKeyMap; -}; -extern HotKeyManager *TheHotKeyManager; -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/MessageBox.h b/Generals/Code/GameEngine/Include/GameClient/MessageBox.h deleted file mode 100644 index cf5951e0990..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/MessageBox.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MessageBox.h ///////////////////////////////////////////////////////////////////////////// -// Author: Chris Huybregts, November 2001 -// Description: Message Box file containing user aliases -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#pragma once - -#include "GameClient/GameWindowManager.h" - -GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback); ///< convenience function for displaying a Message box with Yes and No buttons -GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback); ///< convenience function for displaying a Message box with Yes and No buttons - - -GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Yes,No and Cancel buttons - - -GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Ok and Cancel buttons - -GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback);///< convenience function for displaying a Message box with Ok button - - -GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback);///< convenience function for displaying a Message box with Cancel button diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp deleted file mode 100644 index c2b73a16b11..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp +++ /dev/null @@ -1,422 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: AnimateWindowManager.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Mar 2002 -// -// Filename: AnimateWindowManager.cpp -// -// author: Chris Huybregts -// -// purpose: This will contain the logic behind the different animations that -// can happen to a window. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/AnimateWindowManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Display.h" -#include "GameClient/ProcessAnimateWindow.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// AnimateWindow PUBLIC FUNCTIONS ///////////////////////////////////////////// -//----------------------------------------------------------------------------- -namespace wnd -{ -AnimateWindow::AnimateWindow() -{ - m_delay = 0; - m_startPos.x = m_startPos.y = 0; - m_endPos.x = m_endPos.y = 0; - m_curPos.x = m_curPos.y = 0; - m_win = nullptr; - m_animType = WIN_ANIMATION_NONE; - - m_restPos.x = m_restPos.y = 0; - m_vel.x = m_vel.y = 0.0f; - m_needsToFinish = FALSE; - m_isFinished = FALSE; - m_endTime = 0; - m_startTime = 0; -} -AnimateWindow::~AnimateWindow() -{ - m_win = nullptr; -} - -void AnimateWindow::setAnimData( ICoord2D startPos, ICoord2D endPos, - ICoord2D curPos, ICoord2D restPos, - Coord2D vel, UnsignedInt startTime, - UnsignedInt endTime ) - -{ - m_startPos = startPos; - m_endPos = endPos; - m_curPos = curPos; - m_restPos = restPos; - m_vel = vel; - m_startTime = startTime; - m_endTime = endTime; - -} - -} // namespace wnd - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static void clearWinList(AnimateWindowList &winList) -{ - while (!winList.empty()) - { - wnd::AnimateWindow *win = *(winList.begin()); - winList.pop_front(); - deleteInstance(win); - } -} - -AnimateWindowManager::AnimateWindowManager() -{ -// we don't allocate many of these, so no MemoryPools used - m_slideFromRight = NEW ProcessAnimateWindowSlideFromRight; - m_slideFromRightFast = NEW ProcessAnimateWindowSlideFromRightFast; - m_slideFromLeft = NEW ProcessAnimateWindowSlideFromLeft; - m_slideFromTop = NEW ProcessAnimateWindowSlideFromTop; - m_slideFromTopFast = NEW ProcessAnimateWindowSlideFromTopFast; - m_slideFromBottom = NEW ProcessAnimateWindowSlideFromBottom; - m_spiral = NEW ProcessAnimateWindowSpiral; - m_slideFromBottomTimed = NEW ProcessAnimateWindowSlideFromBottomTimed; - m_winList.clear(); - m_needsUpdate = FALSE; - m_reverse = FALSE; - m_winMustFinishList.clear(); -} -AnimateWindowManager::~AnimateWindowManager() -{ - delete m_slideFromRight; - delete m_slideFromRightFast; - delete m_slideFromLeft; - delete m_slideFromTop; - delete m_slideFromTopFast; - delete m_slideFromBottom; - delete m_spiral; - delete m_slideFromBottomTimed; - - m_slideFromRight = nullptr; - resetToRestPosition(); - clearWinList(m_winList); - clearWinList(m_winMustFinishList); -} - - -void AnimateWindowManager::init() -{ - clearWinList(m_winList); - clearWinList(m_winMustFinishList); - m_needsUpdate = FALSE; - m_reverse = FALSE; -} - -void AnimateWindowManager::reset() -{ - resetToRestPosition(); - clearWinList(m_winList); - clearWinList(m_winMustFinishList); - m_needsUpdate = FALSE; - m_reverse = FALSE; -} - -void AnimateWindowManager::update() -{ - - ProcessAnimateWindow *processAnim = nullptr; - - // if we need to update the windows that need to finish, update that list - if(m_needsUpdate) - { - AnimateWindowList::iterator it = m_winMustFinishList.begin(); - m_needsUpdate = FALSE; - - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - processAnim = getProcessAnimate( animWin->getAnimType() ); - if(processAnim) - { - if(m_reverse) - { - if(!processAnim->reverseAnimateWindow(animWin)) - m_needsUpdate = TRUE; - } - else - { - if(!processAnim->updateAnimateWindow(animWin)) - m_needsUpdate = TRUE; - } - } - - it ++; - } - } - - AnimateWindowList::iterator it = m_winList.begin(); - - while (it != m_winList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - processAnim = getProcessAnimate( animWin->getAnimType() ); - if(m_reverse) - { - if(processAnim) - processAnim->reverseAnimateWindow(animWin); - } - else - { - if(processAnim) - processAnim->updateAnimateWindow(animWin); - } - it ++; - } -} - - -void AnimateWindowManager::registerGameWindow(GameWindow *win, AnimTypes animType, Bool needsToFinish, UnsignedInt ms, UnsignedInt delayMs) -{ - if(!win) - { - DEBUG_CRASH(("Win was null as it was passed into registerGameWindow... not good indeed")); - return; - } - if(animType <= WIN_ANIMATION_NONE || animType >= WIN_ANIMATION_COUNT ) - { - DEBUG_CRASH(("an Invalid WIN_ANIMATION type was passed into registerGameWindow... please fix me ")); - return; - } - - // Create a new AnimateWindow class and fill in it's data. - wnd::AnimateWindow *animWin = wnd::AnimateWindow::createNewInstance(); - animWin->setGameWindow(win); - animWin->setAnimType(animType); - animWin->setNeedsToFinish(needsToFinish); - animWin->setDelay(delayMs); - - // Run the window through the processAnim's init function. - ProcessAnimateWindow *processAnim = getProcessAnimate( animType ); - if(processAnim) - { - processAnim->setMaxDuration(ms); - processAnim->initAnimateWindow( animWin ); - } - - // Add the Window to the proper list - if(needsToFinish) - { - m_winMustFinishList.push_back(animWin); - m_needsUpdate = TRUE; - } - else - m_winList.push_back(animWin); -} - -ProcessAnimateWindow *AnimateWindowManager::getProcessAnimate( AnimTypes animType ) -{ - switch (animType) { - case WIN_ANIMATION_SLIDE_RIGHT: - { - return m_slideFromRight; - } - case WIN_ANIMATION_SLIDE_RIGHT_FAST: - { - return m_slideFromRightFast; - } - case WIN_ANIMATION_SLIDE_LEFT: - { - return m_slideFromLeft; - } - case WIN_ANIMATION_SLIDE_TOP: - { - return m_slideFromTop; - } - case WIN_ANIMATION_SLIDE_BOTTOM: - { - return m_slideFromBottom; - } - case WIN_ANIMATION_SPIRAL: - { - return m_spiral; - } - case WIN_ANIMATION_SLIDE_BOTTOM_TIMED: - { - return m_slideFromBottomTimed; - } - case WIN_ANIMATION_SLIDE_TOP_FAST: - { - return m_slideFromTopFast; - } - default: - return nullptr; - } -} - -void AnimateWindowManager::reverseAnimateWindow() -{ - - m_reverse = TRUE; - m_needsUpdate = TRUE; - ProcessAnimateWindow *processAnim = nullptr; - - UnsignedInt maxDelay = 0; - AnimateWindowList::iterator it = m_winMustFinishList.begin(); - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - if(animWin->getDelay() > maxDelay) - maxDelay = animWin->getDelay(); - it ++; - } - - it = m_winMustFinishList.begin(); - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - // Run the window through the processAnim's init function. - processAnim = getProcessAnimate( animWin->getAnimType() ); - if(processAnim) - { - processAnim->initReverseAnimateWindow( animWin, maxDelay ); - } - - animWin->setFinished(FALSE); - it ++; - } - - it = m_winList.begin(); - - while (it != m_winList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - processAnim = getProcessAnimate( animWin->getAnimType() ); - - if(processAnim) - processAnim->initReverseAnimateWindow(animWin); - animWin->setFinished(FALSE); - it ++; - } - -} - -void AnimateWindowManager::resetToRestPosition() -{ - - m_reverse = TRUE; - m_needsUpdate = TRUE; - - AnimateWindowList::iterator it = m_winMustFinishList.begin(); - while (it != m_winMustFinishList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - ICoord2D restPos = animWin->getRestPos(); - GameWindow *win = animWin->getGameWindow(); - if(win) - win->winSetPosition(restPos.x, restPos.y); - it ++; - } - it = m_winList.begin(); - while (it != m_winList.end()) - { - wnd::AnimateWindow *animWin = *it; - if (!animWin) - { - DEBUG_CRASH(("There's No AnimateWindow in the AnimateWindow List")); - return; - } - ICoord2D restPos = animWin->getRestPos(); - GameWindow *win = animWin->getGameWindow(); - if(win) - win->winSetPosition(restPos.x, restPos.y); - it ++; - } - - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - - - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp deleted file mode 100644 index ee2000cabae..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ExtendedMessageBox.cpp /////////////////////////////////////////////////////////////////// -// Author: Matt Campbell, January 2003 -// Description: We go quiet in 1 day, gold in 15. Poor time to rewrite message boxes, so -// we get this file instead. Phooey. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/ExtendedMessageBox.h" - -WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ); - -//------------------------------------------------------------------------------------------------- -/** Create an extended Modal Message Box */ -//------------------------------------------------------------------------------------------------- -static GameWindow *gogoExMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, void *userData, - MessageBoxFunc yesCallback, - MessageBoxFunc noCallback, - MessageBoxFunc okCallback, - MessageBoxFunc cancelCallback ) -{ - // first check to make sure we have some buttons to display - if(buttonFlags == 0 ) - { - return nullptr; - } - - GameWindow *parent = TheWindowManager->winCreateFromScript( "Menus/MessageBox.wnd" ); - TheWindowManager->winSetModal( parent ); - TheWindowManager->winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves - TheWindowManager->winSetFocus( parent ); - - // If the user wants the size to be different then the default - float ratioX, ratioY = 1; - - if( width > 0 && height > 0 ) - { - ICoord2D temp; - //First grab the percent increase/decrease compared to the default size - parent->winGetSize( &temp.x, &temp.y); - ratioX = (float)width / (float)temp.x; - ratioY = (float)height / (float)temp.y; - //Set the window's new size - parent->winSetSize( width, height); - - //Resize/reposition all the children windows based off the ratio - GameWindow *child; - for( child = parent->winGetChild(); child; child = child->winGetNext() ) - { - child->winGetSize(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetSize(temp.x, temp.y); - - child->winGetPosition(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetPosition(temp.x, temp.y); - } - } - - // If the user wants to position the message box somewhere other then default - if( x >= 0 && y >= 0) - parent->winSetPosition(x, y); - - // Reposition the buttons - Int buttonX[3], buttonY[3]; - - //In the layout, buttonOk will be in the first button position - NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonOk" ); - GameWindow *buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); - buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); - - NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonYes" ); - GameWindow *buttonYes = TheWindowManager->winGetWindowFromId(parent, buttonYesID); - //buttonNo in the second position - NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonNo" ); - GameWindow *buttonNo = TheWindowManager->winGetWindowFromId(parent, buttonNoID); - buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); - - //and buttonCancel in the third - NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonCancel" ); - GameWindow *buttonCancel = TheWindowManager->winGetWindowFromId(parent, buttonCancelID); - buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); - - //we shouldn't have button OK and Yes on the same dialog - if((buttonFlags & (MSG_BOX_OK | MSG_BOX_YES)) == (MSG_BOX_OK | MSG_BOX_YES) ) - { - DEBUG_CRASH(("Passed in MSG_BOX_OK and MSG_BOX_YES. Big No No.")); - } - - //Position the OK button if we have one - if( (buttonFlags & MSG_BOX_OK) == MSG_BOX_OK) - { - buttonOk->winSetPosition(buttonX[0], buttonY[0]); - buttonOk->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_YES) == MSG_BOX_YES) - { - //Position the Yes if we have one - buttonYes->winSetPosition(buttonX[0], buttonY[0]); - buttonYes->winHide(FALSE); - } - - if((buttonFlags & (MSG_BOX_NO | MSG_BOX_CANCEL)) == (MSG_BOX_NO | MSG_BOX_CANCEL) ) - { - //If we have both the No and Cancel button, then the no should go in the middle position - buttonNo->winSetPosition(buttonX[1], buttonY[1]); - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - buttonCancel->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_NO) == MSG_BOX_NO) - { - //if we just have the no button, then position it in the right most spot - buttonNo->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_CANCEL) == MSG_BOX_CANCEL) - { - //else if we just have the Cancel button, well, it should always go in the right spot - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonCancel->winHide(FALSE); - } - - // Fill the text into the text boxes - NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:StaticTextTitle" ); - GameWindow *staticTextTitle = TheWindowManager->winGetWindowFromId(parent, staticTextTitleID); - GadgetStaticTextSetText(staticTextTitle,titleString); - - NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:StaticTextMessage" ); - GameWindow *staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); - GadgetStaticTextSetText(staticTextMessage,bodyString); - - // create a structure that will pass the functions to - WindowExMessageBoxData *MsgBoxCallbacks = NEW WindowExMessageBoxData; - MsgBoxCallbacks->cancelCallback = cancelCallback; - MsgBoxCallbacks->noCallback = noCallback; - MsgBoxCallbacks->okCallback = okCallback; - MsgBoxCallbacks->yesCallback = yesCallback; - MsgBoxCallbacks->userData = userData; - //pass the structure to the dialog - parent->winSetUserData( MsgBoxCallbacks ); - - parent->winSetSystemFunc(ExtendedMessageBoxSystem); - - //make sure the dialog is showing and bring it to the top - parent->winHide(FALSE); - parent->winBringToTop(); - - return parent; -} - -GameWindow *ExMessageBoxYesNo (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc yesCallback, MessageBoxFunc noCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, userData, yesCallback, noCallback, nullptr, nullptr); -} - -GameWindow *ExMessageBoxYesNoCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc yesCallback, MessageBoxFunc noCallback, MessageBoxFunc cancelCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, userData, yesCallback, noCallback, nullptr, cancelCallback); -} - -GameWindow *ExMessageBoxOkCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc okCallback, MessageBoxFunc cancelCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, userData, nullptr, nullptr, okCallback, cancelCallback); -} - -GameWindow *ExMessageBoxOk (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc okCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, userData, nullptr, nullptr, okCallback, nullptr); -} - -GameWindow *ExMessageBoxCancel (UnicodeString titleString,UnicodeString bodyString, void *userData, - MessageBoxFunc cancelCallback) -{ - return gogoExMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, userData, nullptr, nullptr, nullptr, cancelCallback); -} - - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - - - -//------------------------------------------------------------------------------------------------- -/** Message Box window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ExtendedMessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - delete (WindowExMessageBoxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - static NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonOk" ); - static NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonYes" ); - static NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonNo" ); - static NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonCancel" ); - WindowExMessageBoxData *MsgBoxCallbacks = (WindowExMessageBoxData *)window->winGetUserData(); - - MessageBoxReturnType ret = MB_RETURN_CLOSE; - - if( controlID == buttonOkID ) - { - if (MsgBoxCallbacks->okCallback) - ret = MsgBoxCallbacks->okCallback(MsgBoxCallbacks->userData); - } - else if( controlID == buttonYesID ) - { - if (MsgBoxCallbacks->yesCallback) - ret = MsgBoxCallbacks->yesCallback(MsgBoxCallbacks->userData); - } - else if( controlID == buttonNoID ) - { - if (MsgBoxCallbacks->noCallback) - ret = MsgBoxCallbacks->noCallback(MsgBoxCallbacks->userData); - } - else if( controlID == buttonCancelID ) - { - if (MsgBoxCallbacks->cancelCallback) - ret = MsgBoxCallbacks->cancelCallback(MsgBoxCallbacks->userData); - } - - if (ret == MB_RETURN_CLOSE) - TheWindowManager->winDestroy(window); - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp deleted file mode 100644 index 82518dd1b99..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +++ /dev/null @@ -1,265 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: MessageBox.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: MessageBox.cpp -// -// Created: Chris Huybregts, June 2001 -// -// Desc: the Message Box control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameEngine.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/Shell.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/MessageBox.h" - - -GameWindow *MessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr); -} -GameWindow *QuitMessageBoxYesNo(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc yesCallback,GameWinMsgBoxFunc noCallback) ///< convenience function for displaying a Message box with Yes and No buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES , titleString, bodyString, yesCallback, noCallback, nullptr, nullptr, TRUE); -} - - -GameWindow *MessageBoxYesNoCancel(UnicodeString titleString,UnicodeString bodyString, GameWinMsgBoxFunc yesCallback, GameWinMsgBoxFunc noCallback, GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Yes,No and Cancel buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_NO | MSG_BOX_YES | MSG_BOX_CANCEL , titleString, bodyString, yesCallback, noCallback, nullptr, cancelCallback); -} - - -GameWindow *MessageBoxOkCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Ok and Cancel buttons -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK | MSG_BOX_CANCEL , titleString, bodyString, nullptr, nullptr, okCallback, cancelCallback); -} - -GameWindow *MessageBoxOk(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc okCallback)///< convenience function for displaying a Message box with Ok button -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1,MSG_BOX_OK, titleString, bodyString, nullptr, nullptr, okCallback, nullptr); -} - - -GameWindow *MessageBoxCancel(UnicodeString titleString,UnicodeString bodyString,GameWinMsgBoxFunc cancelCallback)///< convenience function for displaying a Message box with Cancel button -{ - return TheWindowManager->gogoMessageBox(-1,-1,-1,-1, MSG_BOX_CANCEL, titleString, bodyString, nullptr, nullptr, nullptr, cancelCallback); -} - - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// - - - -//------------------------------------------------------------------------------------------------- -/** Message Box window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType MessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - static NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonOk" ); - static NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonYes" ); - static NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonNo" ); - static NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "MessageBox.wnd:ButtonCancel" ); - WindowMessageBoxData *MsgBoxCallbacks = (WindowMessageBoxData *)window->winGetUserData(); - - if( controlID == buttonOkID ) - { - //simple enough,if we have a callback, call it, if not, then just destroy the window - if (MsgBoxCallbacks->okCallback) - MsgBoxCallbacks->okCallback(); - - TheWindowManager->winDestroy(window); - - } - else if( controlID == buttonYesID ) - { - if (MsgBoxCallbacks->yesCallback) - MsgBoxCallbacks->yesCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonNoID ) - { - if (MsgBoxCallbacks->noCallback) - MsgBoxCallbacks->noCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonCancelID ) - { - if (MsgBoxCallbacks->cancelCallback) - MsgBoxCallbacks->cancelCallback(); - TheWindowManager->winDestroy(window); - } - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} -//------------------------------------------------------------------------------------------------- -/** Message Box window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType QuitMessageBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - - switch( msg ) - { - - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - delete (WindowMessageBoxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - break; - - } - - // -------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - static NameKeyType buttonOkID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonOk" ); - static NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonYes" ); - static NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonNo" ); - static NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( "QuitMessageBox.wnd:ButtonCancel" ); - WindowMessageBoxData *MsgBoxCallbacks = (WindowMessageBoxData *)window->winGetUserData(); - - if( controlID == buttonOkID ) - { - //simple enough,if we have a callback, call it, if not, then just destroy the window - if (MsgBoxCallbacks->okCallback) - MsgBoxCallbacks->okCallback(); - - TheWindowManager->winDestroy(window); - - } - else if( controlID == buttonYesID ) - { - if (MsgBoxCallbacks->yesCallback) - MsgBoxCallbacks->yesCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonNoID ) - { - if (MsgBoxCallbacks->noCallback) - MsgBoxCallbacks->noCallback(); - TheWindowManager->winDestroy(window); - } - else if( controlID == buttonCancelID ) - { - if (MsgBoxCallbacks->cancelCallback) - MsgBoxCallbacks->cancelCallback(); - TheWindowManager->winDestroy(window); - } - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp deleted file mode 100644 index d3d2afadcdc..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GameWindowManager.cpp +++ /dev/null @@ -1,4064 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GameWindowManager.cpp //////////////////////////////////////////////////////////////////// -// Created: Colin Day, June 2001 -// Dean Iverson, March 1998 (Original window code) -// Desc: The game window manager is the singleton class that we interface -// with to interact with the game windowing system. -/////////////////////////////////////////////////////////////////////////////////////////////////// - -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/Debug.h" -#include "Common/Language.h" -#include "GameClient/Display.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Mouse.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetTabControl.h" -#include "GameClient/GadgetProgressBar.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GadgetRadioButton.h" -#include "GameClient/GadgetCheckBox.h" -#include "GameClient/GlobalLanguage.h" -#include "GameClient/GameWindowTransitions.h" -#include "Common/NameKeyGenerator.h" - -// PUBLIC DATA //////////////////////////////////////////////////////////////////////////////////// -GameWindowManager *TheWindowManager = nullptr; -UnsignedInt WindowLayoutCurrentVersion = 2; - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// -// with this status set to true, the window system will propagate mouse position -// messages to windows. You may want to disable this if you feel the mouse position -// messages are "spamming" your window and making a particular debugging situation -// difficult. Make sure you do enable this before you check in again tho because -// it is necessary for any code that needs to look at objects or anything under -// the radar cursor -// -static Bool sendMousePosMessages = TRUE; - -//------------------------------------------------------------------------------------------------- -/** Process windows waiting to be destroyed */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::processDestroyList() -{ - GameWindow *next; - GameWindow *doDestroy; - - // - // we need to pass the ownership of the destroy list so - // if, while destroying a window, we need to add other windows - // to the destroy list it won't cause problems. - // - doDestroy = m_destroyList; - - // set the list to empty - m_destroyList = nullptr; - - // do the destroys - for( ; doDestroy; doDestroy = next ) - { - - next = doDestroy->m_next; - - // Check to see if this window is "special" - if( m_mouseCaptor == doDestroy ) - winRelease( doDestroy ); - - if( m_keyboardFocus == doDestroy ) - winSetFocus( nullptr ); - - if( (m_modalHead != nullptr) && (doDestroy == m_modalHead->window) ) - winUnsetModal( m_modalHead->window ); - - if( m_currMouseRgn == doDestroy ) - m_currMouseRgn = nullptr; - - if( m_grabWindow == doDestroy ) - m_grabWindow = nullptr; - - // send the destroy message to the window we're about to kill - winSendSystemMsg( doDestroy, GWM_DESTROY, 0, 0 ); - - DEBUG_ASSERTCRASH(doDestroy->winGetUserData() == nullptr, ("Win user data is expected to be deleted now")); - - // free the memory - deleteInstance(doDestroy); - - } - -} - -/////////////////////////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -/** Generic function to simply propagate only button press messages to parent and let it deal with it */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PassSelectedButtonsToParentSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - // sanity - if( window == nullptr ) - return MSG_IGNORED; - - if( (msg == GBM_SELECTED) || (msg == GBM_SELECTED_RIGHT) || (msg == GBM_MOUSE_ENTERING) || (msg == GBM_MOUSE_LEAVING) || (msg == GEM_EDIT_DONE)) - { - GameWindow *parent = window->winGetParent(); - - if( parent ) - return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** Generic function to simply propagate only button press messages to parent and let it deal with it */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PassMessagesToParentSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - // sanity - if( window == nullptr ) - return MSG_IGNORED; - - - GameWindow *parent = window->winGetParent(); - - if( parent ) - return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - - return MSG_IGNORED; - -} - - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -GameWindowManager::GameWindowManager() -{ - - m_windowList = nullptr; // list of all top level windows - m_windowTail = nullptr; // last in windowList - - m_destroyList = nullptr; // list of windows to destroy - - m_currMouseRgn = nullptr; // window that mouse is over - m_mouseCaptor = nullptr; // window that captured mouse - m_keyboardFocus = nullptr; // window that has input focus - m_modalHead = nullptr; // top of windows in the modal stack - m_grabWindow = nullptr; // window that grabbed the last down event - m_loneWindow = nullptr; // Set if we just opened a combo box - - m_cursorBitmap = nullptr; - m_captureFlags = 0; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -GameWindowManager::~GameWindowManager() -{ - - // destroy all windows - winDestroyAll(); - freeStaticStrings(); - - delete TheTransitionHandler; - TheTransitionHandler = nullptr; -} - -//------------------------------------------------------------------------------------------------- -/** Initialize the game window manager system */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::init() -{ - if(!TheTransitionHandler) - TheTransitionHandler = NEW GameWindowTransitionsHandler; - TheTransitionHandler->load(); - TheTransitionHandler->init(); -} - -//------------------------------------------------------------------------------------------------- -/** Reset window system */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::reset() -{ - - // destroy all windows left - winDestroyAll(); - if(TheTransitionHandler) - TheTransitionHandler->reset(); - -} - -//------------------------------------------------------------------------------------------------- -/** Update cycle for game window manager */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::update() -{ - - // Process windows waiting to be destroyed - processDestroyList(); - if(TheTransitionHandler) - TheTransitionHandler->update(); -} - -//------------------------------------------------------------------------------------------------- -/** Puts a window at the head of the window list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::linkWindow( GameWindow *window ) -{ - GameWindow *lastModalWindow = nullptr; - GameWindow *tmp = m_windowList; - while (tmp) - { - const ModalWindow *modal = m_modalHead; - while (modal) - { - if (modal->window == tmp && modal->window != window) - { - lastModalWindow = tmp; - } - modal = modal->next; - } - tmp = tmp->m_next; - } - - if (!lastModalWindow) - { - - // Add to head of the top level window list - window->m_prev = nullptr; - window->m_next = m_windowList; - - if( m_windowList ) - m_windowList->m_prev = window; - else - { - // first on list is also the tail - m_windowTail = window; - } - - m_windowList = window; - } - else - { - // lastModalWindow points to a modal window - add behind it - window->m_prev = lastModalWindow; - window->m_next = lastModalWindow->m_next; - lastModalWindow->m_next = window; - if (window->m_next) - { - window->m_next->m_prev = window; - } - } - -} - -//------------------------------------------------------------------------------------------------- -/** Insert the window ahead of the the 'aheadOf' window. 'aheadOf' can - * be a window in the master list or a child of any window in that master - * list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::insertWindowAheadOf( GameWindow *window, - GameWindow *aheadOf ) -{ - - // sanity - if( window == nullptr ) - return; - - // we'll say that an aheadOf window means at the head of the list - if( aheadOf == nullptr ) - { - - linkWindow( window ); - return; - - } - - // get parent of aheadOf - GameWindow *aheadOfParent = aheadOf->winGetParent(); - - // - // if ahead of has no parent insert it in the master list just before - // ahead of - // - if( aheadOfParent == nullptr ) - { - - window->m_prev = aheadOf->m_prev; - - if( aheadOf->m_prev ) - aheadOf->m_prev->m_next = window; - else - m_windowList = window; - - aheadOf->m_prev = window; - window->m_next = aheadOf; - - } - else - { - - window->m_prev = aheadOf->m_prev; - - if( aheadOf->m_prev ) - aheadOf->m_prev->m_next = window; - else - aheadOfParent->m_child = window; - - aheadOf->m_prev = window; - window->m_next = aheadOf; - - window->m_parent = aheadOfParent; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Takes a window off the window list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::unlinkWindow( GameWindow *window ) -{ - - if( window->m_next ) - window->m_next->m_prev = window->m_prev; - else - { - // no next means this is the tail - m_windowTail = window->m_prev; - } - - if( window->m_prev ) - window->m_prev->m_next = window->m_next; - else - m_windowList = window->m_next; - -} - -//------------------------------------------------------------------------------------------------- -/** Takes a child window off its parent's window list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::unlinkChildWindow( GameWindow *window ) -{ - - if( window->m_prev ) - { - - window->m_prev->m_next = window->m_next; - - if( window->m_next ) - window->m_next->m_prev = window->m_prev; - - } - else - { - - if( window->m_next ) - { - - window->m_parent->m_child = window->m_next; - - window->m_next->m_prev = window->m_prev; - - window->m_next = nullptr; - - } - else - { - - window->m_parent->m_child = nullptr; - - } - - } - - // remove the parent reference from this window - window->m_parent = nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** Check window and parents to see if this window is enabled */ -//------------------------------------------------------------------------------------------------- -Bool GameWindowManager::isEnabled( GameWindow *win ) -{ - - // sanity - if( win == nullptr ) - return FALSE; - - if( BitIsSet( win->m_status, WIN_STATUS_ENABLED ) == FALSE ) - { - return FALSE; - } - - while( win->m_parent ) - { - win = win->m_parent; - if( BitIsSet( win->m_status, WIN_STATUS_ENABLED ) == FALSE ) - { - return FALSE; - } - } - - return TRUE; - -} - -//------------------------------------------------------------------------------------------------- -/** Check window and parents to see if this window is hidden */ -//------------------------------------------------------------------------------------------------- -Bool GameWindowManager::isHidden( GameWindow *win ) -{ - - // we'll allow for the idea that if a window doesn't exist it is hidden - if( win == nullptr ) - return TRUE; - - if( BitIsSet( win->m_status, WIN_STATUS_HIDDEN )) - { - return TRUE; - } - - while( win->m_parent ) - { - win = win->m_parent; - if( BitIsSet( win->m_status, WIN_STATUS_HIDDEN )) - { - return TRUE; - } - } - - return FALSE; - -} - -//------------------------------------------------------------------------------------------------- -// Adds a child window to its parent. -//------------------------------------------------------------------------------------------------- -void GameWindowManager::addWindowToParent( GameWindow *window, - GameWindow *parent ) -{ - if( parent ) - { - - // add to parent's list of children - window->m_prev = nullptr; - window->m_next = parent->m_child; - - if( parent->m_child ) - parent->m_child->m_prev = window; - - parent->m_child = window; - - window->m_parent = parent; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Add a child window to the parent, put place it at the end of the - * parent window child list */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::addWindowToParentAtEnd( GameWindow *window, - GameWindow *parent ) -{ - - if( parent ) - { - - window->m_prev = nullptr; - window->m_next = nullptr; - if( parent->m_child ) - { - GameWindow *last; - - // wind down to last child in list - last = parent->m_child; - while( last->m_next != nullptr ) - last = last->m_next; - - // tie to list - last->m_next = window; - window->m_prev = last; - - } - else - parent->m_child = window; - - // assign the parent to the window - window->m_parent = parent; - - } - -} - -//------------------------------------------------------------------------------------------------- -/** this gets called from winHide() when a window hides itself */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::windowHiding( GameWindow *window ) -{ - - // if this window has keyboard focus remove it - if( m_keyboardFocus == window ) - m_keyboardFocus = nullptr; - - // if this is the modal head, unset it - if( m_modalHead && m_modalHead->window == window ) - winUnsetModal( window ); - - // if this is the captor, it shall no longer be - if( m_mouseCaptor == window ) - winCapture( nullptr ); - - // - // since hiding a parent will also hide the children, when a parent - // hides we must call this same method for all the children so they - // each have a chance to go through this logic - // - GameWindow *child; - for( child = window->winGetChild(); child; child = child->winGetNext() ) - windowHiding( child ); - -} - -//------------------------------------------------------------------------------------------------- -/** Hide all windows in a certain range of id's (inclusive) */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::hideWindowsInRange( GameWindow *baseWindow, - Int first, Int last, - Bool hideFlag ) -{ - Int i; - GameWindow *window; - - for( i = first; i <= last; i++ ) - { - - window = winGetWindowFromId( baseWindow, i ); - if( window ) - window->winHide( hideFlag ); - - } - -} - -//------------------------------------------------------------------------------------------------- -// Enable all windows in a certain range of id's (inclusive) -//------------------------------------------------------------------------------------------------- -void GameWindowManager::enableWindowsInRange( GameWindow *baseWindow, - Int first, Int last, - Bool enableFlag ) -{ - Int i; - GameWindow *window; - - for( i =first; i <= last; i++ ) - { - - window = winGetWindowFromId( baseWindow, i ); - if( window ) - window->winEnable( enableFlag ); - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Captures the mouse capture. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winCapture( GameWindow *window ) -{ - - if( m_mouseCaptor != nullptr) - return WIN_ERR_MOUSE_CAPTURED; - - m_mouseCaptor = window; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Releases the mouse capture. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winRelease( GameWindow *window ) -{ - - if( window == m_mouseCaptor ) - m_mouseCaptor = nullptr; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Returns the current mouse captor. */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetCapture() -{ - - return m_mouseCaptor; - -} - -//------------------------------------------------------------------------------------------------- -/** Gets the window pointer from its id */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetWindowFromId( GameWindow *window, Int id ) -{ - - if( window == nullptr ) - window = m_windowList; - - for( ; window; window = window->m_next ) - { - - if( window->winGetWindowId() == id) - return window; - else if( window->m_child ) - { - GameWindow *child = winGetWindowFromId( window->m_child, id ); - - if( child ) - return child; - - } - - } - - return nullptr; - -} - -//------------------------------------------------------------------------------------------------- -/** Gets the Window List Pointer */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetWindowList() -{ - - return m_windowList; - -} - -//------------------------------------------------------------------------------------------------- -/** Send a system message to the specified window */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType GameWindowManager::winSendSystemMsg( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ) -{ - - if( window == nullptr) - return MSG_IGNORED; - - if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) - return MSG_IGNORED; - - return window->m_system( window, msg, mData1, mData2 ); - -} - -//------------------------------------------------------------------------------------------------- -/** Send a system message to the specified window */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType GameWindowManager::winSendInputMsg( GameWindow *window, - UnsignedInt msg, - WindowMsgData mData1, - WindowMsgData mData2 ) -{ - - if( window == nullptr ) - return MSG_IGNORED; - - if( msg != GWM_DESTROY && BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) - return MSG_IGNORED; - - return window->m_input( window, msg, mData1, mData2 ); - -} - -//------------------------------------------------------------------------------------------------- -/** Get the current input focus */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetFocus() -{ - - return m_keyboardFocus; - -} - -//------------------------------------------------------------------------------------------------- -/** Set the current input focus */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winSetFocus( GameWindow *window ) -{ - Bool wantsFocus = FALSE; - - // if a window doesn't want keyboard focus don't give it - if( window ) - if( BitIsSet( window->winGetStatus(), WIN_STATUS_NO_FOCUS) ) - return 0; - - // - // Tell current focus window that it's losing focus - // unless we are trying to give focus to the current focus window - // - if( (m_keyboardFocus) && (m_keyboardFocus != window) ) - { - Bool wf; // dummy var, ignored, but must be passed - winSendSystemMsg( m_keyboardFocus, GWM_INPUT_FOCUS, FALSE, (WindowMsgData)&wf ); - } - - // Set focus to new window - m_keyboardFocus = window; - - // Tell new focus window that it has focus - if( m_keyboardFocus ) - { - - for (;;) - { - winSendSystemMsg( window, GWM_INPUT_FOCUS, TRUE, (WindowMsgData)&wantsFocus ); - if (wantsFocus) - break; - - window = window->winGetParent(); - if( window == nullptr ) - break; - } - - } - - // If new window doesn't want focus, set focus to nullptr - if( wantsFocus == FALSE ) - m_keyboardFocus = nullptr; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Process key press through the GUI. */ -//------------------------------------------------------------------------------------------------- -WinInputReturnCode GameWindowManager::winProcessKey( UnsignedByte key, - UnsignedByte state ) -{ - WinInputReturnCode returnCode = WIN_INPUT_NOT_USED; - - // Check for keyboard focus and a legal key for sanity - if( m_keyboardFocus && (key != KEY_NONE) ) - { - GameWindow *win = m_keyboardFocus; - - returnCode = WIN_INPUT_USED; // assume input will be used - - // - // Pass the keystroke up the window hierarchy until it is - // processed or we reach the top level window - // - while( winSendInputMsg( win, GWM_CHAR, key, state ) == MSG_IGNORED ) - { - - win = win->winGetParent(); - if( win == nullptr ) - { - - returnCode = WIN_INPUT_NOT_USED; // oops, it wasn't used after all - break; - - } - - } - - } - - return returnCode; - -} - -//------------------------------------------------------------------------------------------------- -/** Process a single mouse event through the window system */ -//------------------------------------------------------------------------------------------------- -WinInputReturnCode GameWindowManager::winProcessMouseEvent( GameWindowMessage msg, - ICoord2D *mousePos, - void *data ) -{ - WinInputReturnCode returnCode = WIN_INPUT_NOT_USED; - Bool objectTooltip = FALSE; - UnsignedInt packedMouseCoords; - GameWindow *window = nullptr; - GameWindow *toolTipWindow = nullptr; - Int dx, dy; - Bool clearGrabWindow = FALSE; - - // pack mouse coords into one entity for message passing - packedMouseCoords = SHORTTOLONG( mousePos->x, mousePos->y ); - - // clear tooltip ... it will be reset if necessary - TheMouse->setCursorTooltip( UnicodeString::TheEmptyString ); - - // Check for mouse capture - if( m_mouseCaptor ) - { - - // no window grabbed as of yet - m_grabWindow = nullptr; - - // what what window within the captured window are we in - window = m_mouseCaptor->winPointInChild( mousePos->x, mousePos->y ); - - // - // send buttons, drags, wheels to the windows, we don't continually - // send mouse positions - // - if( sendMousePosMessages == TRUE || msg != GWM_MOUSE_POS ) - { - GameWindow *win = window; - - if( win ) - { - while( win != nullptr ) - { - - if( winSendInputMsg( win, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) - { - - // if used clear the event - returnCode = WIN_INPUT_USED; - break; - - } - - // if we just tested mouseCaptor don't go any higher in the chain - if( win == m_mouseCaptor ) - break; - - win = win->winGetParent(); - - } - - } - else - { - - // if used clear the event - if( winSendInputMsg( m_mouseCaptor, msg, packedMouseCoords, 0 ) == MSG_HANDLED ) - returnCode = WIN_INPUT_USED; - - } - - } - - } - else - { - - if( m_grabWindow ) - { - GameWindow *parent; - - switch( msg ) - { - - // -------------------------------------------------------------------- - case GWM_LEFT_UP: - { - //Play a beep sound if the window is disabled. - m_grabWindow->winPointInChild( mousePos->x, mousePos->y, FALSE, TRUE ); - - BitClear( m_grabWindow->m_status, WIN_STATUS_ACTIVE ); - if( m_grabWindow->winPointInWindow( mousePos->x, mousePos->y ) ) - winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); - else if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE )) - { - winSendInputMsg( m_grabWindow, GWM_LEFT_UP, packedMouseCoords, 0 ); - } - - clearGrabWindow = TRUE; - break; - - } - - // -------------------------------------------------------------------- - case MOUSE_EVENT_NONE: - case GWM_LEFT_DRAG: - { - - if( BitIsSet( m_grabWindow->m_status, WIN_STATUS_DRAGGABLE ) ) - { - ICoord2D *mouseDelta = (ICoord2D *)data; - dx = mouseDelta->x; - dy = mouseDelta->y; - - // Clip window to parent - if( m_grabWindow->winGetParent() ) - { - - parent = m_grabWindow->winGetParent(); - - if( m_grabWindow->m_region.lo.x + dx < 0 ) - dx = 0 - m_grabWindow->m_region.lo.x; - else if( m_grabWindow->m_region.hi.x + dx > parent->m_size.x ) - dx = parent->m_size.x - m_grabWindow->m_region.hi.x; - - if( m_grabWindow->m_region.lo.y + dy < 0 ) - dy = 0 - m_grabWindow->m_region.lo.y; - else if( m_grabWindow->m_region.hi.y + dy > parent->m_size.y ) - dy = parent->m_size.y - m_grabWindow->m_region.hi.y; - } - - // Move the window, but keep it completely visible within screen boundaries - IRegion2D newRegion; - ICoord2D grabSize; - - m_grabWindow->winGetPosition( &newRegion.lo.x, &newRegion.lo.y ); - m_grabWindow->winGetSize( &grabSize.x, &grabSize.y ); - - newRegion.lo.x += dx; - newRegion.lo.y += dy; - if( newRegion.lo.x < 0 ) - newRegion.lo.x = 0; - if( newRegion.lo.y < 0 ) - newRegion.lo.y = 0; - - newRegion.hi.x = newRegion.lo.x + grabSize.x; - newRegion.hi.y = newRegion.lo.y + grabSize.y; - if( newRegion.hi.x > (Int)TheDisplay->getWidth() ) - newRegion.hi.x = (Int)TheDisplay->getWidth(); - if( newRegion.hi.y > (Int)TheDisplay->getHeight() ) - newRegion.hi.y = (Int)TheDisplay->getHeight(); - - newRegion.lo.x = newRegion.hi.x - grabSize.x; - newRegion.lo.y = newRegion.hi.y - grabSize.y; - - m_grabWindow->winSetPosition( newRegion.lo.x, newRegion.lo.y ); - - } - - // Send mouse drag message - winSendInputMsg( m_grabWindow, msg, packedMouseCoords, 0 ); - break; - - } - - } - - // mark event handled - returnCode = WIN_INPUT_USED; - - } - else - { - - if( m_modalHead && m_modalHead->window ) - { - window = m_modalHead->window->winPointInChild( mousePos->x, mousePos->y ); - } - else - { - // search for top-level window which contains pointer - window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_ABOVE, WIN_STATUS_HIDDEN); - - // check !above, below and hidden - if( window == nullptr ) - window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_NONE, WIN_STATUS_ABOVE | WIN_STATUS_BELOW | WIN_STATUS_HIDDEN); - - // check below and !hidden - if( window == nullptr ) - window = findWindowUnderMouse(toolTipWindow, mousePos, WIN_STATUS_BELOW, WIN_STATUS_HIDDEN); - } - - if( window ) - if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT ) ) - { - if(window->winGetParent() && BitIsSet( window->winGetParent()->winGetInstanceData()->getStyle(), GWS_COMBO_BOX )) - window = window->winGetParent(); - else - window = nullptr; - } - - if( window ) - { - GameWindow *tempWin; - - // - // only send messages for button states, wheel states, we do not - // continually send messages for mouse positions - // - if( sendMousePosMessages == TRUE || msg != GWM_MOUSE_POS ) - { - - tempWin = window; - - // Give everyone a chance to do something with the clicks - GameWindow *oldLoneWindow = m_loneWindow; - while( winSendInputMsg( tempWin, msg, packedMouseCoords, 0 ) == MSG_IGNORED ) - { - - tempWin = tempWin->m_parent; - if( tempWin == nullptr ) - break; - - } - - - // First check to see if m_loneWindow is set if so, close the window - if( m_loneWindow && m_loneWindow == oldLoneWindow - &&( msg == GWM_LEFT_UP || msg == GWM_MIDDLE_UP || msg == GWM_RIGHT_UP || tempWin)) - { - if(!m_loneWindow->winIsChild(tempWin)) - winSetLoneWindow( nullptr ); - /* - ComboBoxData *cData = (ComboBoxData *)m_comboBoxOpen->winGetUserData(); - // verify that the window that ate the message wasn't one of our own - if(cData->dropDownButton != tempWin && - cData->editBox != tempWin && - cData->listBox != tempWin && - cData->listboxData->upButton != tempWin && - cData->listboxData->downButton != tempWin && - cData->listboxData->slider != tempWin && - cData->listboxData->slider != tempWin->winGetParent()) - winSetOpenComboBoxWindow( nullptr );*/ - - } - if( tempWin ) - { - - // - // Someone cares, if this is a left button down event - // it should get "grabbed" - /// @todo should allow for left handed mouse configs here? - // - if( msg == GWM_LEFT_DOWN ) - { - -// if( tempWin != windowList ) -// WinActivate( tempWin ); - m_grabWindow = tempWin; - - } - - // event is used - returnCode = WIN_INPUT_USED; - - } - - } - - } - - if( toolTipWindow == nullptr ) - { - - if( isHidden( window ) == FALSE ) - toolTipWindow = window; - - } - - // if tooltips are on set them into the window - Bool tooltipsOn = TRUE; - if( tooltipsOn ) - { -// if( toolTipWindow && toolTipWindow->winGetParent() && BitIsSet( toolTipWindow->winGetParent()->winGetInstanceData()->getStyle(), GWS_COMBO_BOX )) -// toolTipWindow = toolTipWindow->winGetParent(); - if( toolTipWindow ) - { - // do we have a callback to call for the tooltip - if( toolTipWindow->m_tooltip ) - toolTipWindow->m_tooltip( toolTipWindow, - &toolTipWindow->m_instData, - packedMouseCoords ); - - // else, do we have a normal tooltip to set - else if( toolTipWindow->m_instData.getTooltipTextLength() ) - TheMouse->setCursorTooltip( toolTipWindow->m_instData.getTooltipText(), toolTipWindow->m_instData.m_tooltipDelay ); - - } - else - { - - // - // not pointing at a window... perhaps we are pointing at a valid - // tooltip-able object in the game world ... let's set a flag so - // during the object testing we can set the tooltip, we can do - // whatever we like now that we know no other tooltip was set from - // a window - // - objectTooltip = TRUE; - - } - - } - - } - - } - - // - // check if new current window is different from the last - // but only if both windows fall within the mouseCaptor if one exists - // - if( (m_grabWindow == nullptr) && (window != m_currMouseRgn) ) - { - if( m_mouseCaptor ) - { - if( m_mouseCaptor->winIsChild( m_currMouseRgn ) ) - winSendInputMsg( m_currMouseRgn, GWM_MOUSE_LEAVING, packedMouseCoords, 0 ); - } - else if( m_currMouseRgn ) - winSendInputMsg( m_currMouseRgn, GWM_MOUSE_LEAVING, packedMouseCoords, 0 ); - - if( window ) - winSendInputMsg( window, GWM_MOUSE_ENTERING, packedMouseCoords, 0 ); - - m_currMouseRgn = window; - - } - - // clear grabWindow if necessary - if( clearGrabWindow == TRUE ) - { - - m_grabWindow = nullptr; - clearGrabWindow = FALSE; - - } - - return returnCode; - -} - -bool GameWindowManager::isMouseWithinWindow(GameWindow* window, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) -{ - return ((BitIsSet(window->m_status, requiredStatusMask) || requiredStatusMask == 0) && - !BitIsSet(window->m_status, forbiddenStatusMask) && - mousePos->x >= window->m_region.lo.x && - mousePos->x <= window->m_region.hi.x && - mousePos->y >= window->m_region.lo.y && - mousePos->y <= window->m_region.hi.y); -} - -GameWindow* GameWindowManager::findWindowUnderMouse(GameWindow*& toolTipWindow, const ICoord2D* mousePos, unsigned int requiredStatusMask, unsigned int forbiddenStatusMask) -{ - for (GameWindow* window = m_windowList; window; window = window->m_next) - { - if (!isMouseWithinWindow(window, mousePos, requiredStatusMask, forbiddenStatusMask)) - continue; - - if (toolTipWindow == nullptr) - { - GameWindow* childWindow = window->winPointInAnyChild(mousePos->x, mousePos->y, TRUE, TRUE); - - if (childWindow->m_tooltip || childWindow->m_instData.getTooltipTextLength()) - toolTipWindow = childWindow; - } - - if (BitIsSet(window->m_status, WIN_STATUS_ENABLED)) - { - // determine which child window the mouse is in - return window->winPointInChild(mousePos->x, mousePos->y); - } - } - - return nullptr; -} - -//------------------------------------------------------------------------------------------------- -/** Draw a window and its children, in parent-first order. - * Children's coordinates are relative to their parents. - * Note that hidden windows automatically will not draw any - * of their children ... but see-thru windows only will not - * draw themselves, but will give their children an - * opportunity to draw */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::drawWindow( GameWindow *window ) -{ - GameWindow *child; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - if( BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) == FALSE ) - { - - if( !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) && window->m_draw ) - window->m_draw( window, &window->m_instData ); - - /// @todo visit list boxes and borders, this is stupid! - // for list boxes only draw the borders BEFORE the children - if( BitIsSet( window->winGetStyle(), GWS_SCROLL_LISTBOX ) ) - if( BitIsSet( window->m_status, WIN_STATUS_BORDER ) == TRUE && - !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) ) - window->winDrawBorder(); - - // draw children in reverse order just like the window list - child = window->m_child; - while( child && child->m_next ) - child = child->m_next; - - for( ; child; child = child->m_prev ) - drawWindow( child ); - - // - // draw the border for the window AFTER the window contents AND the - // children contents have drawn - // - if( !BitIsSet( window->winGetStyle(), GWS_SCROLL_LISTBOX ) ) - if( BitIsSet( window->m_status, WIN_STATUS_BORDER ) == TRUE && - !BitIsSet( window->m_status, WIN_STATUS_SEE_THRU ) ) - window->winDrawBorder(); - - } - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Draw the GUI in reverse order to correlate with clicking priority */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::winRepaint() -{ - GameWindow *window, *next; - - // draw below windows - for( window = m_windowTail; window; window = next ) - { - next = window->m_prev; - - if( BitIsSet( window->m_status, WIN_STATUS_BELOW ) ) - drawWindow( window ); - } - - // draw non-above and non-below windows - for( window = m_windowTail; window; window = next ) - { - next = window->m_prev; - - if (BitIsSet( window->m_status, WIN_STATUS_ABOVE | - WIN_STATUS_BELOW ) == FALSE) - drawWindow( window ); - } - - // draw above windows - for( window = m_windowTail; window; window = next ) - { - next = window->m_prev; - - if( BitIsSet( window->m_status, WIN_STATUS_ABOVE ) ) - drawWindow( window ); - } - - if(TheTransitionHandler) - TheTransitionHandler->draw(); -} - -//------------------------------------------------------------------------------------------------- -/** Dump information about all the windows for resource problems */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::dumpWindow( GameWindow *window ) -{ -#ifndef FINAL - GameWindow *child; - - if( window == nullptr ) - return; - - DEBUG_LOG(( "ID: %d\tRedraw: 0x%08X\tUser Data: %d", - window->winGetWindowId(), window->m_draw, window->m_userData )); - - for( child = window->m_child; child; child = child->m_next ) - dumpWindow( child ); - - return; -#endif -} - -//------------------------------------------------------------------------------------------------- -/** Create a new window by setting up its parameters and callbacks. */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winCreate( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - GameWinSystemFunc system, - WinInstanceData *instData ) -{ - GameWindow *window; - - // allocate new window - window = allocateNewWindow(); - if( window == nullptr ) - { - - DEBUG_LOG(( "WinCreate error: Could not allocate new window" )); -#ifndef FINAL - { - GameWindow *win; - - for( win = m_windowList; win; win = win->m_next ) - dumpWindow( win ); - } -#endif - - return nullptr; - - } - - // If this is a child window add it to the parent's window list - if( parent ) - addWindowToParent( window, parent ); - else - linkWindow( window ); - - window->m_status = status; - window->m_size.x = width; - window->m_size.y = height; - - window->m_region.lo.x = x; - window->m_region.lo.y = y; - window->m_region.hi.x = x + width; - window->m_region.hi.y = y + height; - - window->normalizeWindowRegion(); - - // set the system function and send a create message to window - window->winSetSystemFunc( system ); - winSendSystemMsg( window, GWM_CREATE, 0, 0 ); - - // copy over instance data if present - if( instData ) - window->winSetInstanceData( instData ); - - // set default font - if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultWindowFont.name.isNotEmpty()) - { window->winSetFont( winFindFont( - TheGlobalLanguageData->m_defaultWindowFont.name, - TheGlobalLanguageData->m_defaultWindowFont.size, - TheGlobalLanguageData->m_defaultWindowFont.bold) ); - } - else - window->winSetFont( winFindFont( "Times New Roman", 14, FALSE ) ); - - return window; - -} - -//------------------------------------------------------------------------------------------------- -/** Take a window and its children off the top level list and free - * their allocation class data. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winDestroy( GameWindow *window ) -{ - GameWindow *child, *next; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - // - // we should never have edit data allocated in the window code, it's - // completely handled by the editor ONLY - // - DEBUG_ASSERTCRASH( window->winGetEditData() == nullptr, - ("winDestroy(): edit data should NOT be present!") ); - - if( BitIsSet( window->m_status, WIN_STATUS_DESTROYED ) ) - return WIN_ERR_OK; - - BitSet( window->m_status, WIN_STATUS_DESTROYED ); - window->freeImages(); - - if( m_mouseCaptor == window ) - winRelease( window ); - - if( m_keyboardFocus == window ) - winSetFocus( nullptr ); - - if( (m_modalHead != nullptr) && (window == m_modalHead->window) ) - winUnsetModal( m_modalHead->window ); - - if( m_currMouseRgn == window ) - m_currMouseRgn = nullptr; - - if( m_grabWindow == window ) - m_grabWindow = nullptr; - - for( child = window->m_child; child; child = next ) - { - next = child->m_next; - winDestroy( child ); - } - - // Remove the top level window from list - if( window->m_parent == nullptr ) - unlinkWindow( window ); - else - unlinkChildWindow( window ); - - // Add to head of the destroy list - window->m_prev = nullptr; - window->m_next = m_destroyList; - - m_destroyList = window; - - // - // if this window is part of a layout screen, notify the screen that - // this window is going away - // - if( window->m_layout ) - window->m_layout->removeWindow( window ); - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Destroy all windows on the window list IMMEDIATELY */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winDestroyAll() -{ - GameWindow *win, *next; - - // - // NOTE that it is CRITICAL that the windows be destroyed this way, - // the editor has windows that are not on this main list that must - // exist throughout a reset of the system (copy/paste for instance) - // so DO NOT ever change this to a clever pool of memory for the - // windows and reset the _pool_ ... I will have to kill you! CBD - // - - for( next = win = m_windowList; next; win = next) - { - next = win->m_next; - - winDestroy( win ); - - } - - // Destroy All Windows just added to destroy list - processDestroyList(); - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Sets selected window into a modal state. This window will get - * put at the top of a modal stack */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winSetModal( GameWindow *window ) -{ - ModalWindow *modal; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - // verify requesting window is a root window - if( window->m_parent != nullptr ) - { - DEBUG_LOG(( "WinSetModal: Non Root window attempted to go modal." )); - return WIN_ERR_INVALID_PARAMETER; // return error if not - } - // Allocate new Modal Window Entry - modal = newInstance(ModalWindow); - if( modal == nullptr ) - { - DEBUG_LOG(( "WinSetModal: Unable to allocate space for Modal Entry." )); - return WIN_ERR_GENERAL_FAILURE; - } - - // Put new entry at top of list - modal->window = window; - modal->next = m_modalHead; - m_modalHead = modal; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** pops window off of the modal stack. If this window is not the top - * of the modal stack an error will occur. */ -//------------------------------------------------------------------------------------------------- -Int GameWindowManager::winUnsetModal( GameWindow *window ) -{ - ModalWindow *next; - - if( window == nullptr ) - return WIN_ERR_INVALID_WINDOW; - - // verify entry is at top of list - if( (m_modalHead == nullptr) || (m_modalHead->window != window) ) - { - - // return error if not - DEBUG_LOG(( "WinUnsetModal: Invalid window attempting to unset modal (%d)", - window->winGetWindowId() )); - return WIN_ERR_GENERAL_FAILURE; - - } - - // remove from top of list - next = m_modalHead->next; - deleteInstance(m_modalHead); - m_modalHead = next; - - return WIN_ERR_OK; - -} - -//------------------------------------------------------------------------------------------------- -/** Get the grabbed window */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::winGetGrabWindow() -{ - - return m_grabWindow; - -} - -//------------------------------------------------------------------------------------------------- -/** Explicitly set the grab window */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::winSetGrabWindow( GameWindow *window ) -{ - - m_grabWindow = window; - -} - -//------------------------------------------------------------------------------------------------- -/** Explicitly set the grab window */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::winSetLoneWindow( GameWindow *window ) -{ - // ignore if we're trying to set the same window - if( m_loneWindow == window ) - return; - if( m_loneWindow ) - winSendSystemMsg( m_loneWindow, GGM_CLOSE, 0, 0 ); - m_loneWindow = window; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a Modal Message Box */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback ) -{ - return gogoMessageBox(x,y, width,height,buttonFlags,titleString,bodyString,yesCallback,noCallback,okCallback,cancelCallback, FALSE); -} - -GameWindow *GameWindowManager::gogoMessageBox(Int x, Int y, Int width, Int height, UnsignedShort buttonFlags, - UnicodeString titleString, UnicodeString bodyString, - GameWinMsgBoxFunc yesCallback, - GameWinMsgBoxFunc noCallback, - GameWinMsgBoxFunc okCallback, - GameWinMsgBoxFunc cancelCallback, Bool useLogo ) - -{ - // first check to make sure we have some buttons to display - if(buttonFlags == 0 ) - { - return nullptr; - } - GameWindow *trueParent = nullptr; - //Changed by Chris - if(useLogo) - trueParent = winCreateFromScript( "Menus/QuitMessageBox.wnd" ); - else - trueParent = winCreateFromScript( "Menus/MessageBox.wnd" ); - //Added By Chris - AsciiString menuName; - if(useLogo) - menuName.set("QuitMessageBox.wnd:"); - else - menuName.set("MessageBox.wnd:"); - - AsciiString tempName; - GameWindow *parent = nullptr; - - tempName = menuName; - tempName.concat("MessageBoxParent"); - parent = winGetWindowFromId(trueParent, TheNameKeyGenerator->nameToKey( tempName )); - winSetModal( trueParent ); - winSetFocus( nullptr ); // make sure we lose focus from other windows even if we refuse focus ourselves - winSetFocus( parent ); - - // If the user wants the size to be different then the default - float ratioX, ratioY = 1; - - if( width > 0 && height > 0 ) - { - ICoord2D temp; - //First grab the percent increase/decrease compared to the default size - parent->winGetSize( &temp.x, &temp.y); - ratioX = (float)width / (float)temp.x; - ratioY = (float)height / (float)temp.y; - //Set the window's new size - parent->winSetSize( width, height); - - //Resize/reposition all the children windows based off the ratio - GameWindow *child; - for( child = parent->winGetChild(); child; child = child->winGetNext() ) - { - child->winGetSize(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetSize(temp.x, temp.y); - - child->winGetPosition(&temp.x, &temp.y); - temp.x =Int(temp.x * ratioX); - temp.y =Int(temp.y * ratioY); - child->winSetPosition(temp.x, temp.y); - } - } - - // If the user wants to position the message box somewhere other then default - if( x >= 0 && y >= 0) - parent->winSetPosition(x, y); - - // Reposition the buttons - Int buttonX[3], buttonY[3]; - - //In the layout, buttonOk will be in the first button position - NameKeyType buttonOkID = NAMEKEY_INVALID; - - tempName = menuName; - tempName.concat("ButtonOk"); - buttonOkID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonOk = winGetWindowFromId(parent, buttonOkID); - buttonOk->winGetPosition(&buttonX[0], &buttonY[0]); - - tempName = menuName; - tempName.concat("ButtonYes"); - NameKeyType buttonYesID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonYes = winGetWindowFromId(parent, buttonYesID); - //buttonNo in the second position - tempName = menuName; - tempName.concat("ButtonNo"); - NameKeyType buttonNoID = TheNameKeyGenerator->nameToKey(tempName); - GameWindow *buttonNo = winGetWindowFromId(parent, buttonNoID); - buttonNo->winGetPosition(&buttonX[1], &buttonY[1]); - - //and buttonCancel in the third - tempName = menuName; - tempName.concat("ButtonCancel"); - NameKeyType buttonCancelID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *buttonCancel = winGetWindowFromId(parent, buttonCancelID); - buttonCancel->winGetPosition(&buttonX[2], &buttonY[2]); - - //we shouldn't have button OK and Yes on the same dialog - if((buttonFlags & (MSG_BOX_OK | MSG_BOX_YES)) == (MSG_BOX_OK | MSG_BOX_YES) ) - { - DEBUG_CRASH(("Passed in MSG_BOX_OK and MSG_BOX_YES. Big No No.")); - } - - //Position the OK button if we have one - if( (buttonFlags & MSG_BOX_OK) == MSG_BOX_OK) - { - buttonOk->winSetPosition(buttonX[0], buttonY[0]); - buttonOk->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_YES) == MSG_BOX_YES) - { - //Position the Yes if we have one - buttonYes->winSetPosition(buttonX[0], buttonY[0]); - buttonYes->winHide(FALSE); - } - - if((buttonFlags & (MSG_BOX_NO | MSG_BOX_CANCEL)) == (MSG_BOX_NO | MSG_BOX_CANCEL) ) - { - //If we have both the No and Cancel button, then the no should go in the middle position - buttonNo->winSetPosition(buttonX[1], buttonY[1]); - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - buttonCancel->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_NO) == MSG_BOX_NO) - { - //if we just have the no button, then position it in the right most spot - buttonNo->winSetPosition(buttonX[2], buttonY[2]); - buttonNo->winHide(FALSE); - } - else if( (buttonFlags & MSG_BOX_CANCEL) == MSG_BOX_CANCEL) - { - //else if we just have the Cancel button, well, it should always go in the right spot - buttonCancel->winSetPosition(buttonX[2], buttonY[2]); - buttonCancel->winHide(FALSE); - } - - // Fill the text into the text boxes - tempName = menuName; - tempName.concat("StaticTextTitle"); - NameKeyType staticTextTitleID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextTitle = winGetWindowFromId(parent, staticTextTitleID); - GadgetStaticTextSetText(staticTextTitle,titleString); - tempName = menuName; - tempName.concat("StaticTextMessage"); - NameKeyType staticTextMessageID = TheNameKeyGenerator->nameToKey( tempName ); - GameWindow *staticTextMessage = winGetWindowFromId(parent, staticTextMessageID); - GadgetStaticTextSetText(staticTextMessage,bodyString); - - // create a structure that will pass the functions to - WindowMessageBoxData *MsgBoxCallbacks = NEW WindowMessageBoxData; - MsgBoxCallbacks->cancelCallback = cancelCallback; - MsgBoxCallbacks->noCallback = noCallback; - MsgBoxCallbacks->okCallback = okCallback; - MsgBoxCallbacks->yesCallback = yesCallback; - //pass the structure to the dialog - trueParent->winSetUserData( MsgBoxCallbacks ); - - //make sure the dialog is showing and bring it to the top - parent->winHide(FALSE); - parent->winBringToTop(); - - //Changed By Chris - return trueParent; -} - -//------------------------------------------------------------------------------------------------- -/** Create a button GUI control */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetPushButton( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, - Bool defaultVisual ) -{ - GameWindow *button; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_PUSH_BUTTON ) == FALSE ) - { - - DEBUG_LOG(( "Can't create button gadget, instance data not button type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - button = winCreate( parent, status, - x, y, width, height, - GadgetPushButtonSystem, - instData ); - if( button == nullptr ) - { - - DEBUG_LOG(( "Unable to create button for push button gadget" )); - assert( 0 ); - return nullptr; - - } - - // assign input function - button->winSetInputFunc( GadgetPushButtonInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( button->winGetStatus(), WIN_STATUS_IMAGE ) ) - button->winSetDrawFunc( getPushButtonImageDrawFunc() ); - else - button->winSetDrawFunc( getPushButtonDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - button->winSetOwner( parent ); - - // Init the userdata to null - button->winSetUserData(nullptr); - - // assign the default images/colors - assignDefaultGadgetLook( button, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetButtonSetText( button, text ); - - return button; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a checkbox UI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetCheckbox( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *checkbox; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) == FALSE ) - { - - DEBUG_LOG(( "Can't create checkbox gadget, instance data not checkbox type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - checkbox = winCreate( parent, status, - x, y, width, height, - GadgetCheckBoxSystem, - instData ); - if( checkbox == nullptr ) - { - - DEBUG_LOG(( "Unable to create checkbox window" )); - assert( 0 ); - return nullptr; - - } - - // assign input function - checkbox->winSetInputFunc( GadgetCheckBoxInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( checkbox->winGetStatus(), WIN_STATUS_IMAGE ) ) - checkbox->winSetDrawFunc( getCheckBoxImageDrawFunc() ); - else - checkbox->winSetDrawFunc( getCheckBoxDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - checkbox->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( checkbox, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetCheckBoxSetText( checkbox, text ); - - return checkbox; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a radio button GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetRadioButton( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - RadioButtonData *rData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *radioButton; - RadioButtonData *radioData; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) == FALSE ) - { - - DEBUG_LOG(( "Can't create radioButton gadget, instance data not radioButton type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - radioButton = winCreate( parent, status, - x, y, width, height, - GadgetRadioButtonSystem, - instData ); - if( radioButton == nullptr ) - { - - DEBUG_LOG(( "Unable to create radio button window" )); - assert( 0 ); - return nullptr; - - } - - // allocate and store the radio button user data - radioData = NEW RadioButtonData; - memcpy( radioData, rData, sizeof( RadioButtonData ) ); - radioButton->winSetUserData( radioData ); - - // assign input function - radioButton->winSetInputFunc( GadgetRadioButtonInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( radioButton->winGetStatus(), WIN_STATUS_IMAGE ) ) - radioButton->winSetDrawFunc( getRadioButtonImageDrawFunc() ); - else - radioButton->winSetDrawFunc( getRadioButtonDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - radioButton->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( radioButton, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetRadioSetText( radioButton, text ); - - return radioButton; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a tab control GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetTabControl( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - TabControlData *tData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *tabControl; - TabControlData *tabData; - - // we MUST have a tab control style window to do this - if( BitIsSet( instData->getStyle(), GWS_TAB_CONTROL ) == FALSE ) - { - - DEBUG_LOG(( "Can't create tabControl gadget, instance data not tabControl type" )); - assert( 0 ); - return nullptr; - - } - - // create the tab control window - tabControl = winCreate( parent, status, - x, y, width, height, - GadgetTabControlSystem, - instData ); - if( tabControl == nullptr ) - { - - DEBUG_LOG(( "Unable to create tab control window" )); - assert( 0 ); - return nullptr; - - } - - // allocate and store the tab control user data - tabData = NEW TabControlData; - memcpy( tabData, tData, sizeof( TabControlData ) ); - tabControl->winSetUserData( tabData ); - - GadgetTabControlComputeTabRegion( tabControl ); - GadgetTabControlCreateSubPanes( tabControl ); - GadgetTabControlShowSubPane( tabControl, 0 ); - - // assign input function - tabControl->winSetInputFunc( GadgetTabControlInput ); - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( tabControl->winGetStatus(), WIN_STATUS_IMAGE ) ) - tabControl->winSetDrawFunc( getTabControlImageDrawFunc() ); - else - tabControl->winSetDrawFunc( getTabControlDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - tabControl->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( tabControl, defaultFont, defaultVisual ); - - return tabControl; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a list box GUI control */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetListBox( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - ListboxData *listboxDataTemplate, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *listbox; - ListboxData *listboxData; - Bool title = FALSE; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) == FALSE ) - { - - DEBUG_LOG(( "Can't create listbox gadget, instance data not listbox type" )); - assert( 0 ); - return nullptr; - - } - - // create the listbox - listbox = winCreate( parent, status, x, y, width, height, - GadgetListBoxSystem, instData ); - - if( listbox == nullptr ) - { - - DEBUG_LOG(( "Unable to create listbox window" )); - assert( 0 ); - return nullptr; - - } - - // allocate the listbox data, copy template data over and set it into box - listboxData = NEW ListboxData; - DEBUG_ASSERTCRASH(listboxDataTemplate, ("listboxDataTemplate not initialized")); - memcpy( listboxData, listboxDataTemplate, sizeof( ListboxData ) ); - - // Add the list box data struct to the window's class data - listbox->winSetUserData( listboxData ); - - // set the owner to the parent, or if no parent it will be itself - listbox->winSetOwner( parent ); - - // Adjust for list title if present - if( instData->getTextLength() ) - title = TRUE; - - // Set up list box redraw callbacks - if( BitIsSet( listbox->winGetStatus(), WIN_STATUS_IMAGE )) - listbox->winSetDrawFunc( getListBoxImageDrawFunc() ); - else - listbox->winSetDrawFunc( getListBoxDrawFunc() ); - - // Set up list box input callbacks - if( listboxData->multiSelect ) - listbox->winSetInputFunc( GadgetListBoxMultiInput ); - else - listbox->winSetInputFunc( GadgetListBoxInput ); - - - - // - // allocate and set the list length, note that setting the list length will - // automatically allocate the selection entries that are needed for multi - // select list boxes etc. - // - Int length = listboxData->listLength; - listboxData->listLength = 0; // hacky! - GadgetListBoxSetListLength( listbox, length ); - - // store display height - listboxData->displayHeight = height; - - if( title ) - listboxData->displayHeight -= winFontHeight( instData->getFont() ); - - // Set display position to the top of the list - listboxData->displayPos = 0; - listboxData->selectPos = -1; - listboxData->doubleClickTime = 0; - listboxData->insertPos = 0; - listboxData->endPos = 0; - listboxData->totalHeight = 0; - - // if this listbox has multiple selections prep it - //if( listboxData->multiSelect ) - // GadgetListBoxAddMultiSelect( listbox ); - - // If ScrollBar was requested ... create it. - if( listboxData->scrollBar ) - GadgetListboxCreateScrollbar( listbox ); - // - // Setup listbox Columns - // - if( listboxData->columns == 1 ) - { - listboxData->columnWidth = NEW Int[listboxData->columns]; - listboxData->columnWidth[0] = width; - if( listboxData->slider ) - { - ICoord2D sliderSize; - - listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - listboxData->columnWidth[0] -= (sliderSize.x + 2); - - } - } - else - { - if( !listboxData->columnWidthPercentage ) - return nullptr; - listboxData->columnWidth = NEW Int[listboxData->columns]; - if(!listboxData->columnWidth) - return nullptr; - - Int totalWidth = width; - if( listboxData->slider ) - { - ICoord2D sliderSize; - - listboxData->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - totalWidth -= (sliderSize.x + 2); - - } - for(Int i = 0; i < listboxData->columns; i++ ) - { - listboxData->columnWidth[i] = listboxData->columnWidthPercentage[i] * totalWidth / 100; - } - } - // assign the default images/colors - assignDefaultGadgetLook( listbox, defaultFont, defaultVisual ); - - return listbox; - -} - -//------------------------------------------------------------------------------------------------- -/** Does all generic window creation, calls appropriate slider create - * function to set up slider-specific data */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetSlider( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - SliderData *sliderData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *slider; - GameWindow *button; - SliderData *data; - - // - // All sliders need to have the tab stop status in order for - // the focus chain to work correctly. - // - BitSet( status, WIN_STATUS_TAB_STOP ); - - if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - { - - slider = winCreate( parent, status, x, y, width, height, - GadgetHorizontalSliderSystem, instData ); - - // Set up horizontal slider callbacks - slider->winSetInputFunc( GadgetHorizontalSliderInput ); - if( BitIsSet( slider->winGetStatus(), WIN_STATUS_IMAGE ) ) - slider->winSetDrawFunc( getHorizontalSliderImageDrawFunc() ); - else - slider->winSetDrawFunc( getHorizontalSliderDrawFunc() ); - - } - else if ( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) - { - - slider = winCreate( parent, status, x, y, width, height, - GadgetVerticalSliderSystem, instData ); - - // Set up vertical slider callbacks - slider->winSetInputFunc( GadgetVerticalSliderInput ); - - if( BitIsSet( slider->winGetStatus(), WIN_STATUS_IMAGE ) && !(parent && BitIsSet(parent->winGetStyle(), GWS_SCROLL_LISTBOX))) - slider->winSetDrawFunc( getVerticalSliderImageDrawFunc() ); - else - slider->winSetDrawFunc( getVerticalSliderDrawFunc() ); - - } - else - { - - DEBUG_LOG(( "gogoGadgetSlider warning: unrecognized slider style." )); - assert( 0 ); - return nullptr; - - } - - // sanity - if( slider == nullptr ) - { - - DEBUG_LOG(( "Unable to create slider control window" )); - assert( 0 ); - return nullptr; - - } - - // set the owner to the parent, or if no parent it will be itself - slider->winSetOwner( parent ); - - // create the slider thumb button - WinInstanceData buttonInstData; - UnsignedInt statusFlags = status | WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE; - - buttonInstData.init(); - - // if parent is hidden we don't need to be. - BitClear( statusFlags, WIN_STATUS_HIDDEN ); - - buttonInstData.m_owner = slider; - buttonInstData.m_style = GWS_PUSH_BUTTON; - - // if slider tracks, so will this sub control - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - BitSet( buttonInstData.m_style, GWS_MOUSE_TRACK ); - - if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - button = gogoGadgetPushButton( slider, statusFlags, 0, HORIZONTAL_SLIDER_THUMB_POSITION, - HORIZONTAL_SLIDER_THUMB_WIDTH, HORIZONTAL_SLIDER_THUMB_HEIGHT, &buttonInstData, nullptr, TRUE ); - else - button = gogoGadgetPushButton( slider, statusFlags, 0, 0, - width, width+1, &buttonInstData, nullptr, TRUE ); - - // Protect against divide by zero - if( sliderData->maxVal == sliderData->minVal ) - sliderData->maxVal = sliderData->minVal + 1; - - if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - { - sliderData->numTicks = (float)(width - HORIZONTAL_SLIDER_THUMB_WIDTH) / - (float)(sliderData->maxVal - sliderData->minVal); - } else - { - sliderData->numTicks = (float)(height - GADGET_SIZE) / - (float)(sliderData->maxVal - sliderData->minVal); - } - - data = NEW SliderData; - memcpy( data, sliderData, sizeof(SliderData) ); - - // Add the slider data struct to the window's class data - slider->winSetUserData( data ); - - // assign the default images/colors - assignDefaultGadgetLook( slider, defaultFont, defaultVisual ); - - return slider; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a Combo Box GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetComboBox( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - ComboBoxData *comboBoxDataTemplate, - GameFont *defaultFont, - Bool defaultVisual ) -{ - GameWindow *comboBox; - ComboBoxData *comboBoxData; - Bool title = FALSE; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX) == FALSE ) - { - - DEBUG_LOG(( "Can't create ComboBox gadget, instance data not ComboBox type" )); - assert( 0 ); - return nullptr; - - } - - // create the listbox - comboBox = winCreate( parent, status, x, y, width, height, - GadgetComboBoxSystem, instData ); - - if( comboBox == nullptr ) - { - - DEBUG_LOG(( "Unable to create ComboBox window" )); - assert( 0 ); - return nullptr; - - } - - -// begin here - // allocate the listbox data, copy template data over and set it into box - comboBoxData = NEW ComboBoxData; - memcpy( comboBoxData, comboBoxDataTemplate, sizeof( ComboBoxData ) ); - - // Add the list box data struct to the window's class data - comboBox->winSetUserData( comboBoxData ); - - // set the owner to the parent, or if no parent it will be itself - comboBox->winSetOwner( parent ); - - // Adjust for list title if present - if( instData->getTextLength() ) - title = TRUE; - - // Set up list box redraw callbacks - if( BitIsSet( comboBox->winGetStatus(), WIN_STATUS_IMAGE )) - comboBox->winSetDrawFunc( getComboBoxImageDrawFunc() ); - else - comboBox->winSetDrawFunc( getComboBoxDrawFunc() ); - - // Set up list box input callbacks - comboBox->winSetInputFunc( GadgetComboBoxInput ); - - //Create the windows that make up - - - WinInstanceData winInstData; - Int buttonWidth, buttonHeight; - Int fontHeight; - Int top; - Int bottom; - - - // do we have a title - if( comboBox->winGetTextLength() ) - title = TRUE; - - // remove unwanted status bits. - status &= ~(WIN_STATUS_BORDER | WIN_STATUS_HIDDEN); - - fontHeight = winFontHeight( comboBox->winGetFont() ); - top = title ? (fontHeight + 1):0; - bottom = title ? (height - (fontHeight + 1)):height; - - // initialize instData - winInstData.init(); - - // size of button - buttonWidth = 21; - buttonHeight = 22; - - // ---------------------------------------------------------------------- - // Create Drop Down Button - // ---------------------------------------------------------------------- - - winInstData.m_owner = comboBox; - winInstData.m_style = GWS_PUSH_BUTTON; - - // if listbox tracks, so will this sub control - if( BitIsSet( comboBox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - comboBoxData->dropDownButton = - gogoGadgetPushButton( comboBox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - buttonWidth, 0, - buttonWidth, height, - &winInstData, nullptr, TRUE ); - comboBoxData->dropDownButton->winSetTooltipFunc(comboBox->winGetTooltipFunc()); - comboBoxData->dropDownButton->winSetTooltip(instData->getTooltipText()); - comboBoxData->dropDownButton->setTooltipDelay(comboBox->getTooltipDelay()); - // ---------------------------------------------------------------------- - // Create text entry - // ---------------------------------------------------------------------- - UnsignedInt statusTextEntry; - winInstData.init(); - - winInstData.m_owner = comboBox; - winInstData.m_style |= GWS_ENTRY_FIELD; - winInstData.m_textLabelString = "Entry"; - if( BitIsSet( comboBox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - if( comboBoxData->isEditable) - { - statusTextEntry = status; - } - else - { - statusTextEntry = status | WIN_STATUS_NO_INPUT ;//| WIN_STATUS_NO_FOCUS; - comboBoxData->entryData->drawTextFromStart = TRUE; - } - comboBoxData->editBox = gogoGadgetTextEntry( comboBox, statusTextEntry , - 0,0 , - width - buttonWidth , height , - &winInstData, comboBoxData->entryData, - winInstData.m_font, FALSE ); - comboBoxData->editBox->winSetTooltipFunc(comboBox->winGetTooltipFunc()); - comboBoxData->editBox->winSetTooltip(instData->getTooltipText()); - comboBoxData->editBox->setTooltipDelay(comboBox->getTooltipDelay()); - - delete (comboBoxData->entryData); - comboBoxData->entryData = (EntryData *)comboBoxData->editBox->winGetUserData(); - // ---------------------------------------------------------------------- - // Create list box - // ---------------------------------------------------------------------- - winInstData.init(); - - winInstData.m_owner = comboBox; - if( BitIsSet( comboBox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - BitSet( winInstData.m_style, WIN_STATUS_HIDDEN ); - winInstData.m_style |= GWS_SCROLL_LISTBOX; - status &= ~(WIN_STATUS_IMAGE); - comboBoxData->listBox = gogoGadgetListBox( comboBox, status | WIN_STATUS_ABOVE | WIN_STATUS_ONE_LINE, 0, height, - width, height, - &winInstData, comboBoxData->listboxData, - winInstData.m_font, FALSE ); - comboBoxData->listBox->winHide(TRUE); - delete(comboBoxData->listboxData); - comboBoxData->listboxData = (ListboxData *)comboBoxData->listBox->winGetUserData(); - - comboBoxData->listBox->winSetTooltipFunc(comboBox->winGetTooltipFunc()); - comboBoxData->listBox->winSetTooltip(instData->getTooltipText()); - comboBoxData->listBox->setTooltipDelay(comboBox->getTooltipDelay()); - GadgetListBoxSetAudioFeedback(comboBoxData->listBox, TRUE); - - // Initialize the ComboBox's variables and the controls with them - GadgetComboBoxSetIsEditable(comboBox, comboBoxData->isEditable); - GadgetComboBoxSetMaxChars( comboBox, comboBoxData->maxChars ); - GadgetComboBoxSetMaxDisplay( comboBox, comboBoxData->maxDisplay ); - - //Initialize the control's text colors - Color color, border; - - color = comboBox->winGetEnabledTextColor(); - border = comboBox->winGetEnabledTextBorderColor(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetEnabledTextColors( color,border); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetEnabledTextColors(color,border); - - color = comboBox->winGetDisabledTextColor(); - border = comboBox->winGetDisabledTextBorderColor(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetDisabledTextColors( color,border); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetDisabledTextColors(color,border); - - - color = comboBox->winGetHiliteTextColor(); - border = comboBox->winGetHiliteTextBorderColor(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetHiliteTextColors( color,border); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetHiliteTextColors(color,border); - - comboBoxData->dontHide = FALSE; - - // assign the default images/colors - assignDefaultGadgetLook( comboBox, defaultFont, defaultVisual ); - - return comboBox; - -} - -//------------------------------------------------------------------------------------------------- -/** Create a progress bar GUI element */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetProgressBar( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *progressBar; - - // we MUST have a push button style window to do this - if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) == FALSE ) - { - - DEBUG_LOG(( "Can't create progressBar gadget, instance data not progressBar type" )); - assert( 0 ); - return nullptr; - - } - - // create the button window - progressBar = winCreate( parent, status, - x, y, width, height, - GadgetProgressBarSystem, - instData ); - if( progressBar == nullptr ) - { - - DEBUG_LOG(( "Unable to create progress bar control" )); - assert( 0 ); - return nullptr; - - } - - // - // assign draw function, the draw functions must actually be implemented - // on the device level of the engine - // - if( BitIsSet( progressBar->winGetStatus(), WIN_STATUS_IMAGE ) ) - progressBar->winSetDrawFunc( getProgressBarImageDrawFunc() ); - else - progressBar->winSetDrawFunc( getProgressBarDrawFunc() ); - - // set the owner to the parent, or if no parent it will be itself - progressBar->winSetOwner( parent ); - - // assign the default images/colors - assignDefaultGadgetLook( progressBar, defaultFont, defaultVisual ); - - return progressBar; - -} - -//------------------------------------------------------------------------------------------------- -/** Does all generic window creation, calls appropriate text field create - * function to set up specific data */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetStaticText( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - TextData *textData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *textWin; - TextData *data; - - // Static Text can not be a Tab Stop - BitClear( instData->m_style, GWS_TAB_STOP ); - - if( BitIsSet( instData->getStyle(), GWS_STATIC_TEXT ) ) - { - textWin = winCreate( parent, status, x, y, width, height, - GadgetStaticTextSystem, instData ); - } - else - { - DEBUG_LOG(( "gogoGadgetText warning: unrecognized text style." )); - return nullptr; - } - - if( textWin != nullptr ) - { - - // set the owner to the parent, or if no parent it will be itself - textWin->winSetOwner( parent ); - - // assign callbacks - textWin->winSetInputFunc( GadgetStaticTextInput ); - if( BitIsSet( textWin->winGetStatus(), WIN_STATUS_IMAGE ) ) - textWin->winSetDrawFunc( getStaticTextImageDrawFunc() ); - else - textWin->winSetDrawFunc( getStaticTextDrawFunc() ); - - data = NEW TextData; - assert( textData != nullptr ); - memcpy( data, textData, sizeof(TextData) ); - - // allocate a display string for the tet - data->text = TheDisplayStringManager->newDisplayString(); - // set whether or not we center the wrapped text - data->text->setWordWrapCentered( BitIsSet( instData->getStatus(), WIN_STATUS_WRAP_CENTERED )); - // Add the entry field data struct to the window's class data - textWin->winSetUserData( data ); - - // assign the default images/colors - assignDefaultGadgetLook( textWin, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetStaticTextSetText( textWin, text ); - - } - - return textWin; - -} - -//------------------------------------------------------------------------------------------------- -/** Does all generic window creation, calls appropriate entry field create - * function to set up specific data */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::gogoGadgetTextEntry( GameWindow *parent, - UnsignedInt status, - Int x, Int y, - Int width, Int height, - WinInstanceData *instData, - EntryData *entryData, - GameFont *defaultFont, - Bool defaultVisual ) - -{ - GameWindow *entry; - EntryData *data; - - if( BitIsSet( instData->getStyle(), GWS_ENTRY_FIELD ) == FALSE ) - { - - DEBUG_LOG(( "Unable to create text entry, style not entry type" )); - assert( 0 ); - return nullptr; - - } - - // create the window - entry = winCreate( parent, status, x, y, width, height, - GadgetTextEntrySystem, instData ); - if( entry == nullptr ) - { - - DEBUG_LOG(( "Unable to create text entry window" )); - assert( 0 ); - return nullptr; - - } - - // set owner of this control - entry->winSetOwner( parent ); - - // assign callbacks - entry->winSetInputFunc( GadgetTextEntryInput ); - if( BitIsSet( entry->winGetStatus(), WIN_STATUS_IMAGE ) ) - entry->winSetDrawFunc( getTextEntryImageDrawFunc() ); - else - entry->winSetDrawFunc( getTextEntryDrawFunc() ); - - // zero entry data -// memset( entryData->text, 0, ENTRY_TEXT_LEN ); -// memset( entryData->constructText, 0, ENTRY_TEXT_LEN ); - - // initialize character positions, lengths etc - if( entryData->text ) - entryData->charPos = entryData->text->getTextLength(); - else - entryData->charPos = 0; - entryData->conCharPos = 0; - entryData->receivedUnichar = FALSE; - if( entryData->maxTextLen > ENTRY_TEXT_LEN ) - entryData->maxTextLen = ENTRY_TEXT_LEN; - - // allocate entry data - data = NEW EntryData; - - // copy over data control - memcpy( data, entryData, sizeof(EntryData) ); - - // allocate new text display string - data->text = TheDisplayStringManager->newDisplayString(); - data->sText = TheDisplayStringManager->newDisplayString(); - data->constructText = TheDisplayStringManager->newDisplayString(); - - // set the max for the text lengths -// data->text->allocateFixed( ENTRY_TEXT_LEN ); -// data->sText->allocateFixed( ENTRY_TEXT_LEN ); - - // do any real display string copies - if( entryData->text ) - data->text->setText( entryData->text->getText() ); - if( entryData->sText ) - data->sText->setText( entryData->sText->getText() ); - - // set data into window - entry->winSetUserData( data ); - - // asian languages get to have list box kanji character completion - data->constructList = nullptr; - if( OurLanguage == LANGUAGE_ID_KOREAN || - OurLanguage == LANGUAGE_ID_JAPANESE ) - { - // we need to create the construct listbox - WinInstanceData boxInstData; - ListboxData lData; - - // initialize instData - boxInstData.init(); - - // define display region - memset( &lData, 0, sizeof(ListboxData) ); - lData.listLength = 128; - lData.autoScroll = FALSE; - lData.scrollIfAtEnd = FALSE; - lData.autoPurge = TRUE; - lData.scrollBar = TRUE; - lData.multiSelect = FALSE; - lData.columns = 1; - lData.columnWidth = nullptr; - - boxInstData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - - data->constructList = gogoGadgetListBox( nullptr, - WIN_STATUS_ABOVE | - WIN_STATUS_HIDDEN | - WIN_STATUS_NO_FOCUS | - WIN_STATUS_ONE_LINE, - 0, height, - 110, 119, - &boxInstData, - &lData, - nullptr, - TRUE ); - - if( data->constructList == nullptr ) - { - - DEBUG_LOG(( "gogoGadgetEntry warning: Failed to create listbox." )); - assert( 0 ); - winDestroy( entry ); - return nullptr; - - } - - } - - // assign the default images/colors - assignDefaultGadgetLook( entry, defaultFont, defaultVisual ); - - // assign text from label - UnicodeString text = winTextLabelToText( instData->m_textLabelString ); - if( text.getLength() ) - GadgetTextEntrySetText( entry, text ); - - return entry; - -} - -//------------------------------------------------------------------------------------------------- -/** Use this method to assign the default images/colors to gadgets as - * they area created */ -//------------------------------------------------------------------------------------------------- -void GameWindowManager::assignDefaultGadgetLook( GameWindow *gadget, - GameFont *defaultFont, - Bool assignVisual ) -{ - UnsignedByte alpha = 255; - static Color red = winMakeColor( 255, 0, 0, alpha ); - static Color darkRed = winMakeColor( 128, 0, 0, alpha ); - static Color lightRed = winMakeColor( 255, 128, 128, alpha ); - static Color green = winMakeColor( 0, 255, 0, alpha ); - static Color darkGreen = winMakeColor( 0, 128, 0, alpha ); - static Color lightGreen = winMakeColor( 128, 255, 128, alpha ); - static Color blue = winMakeColor( 0, 0, 255, alpha ); - static Color darkBlue = winMakeColor( 0, 0, 128, alpha ); - static Color lightBlue = winMakeColor( 128, 128, 255, alpha ); - static Color purple = winMakeColor( 255, 0, 255, alpha ); - static Color darkPurple = winMakeColor( 128, 0, 128, alpha ); - static Color lightPurple= winMakeColor( 255, 128, 255, alpha ); - static Color yellow = winMakeColor( 255, 255, 0, alpha ); - static Color darkYellow = winMakeColor( 128, 128, 0, alpha ); - static Color lightYellow= winMakeColor( 255, 255, 128, alpha ); - static Color cyan = winMakeColor( 0, 255, 255, alpha ); - static Color darkCyan = winMakeColor( 64, 128, 128, alpha ); - static Color lightCyan = winMakeColor( 128, 255, 255, alpha ); - static Color gray = winMakeColor( 128, 128, 128, alpha ); - static Color darkGray = winMakeColor( 64, 64, 64, alpha ); - static Color lightGray = winMakeColor( 192, 192, 192, alpha ); - static Color black = winMakeColor( 0, 0, 0, alpha ); - static Color white = winMakeColor( 254, 254, 254, alpha ); - static Color enabledText = white; - static Color enabledTextBorder = darkGray; - static Color disabledText = darkGray; - static Color disabledTextBorder = black; - static Color hiliteText = lightBlue; - static Color hiliteTextBorder = blue; - static Color imeCompositeText = green; - static Color imeCompositeTextBorder = blue; - WinInstanceData *instData; - - // sanity - if( gadget == nullptr ) - return; - - // get instance data - instData = gadget->winGetInstanceData(); - - // set default font - if( defaultFont ) - gadget->winSetFont( defaultFont ); - else - { - if (TheGlobalLanguageData && TheGlobalLanguageData->m_defaultWindowFont.name.isNotEmpty()) - { gadget->winSetFont( winFindFont( - TheGlobalLanguageData->m_defaultWindowFont.name, - TheGlobalLanguageData->m_defaultWindowFont.size, - TheGlobalLanguageData->m_defaultWindowFont.bold) ); - } - else - gadget->winSetFont( winFindFont( "Times New Roman", 14, FALSE ) ); - } - - // if we don't want to assign default colors/images get out of here - if( assignVisual == FALSE ) - return; - - // create images for the correct gadget type - if( BitIsSet( instData->getStyle(), GWS_PUSH_BUTTON ) ) - { - - // enabled background - GadgetButtonSetEnabledImage( gadget, winFindImage( "PushButtonEnabled" ) ); - GadgetButtonSetEnabledColor( gadget, red ); - GadgetButtonSetEnabledBorderColor( gadget, lightRed ); - // enabled selected button - GadgetButtonSetEnabledSelectedImage( gadget, winFindImage( "PushButtonEnabledSelected" ) ); - GadgetButtonSetEnabledSelectedColor( gadget, yellow ); - GadgetButtonSetEnabledSelectedBorderColor( gadget, white ); - - // Disabled background - GadgetButtonSetDisabledImage( gadget, winFindImage( "PushButtonDisabled" ) ); - GadgetButtonSetDisabledColor( gadget, gray ); - GadgetButtonSetDisabledBorderColor( gadget, lightGray ); - // Disabled selected button - GadgetButtonSetDisabledSelectedImage( gadget, winFindImage( "PushButtonDisabledSelected" ) ); - GadgetButtonSetDisabledSelectedColor( gadget, lightGray ); - GadgetButtonSetDisabledSelectedBorderColor( gadget, gray ); - - // Hilite background - GadgetButtonSetHiliteImage( gadget, winFindImage( "PushButtonHilite" ) ); - GadgetButtonSetHiliteColor( gadget, green ); - GadgetButtonSetHiliteBorderColor( gadget, darkGreen ); - // Hilite selected button - GadgetButtonSetHiliteSelectedImage( gadget, winFindImage( "PushButtonHiliteSelected" ) ); - GadgetButtonSetHiliteSelectedColor( gadget, yellow ); - GadgetButtonSetHiliteSelectedBorderColor( gadget, white ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_CHECK_BOX ) ) - { - - // enabled background - GadgetCheckBoxSetEnabledImage( gadget, winFindImage( "CheckBoxEnabled" ) ); - GadgetCheckBoxSetEnabledColor( gadget, red ); - GadgetCheckBoxSetEnabledBorderColor( gadget, lightRed ); - // enabled CheckBox unselected - GadgetCheckBoxSetEnabledUncheckedBoxImage( gadget, winFindImage( "CheckBoxEnabledBoxUnselected" ) ); - GadgetCheckBoxSetEnabledUncheckedBoxColor( gadget, WIN_COLOR_UNDEFINED ); - GadgetCheckBoxSetEnabledUncheckedBoxBorderColor( gadget, lightBlue ); - // enabled CheckBox selected - GadgetCheckBoxSetEnabledCheckedBoxImage( gadget, winFindImage( "CheckBoxEnabledBoxSelected" ) ); - GadgetCheckBoxSetEnabledCheckedBoxColor( gadget, blue ); - GadgetCheckBoxSetEnabledCheckedBoxBorderColor( gadget, lightBlue ); - - // disabled background - GadgetCheckBoxSetDisabledImage( gadget, winFindImage( "CheckBoxDisabled" ) ); - GadgetCheckBoxSetDisabledColor( gadget, gray ); - GadgetCheckBoxSetDisabledBorderColor( gadget, lightGray ); - // Disabled CheckBox unselected - GadgetCheckBoxSetDisabledUncheckedBoxImage( gadget, winFindImage( "CheckBoxDisabledBoxUnselected" ) ); - GadgetCheckBoxSetDisabledUncheckedBoxColor( gadget, WIN_COLOR_UNDEFINED ); - GadgetCheckBoxSetDisabledUncheckedBoxBorderColor( gadget, lightGray ); - // Disabled CheckBox selected - GadgetCheckBoxSetDisabledCheckedBoxImage( gadget, winFindImage( "CheckBoxDisabledBoxSelected" ) ); - GadgetCheckBoxSetDisabledCheckedBoxColor( gadget, darkGray ); - GadgetCheckBoxSetDisabledCheckedBoxBorderColor( gadget, white ); - - // Hilite background - GadgetCheckBoxSetHiliteImage( gadget, winFindImage( "CheckBoxHilite" ) ); - GadgetCheckBoxSetHiliteColor( gadget, green ); - GadgetCheckBoxSetHiliteBorderColor( gadget, lightGreen ); - // Hilite CheckBox unselected - GadgetCheckBoxSetHiliteUncheckedBoxImage( gadget, winFindImage( "CheckBoxHiliteBoxUnselected" ) ); - GadgetCheckBoxSetHiliteUncheckedBoxColor( gadget, WIN_COLOR_UNDEFINED ); - GadgetCheckBoxSetHiliteUncheckedBoxBorderColor( gadget, lightBlue ); - // Hilite CheckBox selected - GadgetCheckBoxSetHiliteCheckedBoxImage( gadget, winFindImage( "CheckBoxHiliteBoxSelected" ) ); - GadgetCheckBoxSetHiliteCheckedBoxColor( gadget, yellow ); - GadgetCheckBoxSetHiliteCheckedBoxBorderColor( gadget, white ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_RADIO_BUTTON ) ) - { - - // enabled background - GadgetRadioSetEnabledImage( gadget, winFindImage( "RadioButtonEnabled" ) ); - GadgetRadioSetEnabledColor( gadget, red ); - GadgetRadioSetEnabledBorderColor( gadget, lightRed ); - // enabled radio unselected - GadgetRadioSetEnabledUncheckedBoxImage( gadget, winFindImage( "RadioButtonEnabledBoxUnselected" ) ); - GadgetRadioSetEnabledUncheckedBoxColor( gadget, darkRed ); - GadgetRadioSetEnabledUncheckedBoxBorderColor( gadget, black ); - // enabled radio selected - GadgetRadioSetEnabledCheckedBoxImage( gadget, winFindImage( "RadioButtonEnabledBoxSelected" ) ); - GadgetRadioSetEnabledCheckedBoxColor( gadget, blue ); - GadgetRadioSetEnabledCheckedBoxBorderColor( gadget, lightBlue ); - - // disabled background - GadgetRadioSetDisabledImage( gadget, winFindImage( "RadioButtonDisabled" ) ); - GadgetRadioSetDisabledColor( gadget, gray ); - GadgetRadioSetDisabledBorderColor( gadget, lightGray ); - // Disabled radio unselected - GadgetRadioSetDisabledUncheckedBoxImage( gadget, winFindImage( "RadioButtonDisabledBoxUnselected" ) ); - GadgetRadioSetDisabledUncheckedBoxColor( gadget, gray ); - GadgetRadioSetDisabledUncheckedBoxBorderColor( gadget, lightGray ); - // Disabled radio selected - GadgetRadioSetDisabledCheckedBoxImage( gadget, winFindImage( "RadioButtonDisabledBoxSelected" ) ); - GadgetRadioSetDisabledCheckedBoxColor( gadget, darkGray ); - GadgetRadioSetDisabledCheckedBoxBorderColor( gadget, white ); - - // Hilite background - GadgetRadioSetHiliteImage( gadget, winFindImage( "RadioButtonHilite" ) ); - GadgetRadioSetHiliteColor( gadget, green ); - GadgetRadioSetHiliteBorderColor( gadget, lightGreen ); - // Hilite radio unselected - GadgetRadioSetHiliteUncheckedBoxImage( gadget, winFindImage( "RadioButtonHiliteBoxUnselected" ) ); - GadgetRadioSetHiliteUncheckedBoxColor( gadget, darkGreen ); - GadgetRadioSetHiliteUncheckedBoxBorderColor( gadget, lightGreen ); - // Hilite radio selected - GadgetRadioSetHiliteCheckedBoxImage( gadget, winFindImage( "RadioButtonHiliteBoxSelected" ) ); - GadgetRadioSetHiliteCheckedBoxColor( gadget, yellow ); - GadgetRadioSetHiliteCheckedBoxBorderColor( gadget, white ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_HORZ_SLIDER ) ) - { - - // enabled - GadgetSliderSetEnabledImageLeft( gadget, winFindImage( "HSliderEnabledLeftEnd" ) ); - GadgetSliderSetEnabledImageRight( gadget, winFindImage( "HSliderEnabledRightEnd" ) ); - GadgetSliderSetEnabledImageCenter( gadget, winFindImage( "HSliderEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( gadget, winFindImage( "HSliderEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledColor( gadget, red ); - GadgetSliderSetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetSliderSetDisabledImageLeft( gadget, winFindImage( "HSliderDisabledLeftEnd" ) ); - GadgetSliderSetDisabledImageRight( gadget, winFindImage( "HSliderDisabledRightEnd" ) ); - GadgetSliderSetDisabledImageCenter( gadget, winFindImage( "HSliderDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( gadget, winFindImage( "HSliderDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledColor( gadget, red ); - GadgetSliderSetDisabledBorderColor( gadget, lightRed ); - - // hilite - GadgetSliderSetHiliteImageLeft( gadget, winFindImage( "HSliderHiliteLeftEnd" ) ); - GadgetSliderSetHiliteImageRight( gadget, winFindImage( "HSliderHiliteRightEnd" ) ); - GadgetSliderSetHiliteImageCenter( gadget, winFindImage( "HSliderHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( gadget, winFindImage( "HSliderHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteColor( gadget, red ); - GadgetSliderSetHiliteBorderColor( gadget, lightRed ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - // - // set the default colors and images for the slider thumb - // - // enabled - GadgetSliderSetEnabledThumbImage( gadget, winFindImage( "HSliderThumbEnabled" ) ); - GadgetSliderSetEnabledThumbColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - GadgetSliderSetEnabledThumbBorderColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbImage( gadget, winFindImage( "HSliderThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbBorderColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - - // disabled - GadgetSliderSetDisabledThumbImage( gadget, winFindImage( "HSliderThumbDisabled" ) ); - GadgetSliderSetDisabledThumbColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - GadgetSliderSetDisabledThumbBorderColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbImage( gadget, winFindImage( "HSliderThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbBorderColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - - // hilite - GadgetSliderSetHiliteThumbImage( gadget, winFindImage( "HSliderThumbHilite" ) ); - GadgetSliderSetHiliteThumbColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - GadgetSliderSetHiliteThumbBorderColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbImage( gadget, winFindImage( "HSliderThumbHiliteSelected" ) ); - GadgetSliderSetHiliteSelectedThumbColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - - - } - else if( BitIsSet( instData->getStyle(), GWS_VERT_SLIDER ) ) - { - // enabled - GadgetSliderSetEnabledImageTop( gadget, winFindImage( "VSliderEnabledTopEnd" ) ); - GadgetSliderSetEnabledImageBottom( gadget, winFindImage( "VSliderEnabledBottomEnd" ) ); - GadgetSliderSetEnabledImageCenter( gadget, winFindImage( "VSliderEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( gadget, winFindImage( "VSliderEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledColor( gadget, red ); - GadgetSliderSetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetSliderSetDisabledImageTop( gadget, winFindImage( "VSliderDisabledTopEnd" ) ); - GadgetSliderSetDisabledImageBottom( gadget, winFindImage( "VSliderDisabledBottomEnd" ) ); - GadgetSliderSetDisabledImageCenter( gadget, winFindImage( "VSliderDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( gadget, winFindImage( "VSliderDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledColor( gadget, red ); - GadgetSliderSetDisabledBorderColor( gadget, lightRed ); - - // hilite - GadgetSliderSetHiliteImageTop( gadget, winFindImage( "VSliderHiliteTopEnd" ) ); - GadgetSliderSetHiliteImageBottom( gadget, winFindImage( "VSliderHiliteBottomEnd" ) ); - GadgetSliderSetHiliteImageCenter( gadget, winFindImage( "VSliderHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( gadget, winFindImage( "VSliderHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteColor( gadget, red ); - GadgetSliderSetHiliteBorderColor( gadget, lightRed ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - // - // set the default colors and images for the slider thumb - // - // enabled - GadgetSliderSetEnabledThumbImage( gadget, winFindImage( "VSliderThumbEnabled" ) ); - GadgetSliderSetEnabledThumbColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - GadgetSliderSetEnabledThumbBorderColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbImage( gadget, winFindImage( "VSliderThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbColor( gadget, GadgetSliderGetEnabledBorderColor( gadget ) ); - GadgetSliderSetEnabledSelectedThumbBorderColor( gadget, GadgetSliderGetEnabledColor( gadget ) ); - - // disabled - GadgetSliderSetDisabledThumbImage( gadget, winFindImage( "VSliderThumbDisabled" ) ); - GadgetSliderSetDisabledThumbColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - GadgetSliderSetDisabledThumbBorderColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbImage( gadget, winFindImage( "VSliderThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbColor( gadget, GadgetSliderGetDisabledBorderColor( gadget ) ); - GadgetSliderSetDisabledSelectedThumbBorderColor( gadget, GadgetSliderGetDisabledColor( gadget ) ); - - // hilite - GadgetSliderSetHiliteThumbImage( gadget, winFindImage( "VSliderThumbHilite" ) ); - GadgetSliderSetHiliteThumbColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - GadgetSliderSetHiliteThumbBorderColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbImage( gadget, winFindImage( "VSliderThumbHiliteSelected" ) ); - GadgetSliderSetHiliteSelectedThumbColor( gadget, GadgetSliderGetHiliteBorderColor( gadget ) ); - GadgetSliderSetHiliteSelectedThumbBorderColor( gadget, GadgetSliderGetHiliteColor( gadget ) ); - - } - else if( BitIsSet( instData->getStyle(), GWS_SCROLL_LISTBOX ) ) - { - ListboxData *listboxData = (ListboxData *)gadget->winGetUserData(); - - // set the colors - GadgetListBoxSetColors( gadget, - red, // enabled - lightRed, // enabled border - yellow, // enabled selected item - white, // enabled selected item border - gray, // disabled - lightGray, // disabled border - lightGray, // disabled selected item - white, // disabled selected item border - green, // hilite - darkGreen, // hilite border - white, // hilite selected item - darkGreen ); // hilite selected item border - - // now set the images - - // enabled - GadgetListBoxSetEnabledImage( gadget, winFindImage( "ListBoxEnabled" ) ); - GadgetListBoxSetEnabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxEnabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageRight( gadget, winFindImage( "ListBoxEnabledSelectedItemRightEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetEnabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemSmallRepeatingCenter" ) ); - - // disabled - GadgetListBoxSetDisabledImage( gadget, winFindImage( "ListBoxDisabled" ) ); - GadgetListBoxSetDisabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxDisabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageRight( gadget, winFindImage( "ListBoxDisabledSelectedItemRightEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetDisabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemSmallRepeatingCenter" ) ); - - - // hilited - GadgetListBoxSetHiliteImage( gadget, winFindImage( "ListBoxHilite" ) ); - GadgetListBoxSetHiliteSelectedItemImageLeft( gadget, winFindImage( "ListBoxHiliteSelectedItemLeftEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageRight( gadget, winFindImage( "ListBoxHiliteSelectedItemRightEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetHiliteSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemSmallRepeatingCenter" ) ); - - // assign default slider colors and images as part of the list box - GameWindow *slider = listboxData->slider; - if( slider ) - { - GameWindow *upButton = listboxData->upButton; - GameWindow *downButton = listboxData->downButton; - - // slider and slider thumb ---------------------------------------------- - - // enabled - GadgetSliderSetEnabledImageTop( slider, winFindImage( "VSliderLargeEnabledTopEnd" ) ); - GadgetSliderSetEnabledImageBottom( slider, winFindImage( "VSliderLargeEnabledBottomEnd" ) ); - GadgetSliderSetEnabledImageCenter( slider, winFindImage( "VSliderLargeEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( slider, winFindImage( "VSliderLargeEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - - // disabled - GadgetSliderSetDisabledImageTop( slider, winFindImage( "VSliderLargeDisabledTopEnd" ) ); - GadgetSliderSetDisabledImageBottom( slider, winFindImage( "VSliderLargeDisabledBottomEnd" ) ); - GadgetSliderSetDisabledImageCenter( slider, winFindImage( "VSliderLargeDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( slider, winFindImage( "VSliderLargeDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - - // hilite - GadgetSliderSetHiliteImageTop( slider, winFindImage( "VSliderLargeHiliteTopEnd" ) ); - GadgetSliderSetHiliteImageBottom( slider, winFindImage( "VSliderLargeHiliteBottomEnd" ) ); - GadgetSliderSetHiliteImageCenter( slider, winFindImage( "VSliderLargeHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( slider, winFindImage( "VSliderLargeHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - GadgetSliderSetHiliteSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - - // up button ------------------------------------------------------------ - - // enabled - GadgetButtonSetEnabledImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( upButton, winFindImage( "VSliderLargeUpButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonHiliteSelected" ) ); - - // down button ---------------------------------------------------------- - - // enabled - GadgetButtonSetEnabledImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - - } - - } - else if( BitIsSet( instData->getStyle(), GWS_COMBO_BOX ) ) - { -// ComboBoxData *comboBoxData = (ComboBoxData *)gadget->winGetUserData(); - - GadgetComboBoxSetColors( gadget, - red, // enabled - lightRed, // enabled border - yellow, // enabled selected item - white, // enabled selected item border - gray, // disabled - lightGray, // disabled border - lightGray, // disabled selected item - white, // disabled selected item border - green, // hilite - darkGreen, // hilite border - white, // hilite selected item - darkGreen ); // hilite selected item border - - // enabled - GadgetComboBoxSetEnabledImage( gadget, winFindImage( "ListBoxEnabled" ) ); - GadgetComboBoxSetEnabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxEnabledSelectedItemLeftEnd" ) ); - GadgetComboBoxSetEnabledSelectedItemImageRight( gadget, winFindImage( "ListBoxEnabledSelectedItemRightEnd" ) ); - GadgetComboBoxSetEnabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemRepeatingCenter" ) ); - GadgetComboBoxSetEnabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxEnabledSelectedItemSmallRepeatingCenter" ) ); - - // disabled - GadgetComboBoxSetDisabledImage( gadget, winFindImage( "ListBoxDisabled" ) ); - GadgetComboBoxSetDisabledSelectedItemImageLeft( gadget, winFindImage( "ListBoxDisabledSelectedItemLeftEnd" ) ); - GadgetComboBoxSetDisabledSelectedItemImageRight( gadget, winFindImage( "ListBoxDisabledSelectedItemRightEnd" ) ); - GadgetComboBoxSetDisabledSelectedItemImageCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemRepeatingCenter" ) ); - GadgetComboBoxSetDisabledSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxDisabledSelectedItemSmallRepeatingCenter" ) ); - - - // hilited - GadgetComboBoxSetHiliteImage( gadget, winFindImage( "ListBoxHilite" ) ); - GadgetComboBoxSetHiliteSelectedItemImageLeft( gadget, winFindImage( "ListBoxHiliteSelectedItemLeftEnd" ) ); - GadgetComboBoxSetHiliteSelectedItemImageRight( gadget, winFindImage( "ListBoxHiliteSelectedItemRightEnd" ) ); - GadgetComboBoxSetHiliteSelectedItemImageCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemRepeatingCenter" ) ); - GadgetComboBoxSetHiliteSelectedItemImageSmallCenter( gadget, winFindImage( "ListBoxHiliteSelectedItemSmallRepeatingCenter" ) ); - - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton( gadget ); - if ( dropDownButton ) - { - // enabled background - GadgetButtonSetEnabledImage( dropDownButton, winFindImage( "PushButtonEnabled" ) ); - // enabled selected button - GadgetButtonSetEnabledSelectedImage( dropDownButton, winFindImage( "PushButtonEnabledSelected" ) ); - - // Disabled background - GadgetButtonSetDisabledImage( dropDownButton, winFindImage( "PushButtonDisabled" ) ); - // Disabled selected button - GadgetButtonSetDisabledSelectedImage( dropDownButton, winFindImage( "PushButtonDisabledSelected" ) ); - - // Hilite background - GadgetButtonSetHiliteImage( dropDownButton, winFindImage( "PushButtonHilite" ) ); - // Hilite selected button - GadgetButtonSetHiliteSelectedImage( dropDownButton, winFindImage( "PushButtonHiliteSelected" ) ); - - } - - GameWindow *editBox = GadgetComboBoxGetEditBox( gadget ); - if ( editBox ) - { - // enabled - GadgetTextEntrySetEnabledImageLeft( editBox, winFindImage( "TextEntryEnabledLeftEnd" ) ); - GadgetTextEntrySetEnabledImageRight( editBox, winFindImage( "TextEntryEnabledRightEnd" ) ); - GadgetTextEntrySetEnabledImageCenter( editBox, winFindImage( "TextEntryEnabledRepeatingCenter" ) ); - GadgetTextEntrySetEnabledImageSmallCenter( editBox, winFindImage( "TextEntryEnabledSmallRepeatingCenter" ) ); - - // disabled - GadgetTextEntrySetDisabledImageLeft( editBox, winFindImage( "TextEntryDisabledLeftEnd" ) ); - GadgetTextEntrySetDisabledImageRight( editBox, winFindImage( "TextEntryDisabledRightEnd" ) ); - GadgetTextEntrySetDisabledImageCenter( editBox, winFindImage( "TextEntryDisabledRepeatingCenter" ) ); - GadgetTextEntrySetDisabledImageSmallCenter( editBox, winFindImage( "TextEntryDisabledSmallRepeatingCenter" ) ); - - // hilited - GadgetTextEntrySetHiliteImageLeft( editBox, winFindImage( "TextEntryHiliteLeftEnd" ) ); - GadgetTextEntrySetHiliteImageRight( editBox, winFindImage( "TextEntryHiliteRightEnd" ) ); - GadgetTextEntrySetHiliteImageCenter( editBox, winFindImage( "TextEntryHiliteRepeatingCenter" ) ); - GadgetTextEntrySetHiliteImageSmallCenter( editBox, winFindImage( "TextEntryHiliteSmallRepeatingCenter" ) ); - - } - - GameWindow * listBox = GadgetComboBoxGetListBox( gadget ); - if ( listBox ) - { - - // now set the images - - // enabled - GadgetListBoxSetEnabledImage( listBox, winFindImage( "ListBoxEnabled" ) ); - GadgetListBoxSetEnabledSelectedItemImageLeft( listBox, winFindImage( "ListBoxEnabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageRight( listBox, winFindImage( "ListBoxEnabledSelectedItemRightEnd" ) ); - GadgetListBoxSetEnabledSelectedItemImageCenter( listBox, winFindImage( "ListBoxEnabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetEnabledSelectedItemImageSmallCenter( listBox, winFindImage( "ListBoxEnabledSelectedItemSmallRepeatingCenter" ) ); - - // disabled - GadgetListBoxSetDisabledImage( listBox, winFindImage( "ListBoxDisabled" ) ); - GadgetListBoxSetDisabledSelectedItemImageLeft( listBox, winFindImage( "ListBoxDisabledSelectedItemLeftEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageRight( listBox, winFindImage( "ListBoxDisabledSelectedItemRightEnd" ) ); - GadgetListBoxSetDisabledSelectedItemImageCenter( listBox, winFindImage( "ListBoxDisabledSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetDisabledSelectedItemImageSmallCenter( listBox, winFindImage( "ListBoxDisabledSelectedItemSmallRepeatingCenter" ) ); - - - // hilited - GadgetListBoxSetHiliteImage( listBox, winFindImage( "ListBoxHilite" ) ); - GadgetListBoxSetHiliteSelectedItemImageLeft( listBox, winFindImage( "ListBoxHiliteSelectedItemLeftEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageRight( listBox, winFindImage( "ListBoxHiliteSelectedItemRightEnd" ) ); - GadgetListBoxSetHiliteSelectedItemImageCenter( listBox, winFindImage( "ListBoxHiliteSelectedItemRepeatingCenter" ) ); - GadgetListBoxSetHiliteSelectedItemImageSmallCenter( listBox, winFindImage( "ListBoxHiliteSelectedItemSmallRepeatingCenter" ) ); - - // assign default slider colors and images as part of the list box - GameWindow *slider = GadgetListBoxGetSlider( listBox ); - if( slider ) - { - GameWindow *upButton = GadgetListBoxGetUpButton( listBox ); - GameWindow *downButton = GadgetListBoxGetDownButton( listBox ); - - // slider and slider thumb ---------------------------------------------- - - // enabled - GadgetSliderSetEnabledImageTop( slider, winFindImage( "VSliderLargeEnabledTopEnd" ) ); - GadgetSliderSetEnabledImageBottom( slider, winFindImage( "VSliderLargeEnabledBottomEnd" ) ); - GadgetSliderSetEnabledImageCenter( slider, winFindImage( "VSliderLargeEnabledRepeatingCenter" ) ); - GadgetSliderSetEnabledImageSmallCenter( slider, winFindImage( "VSliderLargeEnabledSmallRepeatingCenter" ) ); - GadgetSliderSetEnabledThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - GadgetSliderSetEnabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbEnabled" ) ); - - // disabled - GadgetSliderSetDisabledImageTop( slider, winFindImage( "VSliderLargeDisabledTopEnd" ) ); - GadgetSliderSetDisabledImageBottom( slider, winFindImage( "VSliderLargeDisabledBottomEnd" ) ); - GadgetSliderSetDisabledImageCenter( slider, winFindImage( "VSliderLargeDisabledRepeatingCenter" ) ); - GadgetSliderSetDisabledImageSmallCenter( slider, winFindImage( "VSliderLargeDisabledSmallRepeatingCenter" ) ); - GadgetSliderSetDisabledThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - GadgetSliderSetDisabledSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbDisabled" ) ); - - // hilite - GadgetSliderSetHiliteImageTop( slider, winFindImage( "VSliderLargeHiliteTopEnd" ) ); - GadgetSliderSetHiliteImageBottom( slider, winFindImage( "VSliderLargeHiliteBottomEnd" ) ); - GadgetSliderSetHiliteImageCenter( slider, winFindImage( "VSliderLargeHiliteRepeatingCenter" ) ); - GadgetSliderSetHiliteImageSmallCenter( slider, winFindImage( "VSliderLargeHiliteSmallRepeatingCenter" ) ); - GadgetSliderSetHiliteThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - GadgetSliderSetHiliteSelectedThumbImage( slider, winFindImage( "VSliderLargeThumbHilite" ) ); - - // up button ------------------------------------------------------------ - - // enabled - GadgetButtonSetEnabledImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( upButton, winFindImage( "VSliderLargeUpButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( upButton, winFindImage( "VSliderLargeUpButtonHiliteSelected" ) ); - - // down button ---------------------------------------------------------- - - // enabled - GadgetButtonSetEnabledImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - GadgetButtonSetEnabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonEnabled" ) ); - - // disabled - GadgetButtonSetDisabledImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - GadgetButtonSetDisabledSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonDisabled" ) ); - - // hilite - GadgetButtonSetHiliteImage( downButton, winFindImage( "VSliderLargeDownButtonHilite" ) ); - GadgetButtonSetHiliteSelectedImage( downButton, winFindImage( "VSliderLargeDownButtonHiliteSelected" ) ); - - } - } - } - else if( BitIsSet( instData->getStyle(), GWS_PROGRESS_BAR ) ) - { - - // enabled - GadgetProgressBarSetEnabledColor( gadget, red ); - GadgetProgressBarSetEnabledBorderColor( gadget, lightRed ); - GadgetProgressBarSetEnabledImageLeft( gadget, winFindImage( "ProgressBarEnabledLeftEnd" ) ); - GadgetProgressBarSetEnabledImageRight( gadget, winFindImage( "ProgressBarEnabledRightEnd" ) ); - GadgetProgressBarSetEnabledImageCenter( gadget, winFindImage( "ProgressBarEnabledRepeatingCenter" ) ); - GadgetProgressBarSetEnabledImageSmallCenter( gadget, winFindImage( "ProgressBarEnabledSmallRepeatingCenter" ) ); - GadgetProgressBarSetEnabledBarColor( gadget, yellow ); - GadgetProgressBarSetEnabledBarBorderColor( gadget, white ); - GadgetProgressBarSetEnabledBarImageLeft( gadget, winFindImage( "ProgressBarEnabledBarLeftEnd" ) ); - GadgetProgressBarSetEnabledBarImageRight( gadget, winFindImage( "ProgressBarEnabledBarRightEnd" ) ); - GadgetProgressBarSetEnabledBarImageCenter( gadget, winFindImage( "ProgressBarEnabledBarRepeatingCenter" ) ); - GadgetProgressBarSetEnabledBarImageSmallCenter( gadget, winFindImage( "ProgressBarEnabledBarSmallRepeatingCenter" ) ); - - // disabled - GadgetProgressBarSetDisabledColor( gadget, darkGray ); - GadgetProgressBarSetDisabledBorderColor( gadget, lightGray ); - GadgetProgressBarSetDisabledImageLeft( gadget, winFindImage( "ProgressBarDisabledLeftEnd" ) ); - GadgetProgressBarSetDisabledImageRight( gadget, winFindImage( "ProgressBarDisabledRightEnd" ) ); - GadgetProgressBarSetDisabledImageCenter( gadget, winFindImage( "ProgressBarDisabledRepeatingCenter" ) ); - GadgetProgressBarSetDisabledImageSmallCenter( gadget, winFindImage( "ProgressBarDisabledSmallRepeatingCenter" ) ); - GadgetProgressBarSetDisabledBarColor( gadget, lightGray ); - GadgetProgressBarSetDisabledBarBorderColor( gadget, white ); - GadgetProgressBarSetDisabledBarImageLeft( gadget, winFindImage( "ProgressBarDisabledBarLeftEnd" ) ); - GadgetProgressBarSetDisabledBarImageRight( gadget, winFindImage( "ProgressBarDisabledBarRightEnd" ) ); - GadgetProgressBarSetDisabledBarImageCenter( gadget, winFindImage( "ProgressBarDisabledBarRepeatingCenter" ) ); - GadgetProgressBarSetDisabledBarImageSmallCenter( gadget, winFindImage( "ProgressBarDisabledBarSmallRepeatingCenter" ) ); - - // Hilite - GadgetProgressBarSetHiliteColor( gadget, green ); - GadgetProgressBarSetHiliteBorderColor( gadget, darkGreen ); - GadgetProgressBarSetHiliteImageLeft( gadget, winFindImage( "ProgressBarHiliteLeftEnd" ) ); - GadgetProgressBarSetHiliteImageRight( gadget, winFindImage( "ProgressBarHiliteRightEnd" ) ); - GadgetProgressBarSetHiliteImageCenter( gadget, winFindImage( "ProgressBarHiliteRepeatingCenter" ) ); - GadgetProgressBarSetHiliteImageSmallCenter( gadget, winFindImage( "ProgressBarHiliteSmallRepeatingCenter" ) ); - GadgetProgressBarSetHiliteBarColor( gadget, yellow ); - GadgetProgressBarSetHiliteBarBorderColor( gadget, white ); - GadgetProgressBarSetHiliteBarImageLeft( gadget, winFindImage( "ProgressBarHiliteBarLeftEnd" ) ); - GadgetProgressBarSetHiliteBarImageRight( gadget, winFindImage( "ProgressBarHiliteBarRightEnd" ) ); - GadgetProgressBarSetHiliteBarImageCenter( gadget, winFindImage( "ProgressBarHiliteBarRepeatingCenter" ) ); - GadgetProgressBarSetHiliteBarImageSmallCenter( gadget, winFindImage( "ProgressBarHiliteBarSmallRepeatingCenter" ) ); - - } - else if( BitIsSet( instData->getStyle(), GWS_STATIC_TEXT ) ) - { - - // enabled - GadgetStaticTextSetEnabledImage( gadget, winFindImage( "StaticTextEnabled" ) ); - GadgetStaticTextSetEnabledColor( gadget, red ); - GadgetStaticTextSetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetStaticTextSetDisabledImage( gadget, winFindImage( "StaticTextDisabled" ) ); - GadgetStaticTextSetDisabledColor( gadget, darkGray ); - GadgetStaticTextSetDisabledBorderColor( gadget, lightGray ); - - // hilite - GadgetStaticTextSetHiliteImage( gadget, winFindImage( "StaticTextHilite" ) ); - GadgetStaticTextSetHiliteColor( gadget, darkGreen ); - GadgetStaticTextSetHiliteBorderColor( gadget, lightGreen ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - else if( BitIsSet( instData->getStyle(), GWS_ENTRY_FIELD ) ) - { - - // enabled - GadgetTextEntrySetEnabledImageLeft( gadget, winFindImage( "TextEntryEnabledLeftEnd" ) ); - GadgetTextEntrySetEnabledImageRight( gadget, winFindImage( "TextEntryEnabledRightEnd" ) ); - GadgetTextEntrySetEnabledImageCenter( gadget, winFindImage( "TextEntryEnabledRepeatingCenter" ) ); - GadgetTextEntrySetEnabledImageSmallCenter( gadget, winFindImage( "TextEntryEnabledSmallRepeatingCenter" ) ); - GadgetTextEntrySetEnabledColor( gadget, red ); - GadgetTextEntrySetEnabledBorderColor( gadget, lightRed ); - - // disabled - GadgetTextEntrySetDisabledImageLeft( gadget, winFindImage( "TextEntryDisabledLeftEnd" ) ); - GadgetTextEntrySetDisabledImageRight( gadget, winFindImage( "TextEntryDisabledRightEnd" ) ); - GadgetTextEntrySetDisabledImageCenter( gadget, winFindImage( "TextEntryDisabledRepeatingCenter" ) ); - GadgetTextEntrySetDisabledImageSmallCenter( gadget, winFindImage( "TextEntryDisabledSmallRepeatingCenter" ) ); - GadgetTextEntrySetDisabledColor( gadget, gray ); - GadgetTextEntrySetDisabledBorderColor( gadget, black ); - - // hilited - GadgetTextEntrySetHiliteImageLeft( gadget, winFindImage( "TextEntryHiliteLeftEnd" ) ); - GadgetTextEntrySetHiliteImageRight( gadget, winFindImage( "TextEntryHiliteRightEnd" ) ); - GadgetTextEntrySetHiliteImageCenter( gadget, winFindImage( "TextEntryHiliteRepeatingCenter" ) ); - GadgetTextEntrySetHiliteImageSmallCenter( gadget, winFindImage( "TextEntryHiliteSmallRepeatingCenter" ) ); - GadgetTextEntrySetHiliteColor( gadget, green ); - GadgetTextEntrySetHiliteBorderColor( gadget, darkGreen ); - - // set default text colors for the gadget - gadget->winSetEnabledTextColors( enabledText, enabledTextBorder ); - gadget->winSetDisabledTextColors( disabledText, disabledTextBorder ); - gadget->winSetHiliteTextColors( hiliteText, hiliteTextBorder ); - gadget->winSetIMECompositeTextColors( imeCompositeText, imeCompositeTextBorder ); - - } - -} - -//------------------------------------------------------------------------------------------------- -/** Given a text label, retreive the real localized text associated - * with that label */ -//------------------------------------------------------------------------------------------------- -UnicodeString GameWindowManager::winTextLabelToText( AsciiString label ) -{ - - // sanity - if( label.isEmpty() ) - return UnicodeString::TheEmptyString; - - /// @todo we need to write the string manager here, this is TEMPORARY!!! - UnicodeString tmp; - tmp.translate(label); - return tmp; - -} - -//------------------------------------------------------------------------------------------------- -/** find the top window at the given coordinates */ -//------------------------------------------------------------------------------------------------- -GameWindow *GameWindowManager::getWindowUnderCursor( Int x, Int y, Bool ignoreEnabled ) -{ - if( m_mouseCaptor ) - { - // in what what window within the captured window are we? - return m_mouseCaptor->winPointInChild( x, y, ignoreEnabled ); - } - - if( m_grabWindow ) - { - // in what what window within the grabbed window are we? - return m_grabWindow->winPointInChild( x, y, ignoreEnabled ); - } - - GameWindow *window = nullptr; - if( m_modalHead && m_modalHead->window ) - { - return m_modalHead->window->winPointInChild( x, y, ignoreEnabled ); - } - else - { - // search for top-level window which contains pointer - for( window = m_windowList; window; window = window->m_next ) - { - - if( BitIsSet( window->m_status, WIN_STATUS_ABOVE ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - x >= window->m_region.lo.x && - x <= window->m_region.hi.x && - y >= window->m_region.lo.y && - y <= window->m_region.hi.y) - { - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) || ignoreEnabled ) - { - // determine which child window the mouse is in - window = window->winPointInChild( x, y, ignoreEnabled ); - break; // exit for - } - } - } - - // check !above, below and hidden - if( window == nullptr ) - { - for( window = m_windowList; window; window = window->m_next ) - { - if( !BitIsSet( window->m_status, WIN_STATUS_ABOVE | - WIN_STATUS_BELOW | - WIN_STATUS_HIDDEN ) && - x >= window->m_region.lo.x && - x <= window->m_region.hi.x && - y >= window->m_region.lo.y && - y <= window->m_region.hi.y) - { - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )|| ignoreEnabled) - { - // determine which child window the mouse is in - window = window->winPointInChild( x, y, ignoreEnabled ); - break; // exit for - } - } - } - } - - // check below and !hidden - if( window == nullptr ) - { - for( window = m_windowList; window; window = window->m_next ) - { - if( BitIsSet( window->m_status, WIN_STATUS_BELOW ) && - !BitIsSet( window->m_status, WIN_STATUS_HIDDEN ) && - x >= window->m_region.lo.x && - x <= window->m_region.hi.x && - y >= window->m_region.lo.y && - y <= window->m_region.hi.y) - { - if( BitIsSet( window->m_status, WIN_STATUS_ENABLED )|| ignoreEnabled) - { - // determine which child window the mouse is in - window = window->winPointInChild( x, y, ignoreEnabled ); - break; // exit for - } - } - } - } - } - - if( window ) - { - if( BitIsSet( window->m_status, WIN_STATUS_NO_INPUT )) - { - // this window does not accept input, discard - window = nullptr; - } - else if( ignoreEnabled && !( BitIsSet( window->m_status, WIN_STATUS_ENABLED ) )) - { - window = nullptr; - } - } - - return window; -} - -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -static WindowMsgHandledType testGrab( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - case GWM_LEFT_DOWN: return MSG_HANDLED; // use it - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** Just for testing */ -//------------------------------------------------------------------------------------------------- -Bool GameWindowManager::initTestGUI() -{ - -// winCreateFromScript( "_ATest.wnd" ); - return TRUE; - -// UnsignedByte alpha = 200; - GameWindow *window; - UnsignedInt statusFlags = WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE | WIN_STATUS_IMAGE; - WinInstanceData instData; - - // make some windows inside each other in the upper left - window = winCreate( nullptr, statusFlags, 0, 0, 100, 100, nullptr, nullptr ); - window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, winMakeColor( 255, 254, 255, 255 ) ); - window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); - window = winCreate( window, statusFlags, 10, 10, 50, 50, nullptr, nullptr ); - window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, winMakeColor( 128, 128, 128, 255 ) ); - window->winSetEnabledBorderColor( 0 , winMakeColor( 0, 0, 0, 255 ) ); - - // make a push button - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "What Up?"; - window = gogoGadgetPushButton( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 100, - 100, 30, - &instData, nullptr, TRUE ); - - // make a push button - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "Enabled"; - window = gogoGadgetPushButton( nullptr, - WIN_STATUS_ENABLED, - 330, 100, - 100, 30, - &instData, nullptr, TRUE ); - - // make a push button - instData.init(); - BitSet( instData.m_style, GWS_PUSH_BUTTON | GWS_MOUSE_TRACK ); - instData.m_textLabelString = "Disabled"; - window = gogoGadgetPushButton( nullptr, - 0, - 450, 100, - 100, 30, - &instData, nullptr, TRUE ); - - // make a check box - instData.init(); - instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( nullptr, - WIN_STATUS_ENABLED | - WIN_STATUS_IMAGE, - 200, 150, - 100, 30, - &instData, nullptr, TRUE ); - - // make a check box - instData.init(); - instData.m_style = GWS_CHECK_BOX | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Check"; - window = gogoGadgetCheckbox( nullptr, - WIN_STATUS_ENABLED, - 330, 150, - 100, 30, - &instData, nullptr, TRUE ); - - // make window to hold radio buttons - window = winCreate( nullptr, WIN_STATUS_ENABLED | WIN_STATUS_DRAGGABLE, - 200, 200, 250, 45, nullptr ); - window->winSetInputFunc( testGrab ); - window->winSetEnabledColor( 0, winMakeColor( 50, 50, 50, 200 ) ); - window->winSetEnabledBorderColor( 0, winMakeColor( 254, 254, 254, 255 ) ); - - // make a radio button - GameWindow *radio; - RadioButtonData rData; - instData.init(); - instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Mama Said!"; - rData.group = 1; - radio = gogoGadgetRadioButton( window, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 10, 10, - 100, 30, - &instData, - &rData, nullptr, TRUE ); - - // make a radio button - instData.init(); - instData.m_style = GWS_RADIO_BUTTON | GWS_MOUSE_TRACK; - instData.m_textLabelString = "On the Run"; - radio = gogoGadgetRadioButton( window, - WIN_STATUS_ENABLED, - 130, 10, - 100, 30, - &instData, - &rData, nullptr, TRUE ); - GadgetRadioSetEnabledColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); - GadgetRadioSetEnabledBorderColor( radio, GameMakeColor( 0, 0, 255, 255 ) ); - - // make a listbox - ListboxData listData; - memset( &listData, 0, sizeof( ListboxData ) ); - listData.listLength = 8; - listData.autoScroll = 1; - listData.scrollIfAtEnd = FALSE; - listData.autoPurge = 1; - listData.scrollBar = 1; - listData.multiSelect = 1; - listData.forceSelect = 0; - listData.columns = 1; - listData.columnWidth = nullptr; - instData.init(); - instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( nullptr, - WIN_STATUS_ENABLED, - 200, 250, - 100, 100, - &instData, - &listData, nullptr, TRUE ); - GadgetListBoxAddEntryText( window, L"Listbox text", - winMakeColor( 255, 255, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"More text", - winMakeColor( 105, 105, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Nothing", - winMakeColor( 105, 105, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Seasons", - winMakeColor( 105, 205, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Misery", - winMakeColor( 235, 105, 255, 255 ), -1, 0 ); - GadgetListBoxAddEntryText( window, L"Natural", - winMakeColor( 105, 205, 45, 255 ), -1, 0 ); - window->winSetFont( TheFontLibrary->getFont( "Times New Roman", 12, FALSE ) ); - - // make a listbox - memset( &listData, 0, sizeof( ListboxData ) ); - listData.listLength = 8; - listData.autoScroll = 1; - listData.scrollIfAtEnd = FALSE; - listData.autoPurge = 1; - listData.scrollBar = 1; - listData.multiSelect = 0; - listData.forceSelect = 0; - listData.columns = 1; - listData.columnWidth = nullptr; - instData.init(); - instData.m_style = GWS_SCROLL_LISTBOX | GWS_MOUSE_TRACK; - window = gogoGadgetListBox( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 75, 250, - 100, 100, - &instData, - &listData, nullptr, TRUE ); - GadgetListBoxAddEntryText( window, L"Listbox text", - winMakeColor( 255, 255, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"More text", - winMakeColor( 105, 105, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Nothing", - winMakeColor( 105, 105, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Seasons", - winMakeColor( 105, 205, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Misery", - winMakeColor( 235, 105, 255, 255 ), -1, -1 ); - GadgetListBoxAddEntryText( window, L"Natural", - winMakeColor( 105, 205, 45, 255 ), -1, -1 ); - - // make a vert slider - SliderData sliderData; - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED, - 360, 250, - 11, 100, - &instData, - &sliderData, nullptr, TRUE ); - - // make a vert slider - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_VERT_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 400, 250, - 11, 100, - &instData, - &sliderData, nullptr, TRUE ); - - // make a horizontal slider - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED, - 200, 400, - 200, 11, - &instData, - &sliderData, nullptr, TRUE ); - - // make a horizontal slider - memset( &sliderData, 0, sizeof( sliderData ) ); - sliderData.maxVal = 100; - sliderData.minVal = 0; - sliderData.numTicks = 100; - sliderData.position = 0; - instData.init(); - instData.m_style = GWS_HORZ_SLIDER | GWS_MOUSE_TRACK; - window = gogoGadgetSlider( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 420, - 200, 11, - &instData, - &sliderData, nullptr, TRUE ); - - // make a progress bar - instData.init(); - instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( nullptr, - WIN_STATUS_ENABLED, - 200, 450, - 250, 15, - &instData, nullptr, TRUE ); - - // make a progress bar - instData.init(); - instData.m_style = GWS_PROGRESS_BAR | GWS_MOUSE_TRACK; - window = gogoGadgetProgressBar( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 470, - 250, 15, - &instData, nullptr, TRUE ); - - // make some static text - TextData textData; - textData.centered = 1; - instData.init(); - instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Centered Static Text"; - window = gogoGadgetStaticText( nullptr, - WIN_STATUS_ENABLED, - 200, 490, - 300, 25, - &instData, - &textData, nullptr, TRUE ); - - // make some static text - textData.centered = 0; - instData.init(); - instData.m_style = GWS_STATIC_TEXT | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Not Centered Static Text"; - window = gogoGadgetStaticText( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 200, 520, - 300, 25, - &instData, - &textData, nullptr, TRUE ); - window->winSetEnabledTextColors( winMakeColor( 128, 128, 255, 255 ), - winMakeColor( 255, 255, 255, 255 ) ); - - // make some entry text - EntryData entryData; - memset( &entryData, 0, sizeof( entryData ) ); - entryData.maxTextLen = 30; - instData.init(); - instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( nullptr, - WIN_STATUS_ENABLED, - 450, 270, - 400, 30, - &instData, - &entryData, nullptr, TRUE ); - - // make some entry text - memset( &entryData, 0, sizeof( entryData ) ); - entryData.maxTextLen = 30; - instData.init(); - instData.m_style = GWS_ENTRY_FIELD | GWS_MOUSE_TRACK; - instData.m_textLabelString = "Entry"; - window = gogoGadgetTextEntry( nullptr, - WIN_STATUS_ENABLED | WIN_STATUS_IMAGE, - 450, 310, - 400, 30, - &instData, - &entryData, nullptr, TRUE ); - - return TRUE; - -} - - -void GameWindowManager::winNextTab( GameWindow *window ) -{ - if(m_tabList.empty()|| m_modalHead) - return; - - GameWindowList::iterator it = m_tabList.begin(); - while( it != m_tabList.end()) - { - if(*it == window) - { - it++; - break; - } - it++; - } - if(it != m_tabList.end()) - winSetFocus(*it); - else - { - winSetFocus(*m_tabList.begin()); - } - winSetLoneWindow(nullptr); -} - -void GameWindowManager::winPrevTab( GameWindow *window ) -{ - if(m_tabList.empty() || m_modalHead) - return; - - GameWindowList::reverse_iterator it = m_tabList.rbegin(); - while( it != m_tabList.rend()) - { - if(*it == window) - { - it++; - break; - } - it++; - } - if(it != m_tabList.rend()) - winSetFocus(*it); - else - { - winSetFocus(*m_tabList.rbegin()); - } - winSetLoneWindow(nullptr); -} - -void GameWindowManager::registerTabList( GameWindowList tabList ) -{ - m_tabList.clear(); - m_tabList = tabList; -} - -void GameWindowManager::clearTabList() -{ - m_tabList.clear(); -} - - -GameWindow *GameWindowManagerDummy::winGetWindowFromId(GameWindow *window, Int id) -{ - window = GameWindowManager::winGetWindowFromId(window, id); - if (window != nullptr) - return window; - - // Just return any window, callers expect this to be non-null - return m_windowList; -} - -WindowMsgHandledType DummyWindowSystem(GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2) -{ - return MSG_IGNORED; -} - -GameWindow *GameWindowManagerDummy::winCreateFromScript(AsciiString filenameString, WindowLayoutInfo *info) -{ - WindowLayoutInfo scriptInfo; - GameWindow* dummyWindow = winCreate(nullptr, 0, 0, 0, 100, 100, DummyWindowSystem, nullptr); - scriptInfo.windows.push_back(dummyWindow); - if (info) - *info = scriptInfo; - return dummyWindow; -} - -GameWindowDummy::~GameWindowDummy() -{ -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp b/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp deleted file mode 100644 index fb657816171..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GameClientDispatch.cpp +++ /dev/null @@ -1,56 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: .cpp ///////////////////////////////////////////////////////////////////////////////////// -// Author: Colin Day -// Description: Game Client message dispatcher -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/MessageStream.h" -#include "GameClient/GameClient.h" - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -/** The Client message dispatcher, this is the last "translator" on the message - * stream before the messages go to the network for processing. It gives - * the client itself the opportunity to respond to any messages on the stream - * or create new ones to pass along to the network and logic */ -GameMessageDisposition GameClientMessageDispatcher::translateGameMessage(const GameMessage *msg) -{ - if (msg->getType() >= GameMessage::MSG_BEGIN_NETWORK_MESSAGES && msg->getType() <= GameMessage::MSG_END_NETWORK_MESSAGES) - return KEEP_MESSAGE; - if (msg->getType() == GameMessage::MSG_NEW_GAME || msg->getType() == GameMessage::MSG_CLEAR_GAME_DATA) - return KEEP_MESSAGE; - - if (msg->getType() == GameMessage::MSG_FRAME_TICK) - return KEEP_MESSAGE; - - //DEBUG_LOG(("GameClientMessageDispatcher::translateGameMessage() - eating a %s on frame %d", - //((GameMessage *)msg)->getCommandAsString(), TheGameClient->getFrame())); - - return DESTROY_MESSAGE; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp b/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp deleted file mode 100644 index 63af29ea6fd..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/MessageStream/HotKey.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: HotKey.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: HotKey.cpp -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/HotKey.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/MetaEvent.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Keyboard.h" -#include "GameClient/GameText.h" -#include "Common/AudioEventRTS.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -GameMessageDisposition HotKeyTranslator::translateGameMessage(const GameMessage *msg) -{ - GameMessageDisposition disp = KEEP_MESSAGE; - GameMessage::Type t = msg->getType(); - - if ( t == GameMessage::MSG_RAW_KEY_UP) - { - - //char key = msg->getArgument(0)->integer; - Int keyState = msg->getArgument(1)->integer; - - // for our purposes here, we don't care to distinguish between right and left keys, - // so just fudge a little to simplify things. - Int newModState = 0; - - if( keyState & KEY_STATE_CONTROL ) - { - newModState |= CTRL; - } - - if( keyState & KEY_STATE_SHIFT ) - { - newModState |= SHIFT; - } - - if( keyState & KEY_STATE_ALT ) - { - newModState |= ALT; - } - if(newModState != 0) - return disp; - WideChar key = TheKeyboard->getPrintableKey((KeyDefType)msg->getArgument(0)->integer, 0); - UnicodeString uKey; - uKey.concat(key); - AsciiString aKey; - aKey.translate(uKey); - if(TheHotKeyManager && TheHotKeyManager->executeHotKey(aKey)) - disp = DESTROY_MESSAGE; - } - return disp; -} - -//----------------------------------------------------------------------------- -HotKey::HotKey() -{ - m_win = nullptr; - m_key.clear(); -} - -//----------------------------------------------------------------------------- -HotKeyManager::HotKeyManager() -{ - -} - -//----------------------------------------------------------------------------- -HotKeyManager::~HotKeyManager() -{ - m_hotKeyMap.clear(); -} - -//----------------------------------------------------------------------------- -void HotKeyManager::init() -{ - m_hotKeyMap.clear(); -} - -//----------------------------------------------------------------------------- -void HotKeyManager::reset() -{ - m_hotKeyMap.clear(); -} - -//----------------------------------------------------------------------------- -void HotKeyManager::addHotKey( GameWindow *win, const AsciiString& keyIn) -{ - AsciiString key = keyIn; - key.toLower(); - HotKeyMap::iterator it = m_hotKeyMap.find(key); - if( it != m_hotKeyMap.end() ) - { - DEBUG_CRASH(("Hotkey %s is already mapped to window %s, current window is %s", key.str(), it->second.m_win->winGetInstanceData()->m_decoratedNameString.str(), win->winGetInstanceData()->m_decoratedNameString.str())); - return; - } - HotKey newHK; - newHK.m_key.set(key); - newHK.m_win = win; - m_hotKeyMap[key] = newHK; -} - -//----------------------------------------------------------------------------- -Bool HotKeyManager::executeHotKey( const AsciiString& keyIn ) -{ - AsciiString key = keyIn; - key.toLower(); - HotKeyMap::iterator it = m_hotKeyMap.find(key); - if( it == m_hotKeyMap.end() ) - return FALSE; - GameWindow *win = it->second.m_win; - if( !win ) - return FALSE; - if( !BitIsSet( win->winGetStatus(), WIN_STATUS_HIDDEN ) ) - { - if( BitIsSet( win->winGetStatus(), WIN_STATUS_ENABLED ) ) - { - TheWindowManager->winSendSystemMsg( win->winGetParent(), GBM_SELECTED, (WindowMsgData)win, win->winGetWindowId() ); - - // here we make the same click sound that the GUI uses when you click a button - AudioEventRTS buttonClick("GUIClick"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - return TRUE; - } - - AudioEventRTS disabledClick( "GUIClickDisabled" ); - if( TheAudio ) - { - TheAudio->addAudioEvent( &disabledClick ); - } - } - return FALSE; -} - -//----------------------------------------------------------------------------- -AsciiString HotKeyManager::searchHotKey( const AsciiString& label) -{ - return searchHotKey(TheGameText->fetch(label)); -} - -//----------------------------------------------------------------------------- -AsciiString HotKeyManager::searchHotKey( const UnicodeString& uStr ) -{ - if(uStr.isEmpty()) - return AsciiString::TheEmptyString; - - const WideChar *marker = (const WideChar *)uStr.str(); - while (marker && *marker) - { - if (*marker == L'&') - { - // found a '&' - now look for the next char - UnicodeString tmp = UnicodeString::TheEmptyString; - tmp.concat(*(marker+1)); - AsciiString retStr; - retStr.translate(tmp); - return retStr; - } - marker++; - } - return AsciiString::TheEmptyString; -} - -//----------------------------------------------------------------------------- -HotKeyManager *TheHotKeyManager = nullptr; - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index e397fe32d5b..1f4ce0de287 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -135,7 +135,7 @@ set(GAMEENGINE_SRC # Include/Common/XferLoad.h # Include/Common/XferSave.h # Include/GameClient/Anim2D.h - Include/GameClient/AnimateWindowManager.h +# Include/GameClient/AnimateWindowManager.h Include/GameClient/CampaignManager.h # Include/GameClient/ChallengeGenerals.h # Include/GameClient/ClientInstance.h @@ -157,7 +157,7 @@ set(GAMEENGINE_SRC # Include/GameClient/DrawGroupInfo.h Include/GameClient/EstablishConnectionsMenu.h Include/GameClient/Eva.h - Include/GameClient/ExtendedMessageBox.h +# Include/GameClient/ExtendedMessageBox.h Include/GameClient/FontDesc.h # Include/GameClient/FXList.h Include/GameClient/Gadget.h @@ -177,8 +177,8 @@ set(GAMEENGINE_SRC # Include/GameClient/GameText.h # Include/GameClient/GameWindow.h # Include/GameClient/GameWindowGlobal.h - Include/GameClient/GameWindowID.h - Include/GameClient/GameWindowManager.h +# Include/GameClient/GameWindowID.h +# Include/GameClient/GameWindowManager.h # Include/GameClient/GameWindowTransitions.h # Include/GameClient/GlobalLanguage.h # Include/GameClient/GraphDraw.h @@ -186,7 +186,7 @@ set(GAMEENGINE_SRC Include/GameClient/GUICommandTranslator.h # Include/GameClient/HeaderTemplate.h Include/GameClient/HintSpy.h - Include/GameClient/HotKey.h +# Include/GameClient/HotKey.h # Include/GameClient/Image.h # Include/GameClient/IMEManager.h Include/GameClient/InGameUI.h @@ -197,7 +197,7 @@ set(GAMEENGINE_SRC # Include/GameClient/LoadScreen.h Include/GameClient/LookAtXlat.h # Include/GameClient/MapUtil.h - Include/GameClient/MessageBox.h +# Include/GameClient/MessageBox.h Include/GameClient/MetaEvent.h # Include/GameClient/Module/AnimatedParticleSysBoneClientUpdate.h # Include/GameClient/Module/BeaconClientUpdate.h @@ -690,11 +690,11 @@ set(GAMEENGINE_SRC Source/GameClient/Eva.cpp # Source/GameClient/FXList.cpp Source/GameClient/GameClient.cpp - Source/GameClient/GameClientDispatch.cpp +# Source/GameClient/GameClientDispatch.cpp # Source/GameClient/GameText.cpp # Source/GameClient/GlobalLanguage.cpp # Source/GameClient/GraphDraw.cpp - Source/GameClient/GUI/AnimateWindowManager.cpp +# Source/GameClient/GUI/AnimateWindowManager.cpp # Source/GameClient/GUI/ChallengeGenerals.cpp Source/GameClient/GUI/ControlBar/ControlBar.cpp Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp @@ -724,14 +724,14 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GameFont.cpp # Source/GameClient/GUI/GameWindow.cpp # Source/GameClient/GUI/GameWindowGlobal.cpp - Source/GameClient/GUI/GameWindowManager.cpp +# Source/GameClient/GUI/GameWindowManager.cpp Source/GameClient/GUI/GameWindowManagerScript.cpp # Source/GameClient/GUI/GameWindowTransitions.cpp Source/GameClient/GUI/GameWindowTransitionsStyles.cpp Source/GameClient/GUI/GUICallbacks/ControlBarCallback.cpp Source/GameClient/GUI/GUICallbacks/ControlBarPopupDescription.cpp Source/GameClient/GUI/GUICallbacks/Diplomacy.cpp - Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp Source/GameClient/GUI/GUICallbacks/InGameChat.cpp @@ -777,7 +777,7 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GUICallbacks/Menus/WOLQuickMatchMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLStatusMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/WOLWelcomeMenu.cpp - Source/GameClient/GUI/GUICallbacks/MessageBox.cpp +# Source/GameClient/GUI/GUICallbacks/MessageBox.cpp Source/GameClient/GUI/GUICallbacks/ReplayControls.cpp # Source/GameClient/GUI/HeaderTemplate.cpp # Source/GameClient/GUI/IMEManager.cpp @@ -797,7 +797,7 @@ set(GAMEENGINE_SRC Source/GameClient/MessageStream/CommandXlat.cpp Source/GameClient/MessageStream/GUICommandTranslator.cpp Source/GameClient/MessageStream/HintSpy.cpp - Source/GameClient/MessageStream/HotKey.cpp +# Source/GameClient/MessageStream/HotKey.cpp Source/GameClient/MessageStream/LookAtXlat.cpp Source/GameClient/MessageStream/MetaEvent.cpp Source/GameClient/MessageStream/PlaceEventTranslator.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index 1b03fd19f12..d7c9a72fb88 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -492,6 +492,19 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp", Game.CORE, "GameEngine/Source/GameClient/Drawable/Update/SwayClientUpdate.cpp") #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/Module/SwayClientUpdate.h", Game.CORE, "GameEngine/Include/GameClient/Module/SwayClientUpdate.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/AnimateWindowManager.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/AnimateWindowManager.h", Game.CORE, "GameEngine/Include/GameClient/AnimateWindowManager.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GameWindowManager.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GameWindowManager.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GameWindowManager.h", Game.CORE, "GameEngine/Include/GameClient/GameWindowManager.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GUICallbacks/MessageBox.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/MessageBox.h", Game.CORE, "GameEngine/Include/GameClient/MessageBox.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ExtendedMessageBox.h", Game.CORE, "GameEngine/Include/GameClient/ExtendedMessageBox.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GameClientDispatch.cpp", Game.CORE, "GameEngine/Source/GameClient/GameClientDispatch.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/MessageStream/HotKey.cpp", Game.CORE, "GameEngine/Source/GameClient/MessageStream/HotKey.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/HotKey.h", Game.CORE, "GameEngine/Include/GameClient/HotKey.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GameWindowID.h", Game.CORE, "GameEngine/Include/GameClient/GameWindowID.h") + return From 7c8c39494dbec3396354e46c3d9cbfc89d545c2a Mon Sep 17 00:00:00 2001 From: DevGeniusCode <136935333+DevGeniusCode@users.noreply.github.com> Date: Mon, 20 Apr 2026 21:23:00 +0300 Subject: [PATCH 2/3] unify(client): Move Control Bar and basic gadgets to Core (#2618) --- Core/GameEngine/CMakeLists.txt | 30 +- .../Include/GameClient/ControlBarResizer.h | 0 .../Include/GameClient/GadgetCheckBox.h | 0 .../Include/GameClient/GadgetComboBox.h | 0 .../Include/GameClient/GadgetListBox.h | 0 .../Include/GameClient/GadgetProgressBar.h | 0 .../Include/GameClient/GadgetPushButton.h | 0 .../GUI/ControlBar/ControlBarMultiSelect.cpp | 0 .../GUI/ControlBar/ControlBarObserver.cpp | 0 .../ControlBar/ControlBarPrintPositions.cpp | 0 .../GUI/ControlBar/ControlBarResizer.cpp | 0 .../ControlBarUnderConstruction.cpp | 0 .../GameClient/GUI/Gadget/GadgetCheckBox.cpp | 0 .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 0 .../GameClient/GUI/Gadget/GadgetListBox.cpp | 0 .../GUI/Gadget/GadgetProgressBar.cpp | 0 Generals/Code/GameEngine/CMakeLists.txt | 30 +- .../Include/GameClient/ControlBarResizer.h | 102 - .../Include/GameClient/GadgetCheckBox.h | 139 - .../Include/GameClient/GadgetComboBox.h | 192 -- .../Include/GameClient/GadgetListBox.h | 208 -- .../Include/GameClient/GadgetProgressBar.h | 140 - .../Include/GameClient/GadgetPushButton.h | 171 - .../GUI/ControlBar/ControlBarMultiSelect.cpp | 427 --- .../GUI/ControlBar/ControlBarObserver.cpp | 383 --- .../ControlBar/ControlBarPrintPositions.cpp | 104 - .../GUI/ControlBar/ControlBarResizer.cpp | 245 -- .../ControlBarUnderConstruction.cpp | 123 - .../GameClient/GUI/Gadget/GadgetCheckBox.cpp | 376 --- .../GameClient/GUI/Gadget/GadgetComboBox.cpp | 1107 ------- .../GameClient/GUI/Gadget/GadgetListBox.cpp | 2825 ----------------- .../GUI/Gadget/GadgetProgressBar.cpp | 118 - GeneralsMD/Code/GameEngine/CMakeLists.txt | 30 +- scripts/cpp/unify_move_files.py | 16 + 34 files changed, 61 insertions(+), 6705 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/ControlBarResizer.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetCheckBox.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetComboBox.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetListBox.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetProgressBar.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetPushButton.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/GameClient/ControlBarResizer.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index b1499ffa387..44dc742d056 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -150,7 +150,7 @@ set(GAMEENGINE_SRC Include/GameClient/Color.h # Include/GameClient/CommandXlat.h # Include/GameClient/ControlBar.h -# Include/GameClient/ControlBarResizer.h + Include/GameClient/ControlBarResizer.h # Include/GameClient/ControlBarScheme.h Include/GameClient/Credits.h Include/GameClient/DebugDisplay.h @@ -168,11 +168,11 @@ set(GAMEENGINE_SRC # Include/GameClient/FontDesc.h Include/GameClient/FXList.h # Include/GameClient/Gadget.h -# Include/GameClient/GadgetCheckBox.h -# Include/GameClient/GadgetComboBox.h -# Include/GameClient/GadgetListBox.h -# Include/GameClient/GadgetProgressBar.h -# Include/GameClient/GadgetPushButton.h + Include/GameClient/GadgetCheckBox.h + Include/GameClient/GadgetComboBox.h + Include/GameClient/GadgetListBox.h + Include/GameClient/GadgetProgressBar.h + Include/GameClient/GadgetPushButton.h # Include/GameClient/GadgetRadioButton.h # Include/GameClient/GadgetSlider.h # Include/GameClient/GadgetStaticText.h @@ -715,21 +715,21 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp # Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp # Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp -# Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp -# Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp + Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp + Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp # Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp -# Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp -# Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp + Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp + Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp # Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp # Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp -# Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp + Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp # Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp # Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp -# Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp -# Source/GameClient/GUI/Gadget/GadgetComboBox.cpp + Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp + Source/GameClient/GUI/Gadget/GadgetComboBox.cpp # Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp -# Source/GameClient/GUI/Gadget/GadgetListBox.cpp -# Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp + Source/GameClient/GUI/Gadget/GadgetListBox.cpp + Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp # Source/GameClient/GUI/Gadget/GadgetPushButton.cpp # Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp # Source/GameClient/GUI/Gadget/GadgetStaticText.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarResizer.h b/Core/GameEngine/Include/GameClient/ControlBarResizer.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/ControlBarResizer.h rename to Core/GameEngine/Include/GameClient/ControlBarResizer.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetCheckBox.h b/Core/GameEngine/Include/GameClient/GadgetCheckBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetCheckBox.h rename to Core/GameEngine/Include/GameClient/GadgetCheckBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h b/Core/GameEngine/Include/GameClient/GadgetComboBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetComboBox.h rename to Core/GameEngine/Include/GameClient/GadgetComboBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h b/Core/GameEngine/Include/GameClient/GadgetListBox.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetListBox.h rename to Core/GameEngine/Include/GameClient/GadgetListBox.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetProgressBar.h b/Core/GameEngine/Include/GameClient/GadgetProgressBar.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetProgressBar.h rename to Core/GameEngine/Include/GameClient/GadgetProgressBar.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h b/Core/GameEngine/Include/GameClient/GadgetPushButton.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetPushButton.h rename to Core/GameEngine/Include/GameClient/GadgetPushButton.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp rename to Core/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 304a5fc104e..041759c9b0f 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -137,7 +137,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Color.h Include/GameClient/CommandXlat.h Include/GameClient/ControlBar.h - Include/GameClient/ControlBarResizer.h +# Include/GameClient/ControlBarResizer.h Include/GameClient/ControlBarScheme.h # Include/GameClient/Credits.h # Include/GameClient/DebugDisplay.h @@ -155,11 +155,11 @@ set(GAMEENGINE_SRC Include/GameClient/FontDesc.h # Include/GameClient/FXList.h Include/GameClient/Gadget.h - Include/GameClient/GadgetCheckBox.h - Include/GameClient/GadgetComboBox.h - Include/GameClient/GadgetListBox.h - Include/GameClient/GadgetProgressBar.h - Include/GameClient/GadgetPushButton.h +# Include/GameClient/GadgetCheckBox.h +# Include/GameClient/GadgetComboBox.h +# Include/GameClient/GadgetListBox.h +# Include/GameClient/GadgetProgressBar.h +# Include/GameClient/GadgetPushButton.h Include/GameClient/GadgetRadioButton.h Include/GameClient/GadgetSlider.h Include/GameClient/GadgetStaticText.h @@ -659,21 +659,21 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp - Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp - Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +# Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +# Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp - Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp - Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +# Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +# Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp - Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +# Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp - Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp - Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +# Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +# Source/GameClient/GUI/Gadget/GadgetComboBox.cpp Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp - Source/GameClient/GUI/Gadget/GadgetListBox.cpp - Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +# Source/GameClient/GUI/Gadget/GadgetListBox.cpp +# Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp Source/GameClient/GUI/Gadget/GadgetPushButton.cpp Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp Source/GameClient/GUI/Gadget/GadgetStaticText.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/ControlBarResizer.h b/Generals/Code/GameEngine/Include/GameClient/ControlBarResizer.h deleted file mode 100644 index 8617d7da0e8..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/ControlBarResizer.h +++ /dev/null @@ -1,102 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarResizer.h ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: ControlBarResizer.h -// -// author: Chris Huybregts -// -// purpose: -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// TYPE DEFINES /////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -class ResizerWindow -{ -public: -ResizerWindow(); - AsciiString m_name; - ICoord2D m_defaultSize; - ICoord2D m_defaultPos; - ICoord2D m_altSize; - ICoord2D m_altPos; -}; - -class ControlBarResizer -{ -public: - ControlBarResizer(); - ~ControlBarResizer(); - - void init(); - - // parse Functions for the INI file - const FieldParse *getFieldParse() const { return m_controlBarResizerParseTable; } ///< returns the parsing fields - static const FieldParse m_controlBarResizerParseTable[]; ///< the parse table - - ResizerWindow *findResizerWindow( AsciiString name ); ///< attempt to find the control bar scheme by it's name - ResizerWindow *newResizerWindow( AsciiString name ); ///< create a new control bar scheme and return it. - - void sizeWindowsDefault(); - void sizeWindowsAlt(); - - typedef std::list< ResizerWindow *> ResizerWindowList; - ResizerWindowList m_resizerWindowsList; - -}; -//----------------------------------------------------------------------------- -// INLINING /////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// EXTERNALS ////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h deleted file mode 100644 index 8c7ef8334ca..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetCheckBox.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetCheckBox.h ///////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetCheckBox.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for checkboxes -// -// CheckBox IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// enabledDrawData[ 1 ] is the enabled, unselected check box -// enabledDrawData[ 2 ] is the enabled, selected check box -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// disabledDrawData[ 1 ] is the disabled, unselected check box -// disabledDrawData[ 2 ] si the disabled, selected check box -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// hiliteDrawData[ 1 ] is the hilited, unselected check box -// hiliteDrawData[ 2 ] is the hilited, selected check box -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ); -extern Bool GadgetCheckBoxIsChecked( GameWindow *g ); -extern void GadgetCheckBoxSetChecked( GameWindow *g, Bool isChecked); -extern void GadgetCheckBoxToggle( GameWindow *g); - -inline void GadgetCheckBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetCheckBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetCheckBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetCheckBoxSetEnabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetCheckBoxSetEnabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetCheckBoxSetEnabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline void GadgetCheckBoxSetEnabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetCheckBoxSetEnabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 2, color ); } -inline void GadgetCheckBoxSetEnabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 2, color ); } -inline const Image *GadgetCheckBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetCheckBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetCheckBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetCheckBoxGetEnabledUncheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline Color GadgetCheckBoxGetEnabledUncheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetCheckBoxGetEnabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } -inline const Image *GadgetCheckBoxGetEnabledCheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline Color GadgetCheckBoxGetEnabledCheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 2 ); } -inline Color GadgetCheckBoxGetEnabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 2 ); } - -inline void GadgetCheckBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetCheckBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetCheckBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetCheckBoxSetDisabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetCheckBoxSetDisabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetCheckBoxSetDisabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline void GadgetCheckBoxSetDisabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetCheckBoxSetDisabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 2, color ); } -inline void GadgetCheckBoxSetDisabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 2, color ); } -inline const Image *GadgetCheckBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetCheckBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetCheckBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetCheckBoxGetDisabledUncheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline Color GadgetCheckBoxGetDisabledUncheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetCheckBoxGetDisabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } -inline const Image *GadgetCheckBoxGetDisabledCheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline Color GadgetCheckBoxGetDisabledCheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 2 ); } -inline Color GadgetCheckBoxGetDisabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 2 ); } - -inline void GadgetCheckBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetCheckBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetCheckBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetCheckBoxSetHiliteUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetCheckBoxSetHiliteUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetCheckBoxSetHiliteUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline void GadgetCheckBoxSetHiliteCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetCheckBoxSetHiliteCheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 2, color ); } -inline void GadgetCheckBoxSetHiliteCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 2, color ); } -inline const Image *GadgetCheckBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetCheckBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetCheckBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetCheckBoxGetHiliteUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline Color GadgetCheckBoxGetHiliteUncheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetCheckBoxGetHiliteUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } -inline const Image *GadgetCheckBoxGetHiliteCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline Color GadgetCheckBoxGetHiliteCheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 2 ); } -inline Color GadgetCheckBoxGetHiliteCheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 2 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h deleted file mode 100644 index 51589981437..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetComboBox.h +++ /dev/null @@ -1,192 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetComboBox.h ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetComboBox.h -// -// Created: Chris Huybregts, November 2001 -// -// Desc: Helpful interface for ComboBoxes -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/Gadget.h" -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ); -extern UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ); -extern void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ); -extern Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color ); -extern void GadgetComboBoxReset( GameWindow *comboBox ); - -extern void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide = FALSE ); -extern void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ); -extern void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data ); -extern void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index ); -extern Int GadgetComboBoxGetLength( GameWindow *comboBox ); - -extern void GadgetComboBoxHideList( GameWindow *comboBox ); -// Functions that set the ComboBoxData Parameters -extern void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ); -extern void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly ); -extern void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ); -extern void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ); -extern void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ); - -//setup all the Font Colors -extern void GadgetComboBoxSetEnabledTextColors( GameWindow *comboBox,Color color, Color borderColor ); -extern void GadgetComboBoxSetDisabledTextColors( GameWindow *comboBox,Color color, Color borderColor ); -extern void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor ); -extern void GadgetComboBoxSetIMECompositeTextColors( GameWindow *comboBox, Color color, Color borderColor ); - -// -// you can use this to set the colors for the list box all at once, note that -// it will also automatically change the colors for any attached slider -// and those slider buttons and thumb as well as the drop down button and edit box. -// -extern void GadgetComboBoxSetColors( GameWindow *comboBox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ); - -inline void GadgetComboBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetComboBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetComboBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } -inline void GadgetComboBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetComboBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline const Image *GadgetComboBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetComboBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetComboBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline const Image *GadgetComboBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); } -inline Color GadgetComboBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetComboBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } - -inline void GadgetComboBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetComboBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetComboBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } -inline void GadgetComboBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetComboBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline const Image *GadgetComboBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetComboBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetComboBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline const Image *GadgetComboBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } -inline Color GadgetComboBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetComboBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } - -inline void GadgetComboBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetComboBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetComboBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } -inline void GadgetComboBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetComboBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline const Image *GadgetComboBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetComboBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetComboBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetComboBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline Color GadgetComboBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetComboBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } - -inline GameWindow *GadgetComboBoxGetDropDownButton( GameWindow *g ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData(); - - if( comboBoxData && comboBoxData->dropDownButton ) - return comboBoxData->dropDownButton; - return nullptr; -} -inline GameWindow *GadgetComboBoxGetListBox( GameWindow *g ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData(); - - if( comboBoxData && comboBoxData->listBox) - return comboBoxData->listBox; - return nullptr; - -} - -inline GameWindow *GadgetComboBoxGetEditBox( GameWindow *g ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)g->winGetUserData(); - - if( comboBoxData && comboBoxData->editBox) - return comboBoxData->editBox; - return nullptr; - -} - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h b/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h deleted file mode 100644 index d6349031d8b..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetListBox.h +++ /dev/null @@ -1,208 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetListBox.h ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetListBox.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for ListBoxes -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/Gadget.h" -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -typedef struct _RightClickStruct -{ - Int mouseX; - Int mouseY; - Int pos; -} RightClickStruct; - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -extern Int GadgetListBoxGetEntryBasedOnXY( GameWindow *listbox, Int x, Int y, Int &row, Int &column); -extern void GadgetListboxCreateScrollbar( GameWindow *listbox ); -extern void GadgetListBoxAddMultiSelect( GameWindow *listbox ); -extern void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ); -extern void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ); -extern Int GadgetListBoxGetListLength( GameWindow *listbox ); ///< Returns the maximum possible number of list entries. Length is synonymous to rows -extern Int GadgetListBoxGetMaxSelectedLength( GameWindow *listbox ); ///< Returns the maximum possible number of list entries that can be selected -extern Int GadgetListBoxGetNumEntries( GameWindow *listbox ); -extern Int GadgetListBoxGetNumColumns( GameWindow *listbox ); -extern Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column ); - -extern void GadgetListBoxSetFont( GameWindow *listbox, GameFont *font ); -extern UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column = 0); -extern UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, Int row, Int column = 0); -extern Int GadgetListBoxAddEntryText( GameWindow *listbox, UnicodeString text, Color color, Int row, Int column = -1, Bool overwrite = TRUE); -extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column = -1, - Bool overwrite = TRUE, Color color = 0xFFFFFFFF ); -extern Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column, - Int hight, Int width, - Bool overwrite = TRUE, Color color = 0xFFFFFFFF ); -extern void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ); -extern void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount = 1 ); -extern void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ); -extern void GadgetListBoxReset( GameWindow *listbox ); -extern void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int column = 0); -extern void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column = 0); - -extern bool GadgetListBoxIsFull(GameWindow *window); - -extern Int GadgetListBoxGetBottomVisibleEntry( GameWindow *window ); -extern void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos ); - -extern Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ); -extern void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ); - -extern void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable ); - -// -// you can use this to set the colors for the list box all at once, note that -// it will also automatically change the colors for any attached slider -// and those slider buttons and thumb -// -extern void GadgetListBoxSetColors( GameWindow *listbox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ); - -inline void GadgetListBoxSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetListBoxSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetListBoxSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetListBoxSetEnabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetListBoxSetEnabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetListBoxSetEnabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetListBoxSetEnabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } -inline void GadgetListBoxSetEnabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetListBoxSetEnabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline const Image *GadgetListBoxGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetListBoxGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetListBoxGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageRight( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline const Image *GadgetListBoxGetEnabledSelectedItemImageSmallCenter( GameWindow *g ){ return g->winGetEnabledImage( 4 ); } -inline Color GadgetListBoxGetEnabledSelectedItemColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetListBoxGetEnabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } - -inline void GadgetListBoxSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetListBoxSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetListBoxSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetListBoxSetDisabledSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetListBoxSetDisabledSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetListBoxSetDisabledSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetListBoxSetDisabledSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } -inline void GadgetListBoxSetDisabledSelectedItemColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetListBoxSetDisabledSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline const Image *GadgetListBoxGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetListBoxGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetListBoxGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageRight( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline const Image *GadgetListBoxGetDisabledSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } -inline Color GadgetListBoxGetDisabledSelectedItemColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetListBoxGetDisabledSelectedItemBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } - -inline void GadgetListBoxSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetListBoxSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetListBoxSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetListBoxSetHiliteSelectedItemImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetListBoxSetHiliteSelectedItemImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetListBoxSetHiliteSelectedItemImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetListBoxSetHiliteSelectedItemImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } -inline void GadgetListBoxSetHiliteSelectedItemColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetListBoxSetHiliteSelectedItemBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline const Image *GadgetListBoxGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetListBoxGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetListBoxGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageRight( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetListBoxGetHiliteSelectedItemImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline Color GadgetListBoxGetHiliteSelectedItemColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetListBoxGetHiliteSelectedItemBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } - -inline GameWindow *GadgetListBoxGetSlider( GameWindow *g ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - - if( listData && listData->slider ) - return listData->slider; - return nullptr; -} -inline GameWindow *GadgetListBoxGetUpButton( GameWindow *g ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - - if( listData && listData->upButton ) - return listData->upButton; - return nullptr; -} -inline GameWindow *GadgetListBoxGetDownButton( GameWindow *g ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - - if( listData && listData->downButton ) - return listData->downButton; - return nullptr; - -} - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h b/Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h deleted file mode 100644 index a4ce3684857..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetProgressBar.h +++ /dev/null @@ -1,140 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetProgressBar.h ////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetProgressBar.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for ProgressBars -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - - -extern void GadgetProgressBarSetProgress( GameWindow *g, Int progress ); -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -inline void GadgetProgressBarSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetProgressBarSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetProgressBarSetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetProgressBarSetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetProgressBarSetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetProgressBarSetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetProgressBarSetEnabledBarColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 4, color ); } -inline void GadgetProgressBarSetEnabledBarBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 4, color ); } -inline void GadgetProgressBarSetEnabledBarImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } -inline void GadgetProgressBarSetEnabledBarImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 5, image ); } -inline void GadgetProgressBarSetEnabledBarImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 6, image ); } -inline void GadgetProgressBarSetEnabledBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 7, image ); } -inline Color GadgetProgressBarGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetProgressBarGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetProgressBarGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image * GadgetProgressBarGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image * GadgetProgressBarGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image * GadgetProgressBarGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline Color GadgetProgressBarGetEnabledBarColor( GameWindow *g ) { return g->winGetEnabledColor( 4 ); } -inline Color GadgetProgressBarGetEnabledBarBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 4 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 4 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageRight( GameWindow *g ) { return g->winGetEnabledImage( 5 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 6 ); } -inline const Image * GadgetProgressBarGetEnabledBarImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 7 ); } - -//----------------------------------------------------------------------------- -inline void GadgetProgressBarSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetProgressBarSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetProgressBarSetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetProgressBarSetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetProgressBarSetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetProgressBarSetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetProgressBarSetDisabledBarColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 4, color ); } -inline void GadgetProgressBarSetDisabledBarBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 4, color ); } -inline void GadgetProgressBarSetDisabledBarImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } -inline void GadgetProgressBarSetDisabledBarImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 5, image ); } -inline void GadgetProgressBarSetDisabledBarImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 6, image ); } -inline void GadgetProgressBarSetDisabledBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 7, image ); } -inline Color GadgetProgressBarGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetProgressBarGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetProgressBarGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image * GadgetProgressBarGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image * GadgetProgressBarGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image * GadgetProgressBarGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline Color GadgetProgressBarGetDisabledBarColor( GameWindow *g ) { return g->winGetDisabledColor( 4 ); } -inline Color GadgetProgressBarGetDisabledBarBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 4 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageRight( GameWindow *g ) { return g->winGetDisabledImage( 5 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 6 ); } -inline const Image * GadgetProgressBarGetDisabledBarImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 7 ); } - -//----------------------------------------------------------------------------- -inline void GadgetProgressBarSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetProgressBarSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetProgressBarSetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetProgressBarSetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetProgressBarSetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetProgressBarSetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetProgressBarSetHiliteBarColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 4, color ); } -inline void GadgetProgressBarSetHiliteBarBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 4, color ); } -inline void GadgetProgressBarSetHiliteBarImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } -inline void GadgetProgressBarSetHiliteBarImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 5, image ); } -inline void GadgetProgressBarSetHiliteBarImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 6, image ); } -inline void GadgetProgressBarSetHiliteBarImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 7, image ); } -inline Color GadgetProgressBarGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetProgressBarGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetProgressBarGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image * GadgetProgressBarGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image * GadgetProgressBarGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image * GadgetProgressBarGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline Color GadgetProgressBarGetHiliteBarColor( GameWindow *g ) { return g->winGetHiliteColor( 4 ); } -inline Color GadgetProgressBarGetHiliteBarBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 4 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageRight( GameWindow *g ) { return g->winGetHiliteImage( 5 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 6 ); } -inline const Image * GadgetProgressBarGetHiliteBarImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 7 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h b/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h deleted file mode 100644 index 017a4048b10..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetPushButton.h +++ /dev/null @@ -1,171 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetPushButton.h /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetPushButton.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for PushButtons -// -// PushButton IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// enabledDrawData[ 1 ] is the enabled, selected button graphic -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// disabledDrawData[ 1 ] is the disabled, but selected button graphic -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// hiliteDrawData[ 1 ] is the hilited, selected button graphic -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -void GadgetCheckLikeButtonSetVisualCheck( GameWindow *g, Bool checked ); -Bool GadgetCheckLikeButtonIsChecked( GameWindow *g ); -void GadgetButtonEnableCheckLike( GameWindow *g, Bool makeCheckLike, Bool initiallyChecked ); - -void GadgetButtonSetText( GameWindow *g, UnicodeString text ); -void GadgetButtonDrawClock( GameWindow *g, Int percent, Color color ); //Darkens the progress -void GadgetButtonDrawInverseClock( GameWindow *g, Int percent, Color color ); //Darkens the remaining portion. -void GadgetButtonDrawOverlayImage( GameWindow *g, const Image *image ); -void GadgetButtonSetBorder( GameWindow *g, Color color, Bool drawBorder = TRUE ); -void GadgetButtonSetData(GameWindow *g, void *data); -void *GadgetButtonGetData(GameWindow *g); -void GadgetButtonSetAltSound( GameWindow *g, AsciiString altSound ); -inline void GadgetButtonSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} -inline void GadgetButtonSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetButtonSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetButtonSetEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} -inline void GadgetButtonSetEnabledSelectedColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetButtonSetEnabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline const Image *GadgetButtonGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetButtonGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetButtonGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetButtonGetEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline Color GadgetButtonGetEnabledSelectedColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetButtonGetEnabledSelectedBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } - -inline void GadgetButtonSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} -inline void GadgetButtonSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetButtonSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetButtonSetDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} -inline void GadgetButtonSetDisabledSelectedColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetButtonSetDisabledSelectedBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline const Image *GadgetButtonGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetButtonGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetButtonGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetButtonGetDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline Color GadgetButtonGetDisabledSelectedColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetButtonGetDisabledSelectedBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } - -inline void GadgetButtonSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); g->winSetEnabledImage( 5, nullptr );g->winSetEnabledImage( 6, nullptr );} -inline void GadgetButtonSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetButtonSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetButtonSetHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); g->winSetEnabledImage( 2, nullptr );g->winSetEnabledImage( 3, nullptr );} -inline void GadgetButtonSetHiliteSelectedColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetButtonSetHiliteSelectedBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline const Image *GadgetButtonGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetButtonGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetButtonGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetButtonGetHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline Color GadgetButtonGetHiliteSelectedColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetButtonGetHiliteSelectedBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } - -inline const Image *GadgetButtonGetLeftHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetButtonGetMiddleHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetButtonGetRightHiliteSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } - -inline const Image *GadgetButtonGetLeftHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetButtonGetMiddleHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 5 ); } -inline const Image *GadgetButtonGetRightHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 6 ); } - -inline void GadgetButtonSetLeftHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetButtonSetMiddleHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetButtonSetRightHiliteSelectedImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 4, image ); } - -inline void GadgetButtonSetLeftHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetButtonSetMiddleHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 5, image ); } -inline void GadgetButtonSetRightHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 6, image ); } - - -inline const Image *GadgetButtonGetLeftDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetButtonGetMiddleDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline const Image *GadgetButtonGetRightDisabledSelectedImage( GameWindow *g ) { return g->winGetDisabledImage( 4 ); } - -inline const Image *GadgetButtonGetLeftDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetButtonGetMiddleDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 5 ); } -inline const Image *GadgetButtonGetRightDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 6 ); } - -inline void GadgetButtonSetLeftDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetButtonSetMiddleDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetButtonSetRightDisabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 4, image ); } - -inline void GadgetButtonSetLeftDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetButtonSetMiddleDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 5, image ); } -inline void GadgetButtonSetRightDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 6, image ); } - -inline const Image *GadgetButtonGetLeftEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetButtonGetMiddleEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline const Image *GadgetButtonGetRightEnabledSelectedImage( GameWindow *g ) { return g->winGetEnabledImage( 4 ); } - -inline const Image *GadgetButtonGetLeftEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetButtonGetMiddleEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 5 ); } -inline const Image *GadgetButtonGetRightEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 6 ); } - -inline void GadgetButtonSetLeftEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetButtonSetMiddleEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetButtonSetRightEnabledSelectedImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 4, image ); } - -inline void GadgetButtonSetLeftEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetButtonSetMiddleEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 5, image ); } -inline void GadgetButtonSetRightEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 6, image ); } -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp deleted file mode 100644 index 1cdda2b5253..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +++ /dev/null @@ -1,427 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarMultiSelect.cpp //////////////////////////////////////////////////////////////// -// Author: Colin Day, March 2002 -// Desc: Context sensitive GUI for when you select multiple objects. What we do is show -// the commands that you can use between them all -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/ThingTemplate.h" -#include "GameClient/ControlBar.h" -#include "GameClient/Drawable.h" -#include "GameClient/GameClient.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GameWindow.h" -#include "GameClient/InGameUI.h" -#include "GameLogic/Object.h" - - - - -//------------------------------------------------------------------------------------------------- -/** Reset the common command data */ -//------------------------------------------------------------------------------------------------- -void ControlBar::resetCommonCommandData() -{ - Int i; - - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - m_commonCommands[ i ] = nullptr; - //Clear out any remnant overlays. - GadgetButtonDrawOverlayImage( m_commandWindows[ i ], nullptr ); - } - -} - -//------------------------------------------------------------------------------------------------- -/** add the common commands of this drawable to the common command set */ -//------------------------------------------------------------------------------------------------- -void ControlBar::addCommonCommands( Drawable *draw, Bool firstDrawable ) -{ - Int i; - const CommandButton *command; - - // sanity - if( draw == nullptr ) - return; - - Object* obj = draw->getObject(); - if (!obj) - return; - - if (obj->isKindOf(KINDOF_IGNORED_IN_GUI)) // ignore these guys - return; - - // get the command set of this drawable - const CommandSet *commandSet = findCommandSet( obj->getCommandSetString() ); - if( commandSet == nullptr ) - { - - // - // if there is no command set for this drawable, none of the selected drawables - // can possibly have matching commands so we'll get rid of them all - // - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - - m_commonCommands[ i ] = nullptr; - if (m_commandWindows[ i ]) - { - m_commandWindows[ i ]->winHide( TRUE ); - } - // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images - // removed from multiplayer branch - //showCommandMarkers(); - - } - - return; - - } - - - // - // easy case, if we're adding the first drawable we simply just add any of the commands - // in its set that can be multi-select commands to the common command set - // - if( firstDrawable == TRUE ) - { - - // just add each command that is classified as a common command - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - // our implementation doesn't necessarily make use of the max possible command buttons - if (! m_commandWindows[ i ]) continue; - - // get command - command = commandSet->getCommandButton(i); - - // add if present and can be used in a multi select - if( command && BitIsSet( command->getOptions(), OK_FOR_MULTI_SELECT ) == TRUE ) - { - - // put it in the common command set - m_commonCommands[ i ] = command; - - // show and enable this control - m_commandWindows[ i ]->winHide( FALSE ); - m_commandWindows[ i ]->winEnable( TRUE ); - - // set the command into the control - setControlCommand( m_commandWindows[ i ], command ); - - } - - } - - } - else - { - - // go through each command one by one - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - - // our implementation doesn't necessarily make use of the max possible command buttons - if (! m_commandWindows[ i ]) continue; - - // get the command - command = commandSet->getCommandButton(i); - - Bool attackMove = (command && command->getCommandType() == GUI_COMMAND_ATTACK_MOVE) || - (m_commonCommands[ i ] && m_commonCommands[ i ]->getCommandType() == GUI_COMMAND_ATTACK_MOVE); - - // Kris: When any units have attack move, they all get it. This is to allow - // combat units to be selected with the odd dozer or pilot and still retain that ability. - if( attackMove && !m_commonCommands[ i ] ) - { - // put it in the common command set - m_commonCommands[ i ] = command; - - // show and enable this control - m_commandWindows[ i ]->winHide( FALSE ); - m_commandWindows[ i ]->winEnable( TRUE ); - - // set the command into the control - setControlCommand( m_commandWindows[ i ], command ); - } - else if( command != m_commonCommands[ i ] && !attackMove ) - { - // - // if this command does not match the command that is in the common command set then - // *neither* this command OR the command in the common command set are really common - // commands, so we will remove the one that has been stored in the common set - // - - // remove the common command - m_commonCommands[ i ] = nullptr; - - // - // hide the window control cause it should have been made visible from a command - // that was placed in this common 'slot' earlier - // - m_commandWindows[ i ]->winHide( TRUE ); - } - - } - - } - - // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images - // removed from multiplayer branch - //showCommandMarkers(); - -} - -//------------------------------------------------------------------------------------------------- -/** Populate the visible command bar with commands that are common to all the objects - * that are selected in the UI */ -//------------------------------------------------------------------------------------------------- -void ControlBar::populateMultiSelect() -{ - Drawable *draw; - Bool firstDrawable = TRUE; - Bool portraitSet = FALSE; - const Image *portrait = nullptr; - Object *portraitObj = nullptr; - - // first reset the common command data - resetCommonCommandData(); - - // by default, hide all the controls in the command section - for( Int i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - if (m_commandWindows[ i ]) - { - m_commandWindows[ i ]->winHide( TRUE ); - } - } - - // sanity - DEBUG_ASSERTCRASH( TheInGameUI->getSelectCount() > 1, - ("populateMultiSelect: Can't populate multiselect context cause there are only '%d' things selected", - TheInGameUI->getSelectCount()) ); - - // get the list of drawable IDs from the in game UI - const DrawableList *selectedDrawables = TheInGameUI->getAllSelectedDrawables(); - - // sanity - DEBUG_ASSERTCRASH( selectedDrawables->empty() == FALSE, ("populateMultiSelect: Drawable list is empty") ); - - // loop through all the selected drawables - for( DrawableListCIt it = selectedDrawables->begin(); - it != selectedDrawables->end(); ++it ) - { - - // get the drawable - draw = *it; - - - if (draw->getObject()->isKindOf(KINDOF_IGNORED_IN_GUI)) // ignore these guys - continue; - - - // - // add command for this drawable, note that we also sanity check to make sure the - // drawable has an object as all interesting drawables that we can select should - // actually have an object underneath it so that we can do interesting things with - // it ... otherwise we should have never selected it. - // NOTE that we're not considering objects that are currently in the process of - // being sold as those objects can't be issued anymore commands - // - if( draw && draw->getObject() && - !draw->getObject()->getStatusBits().test( OBJECT_STATUS_SOLD ) ) - { - - // add the common commands of this drawable to the common command set - addCommonCommands( draw, firstDrawable ); - - // not adding the first drawable anymore - firstDrawable = FALSE; - - // - // keep track of the portrait images, if all units selected have the same portrait - // we will display it in the right HUD, otherwise we won't - // - if( portraitSet == FALSE ) - { - - portrait = draw->getTemplate()->getSelectedPortraitImage(); - portraitObj = draw->getObject(); - portraitSet = TRUE; - - } - else if( draw->getTemplate()->getSelectedPortraitImage() != portrait ) - portrait = nullptr; - - } - - } - - // set the portrait image - setPortraitByObject( portraitObj ); - -} - -//------------------------------------------------------------------------------------------------- -/** Update logic for the multi select context sensitive GUI */ -//------------------------------------------------------------------------------------------------- -void ControlBar::updateContextMultiSelect() -{ - Drawable *draw; - Object *obj; - const CommandButton *command; - GameWindow *win; - Int objectsThatCanDoCommand[ MAX_COMMANDS_PER_SET ]; - Int i; - - // zero the array that counts how many objects can do each command - memset( objectsThatCanDoCommand, 0, sizeof( objectsThatCanDoCommand ) ); - - // sanity - DEBUG_ASSERTCRASH( TheInGameUI->getSelectCount() > 1, - ("updateContextMultiSelect: TheInGameUI only has '%d' things selected", - TheInGameUI->getSelectCount()) ); - - // get the list of drawable IDs from the in game UI - const DrawableList *selectedDrawables = TheInGameUI->getAllSelectedDrawables(); - - // sanity - DEBUG_ASSERTCRASH( selectedDrawables->empty() == FALSE, ("populateMultiSelect: Drawable list is empty") ); - - // loop through all the selected drawable IDs - for( DrawableListCIt it = selectedDrawables->begin(); - it != selectedDrawables->end(); ++it ) - { - - // get the drawable from the ID - draw = *it; - - if (draw->getObject()->isKindOf(KINDOF_IGNORED_IN_GUI)) // ignore these guys - continue; - - - // get the object - obj = draw->getObject(); - - // sanity - if( obj == nullptr ) - continue; - - // for each of the visible command windows make sure the object can execute the command - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - - // get the control window - win = m_commandWindows[ i ]; - - // our implementation doesn't necessarily make use of the max possible command buttons - if (!win) continue; - - // don't consider hidden windows - if( win->winIsHidden() == TRUE ) - continue; - - // get the command - command = (const CommandButton *)GadgetButtonGetData(win); - if( command == nullptr ) - continue; - - // can we do the command - CommandAvailability availability = getCommandAvailability( command, obj, win ); - - win->winClearStatus( WIN_STATUS_NOT_READY ); - win->winClearStatus( WIN_STATUS_ALWAYS_COLOR ); - - // enable/disable the window control - switch( availability ) - { - case COMMAND_HIDDEN: - win->winHide( TRUE ); - break; - case COMMAND_RESTRICTED: - win->winEnable( FALSE ); - break; - case COMMAND_NOT_READY: - win->winEnable( FALSE ); - win->winSetStatus( WIN_STATUS_NOT_READY ); - break; - case COMMAND_CANT_AFFORD: - win->winEnable( FALSE ); - win->winSetStatus( WIN_STATUS_ALWAYS_COLOR ); - break; - default: - win->winEnable( TRUE ); - break; - } - - //If button is a CHECK_LIKE, then update it's status now. - if( BitIsSet( command->getOptions(), CHECK_LIKE ) ) - { - GadgetCheckLikeButtonSetVisualCheck( win, availability == COMMAND_ACTIVE ); - } - - if( availability == COMMAND_AVAILABLE || availability == COMMAND_ACTIVE ) - objectsThatCanDoCommand[ i ]++; - - } - - } - - // - // for each command, if any objects can do the command we enable the window, otherwise - // we disable it - // - for( i = 0; i < MAX_COMMANDS_PER_SET; i++ ) - { - // our implementation doesn't necessarily make use of the max possible command buttons - if (! m_commandWindows[ i ]) continue; - - // don't consider hidden commands - if( m_commandWindows[ i ]->winIsHidden() == TRUE ) - continue; - - // don't consider slots that don't have commands - if( m_commonCommands[ i ] == nullptr ) - continue; - - // check the count of objects that can do the command and enable/disable the control, - if( objectsThatCanDoCommand[ i ] > 0 ) - m_commandWindows[ i ]->winEnable( TRUE ); - else - m_commandWindows[ i ]->winEnable( FALSE ); - - } - - // After Every change to the m_commandWIndows, we need to show fill in the missing blanks with the images - // removed from multiplayer branch - //showCommandMarkers(); - - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp deleted file mode 100644 index 56d8f878315..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +++ /dev/null @@ -1,383 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarObserver.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Aug 2002 -// -// Filename: ControlBarObserver.cpp -// -// author: Chris Huybregts -// -// purpose: All things related to the Observer Control bar, are in here. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GameUtility.h" -#include "Common/NameKeyGenerator.h" -#include "Common/PlayerList.h" -#include "Common/Player.h" -#include "Common/PlayerTemplate.h" -#include "Common/KindOf.h" -#include "Common/Recorder.h" -#include "GameClient/ControlBar.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameText.h" -#include "GameNetwork/NetworkDefs.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -enum { MAX_BUTTONS = 8}; -static NameKeyType buttonPlayerID[MAX_BUTTONS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID }; -static NameKeyType staticTextPlayerID[MAX_BUTTONS] = { NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID, - NAMEKEY_INVALID,NAMEKEY_INVALID }; -static GameWindow *ObserverPlayerInfoWindow = nullptr; -static GameWindow *ObserverPlayerListWindow = nullptr; - -static GameWindow *buttonPlayer[MAX_BUTTONS] = {0}; -static GameWindow *staticTextPlayer[MAX_BUTTONS] = {0}; - - -static NameKeyType buttonCancelID = NAMEKEY_INVALID; - -static GameWindow *winFlag = nullptr; -static GameWindow *winGeneralPortrait = nullptr; -// TheSuperHackers @tweak Allow idle worker selection for observers. -static GameWindow *buttonIdleWorker = nullptr; -static GameWindow *staticTextNumberOfUnits = nullptr; -static GameWindow *staticTextNumberOfBuildings = nullptr; -static GameWindow *staticTextNumberOfUnitsKilled = nullptr; -static GameWindow *staticTextNumberOfUnitsLost = nullptr; -static GameWindow *staticTextPlayerName = nullptr; - -static NameKeyType s_replayObserverNameKey = NAMEKEY_INVALID; - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - - -void ControlBar::initObserverControls() -{ - ObserverPlayerInfoWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerInfoWindow")); - ObserverPlayerListWindow = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ObserverPlayerListWindow")); - - for (Int i = 0; i < MAX_BUTTONS; i++) - { - AsciiString tmpString; - tmpString.format("ControlBar.wnd:ButtonPlayer%d", i); - buttonPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); - buttonPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, buttonPlayerID[i] ); - tmpString.format("ControlBar.wnd:StaticTextPlayer%d", i); - staticTextPlayerID[i] = TheNameKeyGenerator->nameToKey( tmpString ); - staticTextPlayer[i] = TheWindowManager->winGetWindowFromId( ObserverPlayerListWindow, staticTextPlayerID[i] ); - } - - staticTextNumberOfUnits = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnits")); - staticTextNumberOfBuildings = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfBuildings")); - staticTextNumberOfUnitsKilled = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsKilled")); - staticTextNumberOfUnitsLost = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextNumberOfUnitsLost")); - staticTextPlayerName = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:StaticTextPlayerName")); - winFlag = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinFlag")); - winGeneralPortrait = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:WinGeneralPortrait")); - buttonIdleWorker = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonIdleWorker")); - - buttonCancelID = TheNameKeyGenerator->nameToKey("ControlBar.wnd:ButtonCancel"); - - s_replayObserverNameKey = TheNameKeyGenerator->nameToKey("ReplayObserver"); -} - -//------------------------------------------------------------------------------------------------- -void ControlBar::setObserverLookAtPlayer(Player *player) -{ - if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) - { - // Looking at the observer. Treat as not looking at player. - m_observerLookAtPlayer = nullptr; - } - else - { - m_observerLookAtPlayer = player; - } -} - -//------------------------------------------------------------------------------------------------- -void ControlBar::setObservedPlayer(Player *player) -{ - if (player != nullptr && player == ThePlayerList->findPlayerWithNameKey(s_replayObserverNameKey)) - { - // Looking at the observer. Treat as not observing player. - m_observedPlayer = nullptr; - } - else - { - m_observedPlayer = player; - } -} - -//------------------------------------------------------------------------------------------------- -/** System callback for the ControlBarObserverSystem */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType ControlBarObserverSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - static NameKeyType buttonCommunicator = NAMEKEY_INVALID; - - switch( msg ) - { - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_MOUSE_ENTERING: - case GBM_MOUSE_LEAVING: - { - break; - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - case GBM_SELECTED_RIGHT: - { - GameWindow *control = (GameWindow *)mData1; - - Int controlID = control->winGetWindowId(); - if( controlID == buttonCancelID) - { - rts::changeObservedPlayer(nullptr); - - ObserverPlayerInfoWindow->winHide(TRUE); - ObserverPlayerListWindow->winHide(FALSE); - buttonIdleWorker->winHide(TRUE); - TheControlBar->populateObserverList(); - } - - for(Int i = 0; i (GadgetButtonGetData(buttonPlayer[i])); - rts::changeObservedPlayer(player); - - ObserverPlayerInfoWindow->winHide(FALSE); - ObserverPlayerListWindow->winHide(TRUE); - - if(TheControlBar->getObserverLookAtPlayer()) - TheControlBar->populateObserverInfoWindow(); - - return MSG_HANDLED; - } - } - - // if( controlID == buttonCommunicator && TheGameLogic->getGameMode() == GAME_INTERNET ) - /* - { - popupCommunicatorLayout = TheWindowManager->winCreateLayout( "Menus/PopupCommunicator.wnd" ); - popupCommunicatorLayout->runInit(); - popupCommunicatorLayout->hide( FALSE ); - popupCommunicatorLayout->bringForward(); - } -*/ - - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -void ControlBar::populateObserverList() -{ - Int currentButton = 0, i; - if(TheRecorder->isMultiplayer()) - { - - for (i = 0; i < MAX_SLOTS; ++i) - { - AsciiString name; - name.format("player%d", i); - Player *p = ThePlayerList->findPlayerWithNameKey(TheNameKeyGenerator->nameToKey(name)); - if(p) - { - if(p->isPlayerObserver()) - continue; - DEBUG_ASSERTCRASH(currentButton < MAX_BUTTONS, ("ControlBar::populateObserverList trying to populate more buttons then we have")); - GadgetButtonSetData(buttonPlayer[currentButton], (void *)p); - GadgetButtonSetEnabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getEnabledImage() ); - //GadgetButtonSetHiliteImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getHiliteImage() ); - //GadgetButtonSetHiliteSelectedImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getPushedImage() ); - //GadgetButtonSetDisabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getDisabledImage() ); - buttonPlayer[currentButton]->winSetTooltip(p->getPlayerDisplayName()); - buttonPlayer[currentButton]->winHide(FALSE); - buttonPlayer[currentButton]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - - const GameSlot *slot = TheGameInfo->getConstSlot(i); - Color playerColor = p->getPlayerColor(); - Color backColor = GameMakeColor(0, 0, 0, 255); - staticTextPlayer[currentButton]->winSetEnabledTextColors( playerColor, backColor ); - staticTextPlayer[currentButton]->winHide(FALSE); - AsciiString teamStr; - teamStr.format("Team:%d", slot->getTeamNumber() + 1); - if (slot->isAI() && slot->getTeamNumber() == -1) - teamStr = "Team:AI"; - - UnicodeString text; - text.format(TheGameText->fetch("CONTROLBAR:ObsPlayerLabel"), p->getPlayerDisplayName().str(), - TheGameText->fetch(teamStr).str()); - - GadgetStaticTextSetText(staticTextPlayer[currentButton], text ); - - ++currentButton; - } - } - for(currentButton; currentButtonwinHide(TRUE); - staticTextPlayer[currentButton]->winHide(TRUE); - } - } - else - { - for(i =0; i < MAX_PLAYER_COUNT; ++i) - { - Player *p = ThePlayerList->getNthPlayer(i); - if(p && !p->isPlayerObserver() && p->getPlayerType() == PLAYER_HUMAN) - { - DEBUG_ASSERTCRASH(currentButton < MAX_BUTTONS, ("ControlBar::populateObserverList trying to populate more buttons then we have")); - GadgetButtonSetData(buttonPlayer[currentButton], (void *)p); - GadgetButtonSetEnabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getEnabledImage() ); - //GadgetButtonSetHiliteImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getHiliteImage() ); - //GadgetButtonSetHiliteSelectedImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getPushedImage() ); - //GadgetButtonSetDisabledImage( buttonPlayer[currentButton], p->getPlayerTemplate()->getDisabledImage() ); - buttonPlayer[currentButton]->winSetTooltip(p->getPlayerDisplayName()); - buttonPlayer[currentButton]->winHide(FALSE); - buttonPlayer[currentButton]->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - - Color playerColor = p->getPlayerColor(); - Color backColor = GameMakeColor(0, 0, 0, 255); - staticTextPlayer[currentButton]->winSetEnabledTextColors( playerColor, backColor ); - staticTextPlayer[currentButton]->winHide(FALSE); - GadgetStaticTextSetText(staticTextPlayer[currentButton], p->getPlayerDisplayName()); - - ++currentButton; - break; - } - } - for(currentButton; currentButtonwinHide(TRUE); - staticTextPlayer[currentButton]->winHide(TRUE); - } - } -} - -void ControlBar::populateObserverInfoWindow () -{ - if(ObserverPlayerInfoWindow->winIsHidden()) - return; - - if( !m_observerLookAtPlayer ) - { - ObserverPlayerInfoWindow->winHide(TRUE); - ObserverPlayerListWindow->winHide(FALSE); - buttonIdleWorker->winHide(TRUE); - populateObserverList(); - return; - } - - UnicodeString uString; - KindOfMaskType mask,clearmask; - mask.set(KINDOF_SCORE); - clearmask.set(KINDOF_STRUCTURE); - - uString.format(L"%d",m_observerLookAtPlayer->countObjects(mask,clearmask)); - GadgetStaticTextSetText(staticTextNumberOfUnits, uString); - - Int numBuildings = 0; - mask.clear(); - mask.set(KINDOF_SCORE); - mask.set(KINDOF_STRUCTURE); - clearmask.clear(); - numBuildings = m_observerLookAtPlayer->countObjects(mask,clearmask); - mask.clear(); - mask.set(KINDOF_SCORE_CREATE); - mask.set(KINDOF_STRUCTURE); - numBuildings += m_observerLookAtPlayer->countObjects(mask,clearmask); - mask.clear(); - mask.set(KINDOF_SCORE_DESTROY); - mask.set(KINDOF_STRUCTURE); - numBuildings += m_observerLookAtPlayer->countObjects(mask,clearmask); - uString.format(L"%d",numBuildings); - GadgetStaticTextSetText(staticTextNumberOfBuildings, uString); - uString.format(L"%d",m_observerLookAtPlayer->getScoreKeeper()->getTotalUnitsDestroyed()); - GadgetStaticTextSetText(staticTextNumberOfUnitsKilled, uString); - uString.format(L"%d",m_observerLookAtPlayer->getScoreKeeper()->getTotalUnitsLost()); - GadgetStaticTextSetText(staticTextNumberOfUnitsLost, uString); - GadgetStaticTextSetText(staticTextPlayerName, m_observerLookAtPlayer->getPlayerDisplayName()); - Color color = m_observerLookAtPlayer->getPlayerColor(); - staticTextPlayerName->winSetEnabledTextColors(color, GameMakeColor(0,0,0,255)); - winFlag->winSetEnabledImage(0, m_observerLookAtPlayer->getPlayerTemplate()->getFlagWaterMarkImage()); - winGeneralPortrait->winHide(FALSE); - buttonIdleWorker->winHide(FALSE); -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp deleted file mode 100644 index 197205b5f47..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +++ /dev/null @@ -1,104 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarPrintPositions.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: ControlBarPrintPositions.cpp -// -// author: Chris Huybregts -// -// purpose: Convenience function for degayifying the whole squished control bar -// process -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/GameWindowManager.h" -#include "GameClient/WindowLayout.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -void PrintInfoRecursive( GameWindow *win, FILE *fp) -{ - if(!win) - return; - ICoord2D pos, size; - win->winGetSize(&size.x, &size.y); - win->winGetPosition(&pos.x, &pos.y); - fprintf(fp, "ControlBarResizer %s\n",win->winGetInstanceData()->m_decoratedNameString.str()); - fprintf(fp, " AltPosition = X:%d Y:%d\n",pos.x, pos.y); - fprintf(fp, " AltSize = X:%d Y:%d\n",size.x, size.y); - fprintf(fp, "END\n\n"); - - PrintInfoRecursive(win->winGetChild(),fp); - PrintInfoRecursive(win->winGetNext(),fp); - -} - -void PrintOffsetsFromControlBarParent() -{ - GameWindow *controlBarParent = TheWindowManager->winGetWindowFromId( nullptr, TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ControlBarParent" )); - if(!controlBarParent) - return; - - WindowLayout *layout = TheWindowManager->winCreateLayout("controlBarHidden.wnd"); - if(!layout) - return; - FILE *fp = fopen("ControlBarEasier.txt", "w"); - if(!fp) - return; - - PrintInfoRecursive(layout->getFirstWindow(), fp); - - fclose(fp); - layout->destroyWindows(); - deleteInstance(layout); -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp deleted file mode 100644 index f639cd61517..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +++ /dev/null @@ -1,245 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarResizer.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Sep 2002 -// -// Filename: ControlBarResizer.cpp -// -// author: Chris Huybregts -// -// purpose: We want a "squished" control bar, this is the methods that will do it -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "GameClient/ControlBar.h" -#include "GameClient/ControlBarResizer.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Display.h" -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -const FieldParse ControlBarResizer::m_controlBarResizerParseTable[] = -{ - { "AltPosition", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altPos ) }, - { "AltSize", INI::parseICoord2D, nullptr, offsetof( ResizerWindow, m_altSize ) }, - { nullptr, nullptr, nullptr, 0 } - -}; -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -ResizerWindow::ResizerWindow() -{ - m_defaultPos.x = m_defaultPos.y = 0; - m_defaultSize.x = m_defaultSize.y = 0; - m_altSize.x = m_altSize.y = 0; - m_altPos.x = m_altPos.y = 0; -} - -ControlBarResizer::ControlBarResizer() -{ - -} -ControlBarResizer::~ControlBarResizer() -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - it = m_resizerWindowsList.erase(it); - continue; - } - delete rWin; - it = m_resizerWindowsList.erase(it); - } - m_resizerWindowsList.clear(); -} - -void ControlBarResizer::init() -{ - INI ini; - // Read from INI all the ControlBarSchemes - ini.loadFileDirectory( "Data\\INI\\ControlBarResizer", INI_LOAD_OVERWRITE, nullptr ); - -} - - -ResizerWindow *ControlBarResizer::findResizerWindow( AsciiString name ) -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - DEBUG_CRASH(("There's no resizerWindow in ControlBarResizer::findResizerWindow")); - it++; - continue; - } - // find the scheme that best matches our resolution - if(rWin->m_name.compare(name) == 0) - { - return rWin; - } - it ++; - } - return nullptr; -} - -ResizerWindow *ControlBarResizer::newResizerWindow( AsciiString name ) -{ - ResizerWindow *newRwin = NEW ResizerWindow; - if(!newRwin) - return nullptr; - - newRwin->m_name = name; - GameWindow *win = nullptr; - win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(name)); - if( !win ) - { - DEBUG_ASSERTCRASH(win,("ControlBarResizer::newResizerWindow could not find window %s Are you sure that window is loaded yet?", name.str()) ); - delete newRwin; - return nullptr; - } - win->winGetPosition(&newRwin->m_defaultPos.x,&newRwin->m_defaultPos.y); - win->winGetSize(&newRwin->m_defaultSize.x,&newRwin->m_defaultSize.y); - m_resizerWindowsList.push_back(newRwin); - return newRwin; -} -void ControlBarResizer::sizeWindowsDefault() -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = nullptr; - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - DEBUG_CRASH(("There's no resizerWindow in ControlBarResizer::sizeWindowsDefault")); - it++; - continue; - } - win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); - if(!win) - { - it++; - continue; - } - win->winSetPosition(rWin->m_defaultPos.x, rWin->m_defaultPos.y); - win->winSetSize(rWin->m_defaultSize.x, rWin->m_defaultSize.y); - DEBUG_LOG(("sizeWindowsDefault:%s pos X:%d pos Y: %d size X:%d sizeY: %d",rWin->m_name.str(),rWin->m_defaultPos.x, rWin->m_defaultPos.y,rWin->m_defaultSize.x, rWin->m_defaultSize.y )); - it ++; - } -} -void ControlBarResizer::sizeWindowsAlt() -{ - ResizerWindowList::iterator it = m_resizerWindowsList.begin(); - GameWindow *win = nullptr; - Real x = (Real)TheDisplay->getWidth() / DEFAULT_DISPLAY_WIDTH; - Real y = (Real)TheDisplay->getHeight() / DEFAULT_DISPLAY_HEIGHT; - while (it != m_resizerWindowsList.end()) - { - ResizerWindow *rWin = *it; - if( !rWin ) - { - DEBUG_CRASH(("There's no resizerWindow in ControlBarResizer::sizeWindowsDefault")); - it++; - continue; - } - win = TheWindowManager->winGetWindowFromId(nullptr, TheNameKeyGenerator->nameToKey(rWin->m_name)); - if(!win) - { - it++; - continue; - } - - win->winSetPosition(rWin->m_altPos.x * x, rWin->m_altPos.y * y); - if(rWin->m_altSize.x >0 || rWin->m_altSize.y > 0) - win->winSetSize(rWin->m_altSize.x *x, rWin->m_altSize.y *y); - DEBUG_LOG(("sizeWindowsAlt:%s pos X:%d pos Y: %d size X:%d sizeY: %d",rWin->m_name.str(), rWin->m_altPos.x*x, rWin->m_altPos.y*y,rWin->m_altSize.x*x, rWin->m_altSize.y *y)); - it ++; - } -} - - -void INI::parseControlBarResizerDefinition( INI* ini ) -{ -// AsciiString name; -// ResizerWindow *rWin = nullptr; -// -// // read the name -// const char* c = ini->getNextToken(); -// name.set( c ); -// -//// ControlBarResizer *resizer = TheControlBar->getControlBarResizer(); -// if( !resizer ) -// { -// //We don't need it if we're in the builder... which doesn't have this. -// return; -// } -// rWin = resizer->findResizerWindow( name ); -// if( rWin == nullptr ) -// { -// -// // image not found, create a new one -// rWin = resizer->newResizerWindow(name); -// DEBUG_ASSERTCRASH( rWin, ("parseControlBarResizerDefinition: unable to allocate ResizerWindow for '%s'", -// name.str()) ); -// -// } // end if -// -// // parse the ini definition -// ini->initFromINI( rWin, resizer->getFieldParse()); -// -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp deleted file mode 100644 index 5bbe5fe01ec..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ControlBarUnderConstruction.cpp ////////////////////////////////////////////////////////// -// Author: Colin Day, March 2002 -// Desc: Methods specific to the control bar under construction context -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/NameKeyGenerator.h" -#include "Common/ThingTemplate.h" - -#include "GameLogic/Object.h" -#include "GameLogic/Module/UpdateModule.h" - -#include "GameClient/Drawable.h" -#include "GameClient/GameText.h" -#include "GameClient/ControlBar.h" -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetStaticText.h" - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void ControlBar::updateConstructionTextDisplay( Object *obj ) -{ - UnicodeString text; - static UnsignedInt descID = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:UnderConstructionDesc" ); - GameWindow *descWindow = TheWindowManager->winGetWindowFromId( nullptr, descID ); - - // sanity - DEBUG_ASSERTCRASH( descWindow, ("Under construction window not found") ); - - // format the message - text.format( TheGameText->fetch( "CONTROLBAR:UnderConstructionDesc" ), - obj->getConstructionPercent() ); - GadgetStaticTextSetText( descWindow, text ); - - // record this as the last percentage displayed - m_displayedConstructPercent = obj->getConstructionPercent(); - -} - -//------------------------------------------------------------------------------------------------- -/** Populate the interface for an under construction context. */ -//------------------------------------------------------------------------------------------------- -void ControlBar::populateUnderConstruction( Object *objectUnderConstruction ) -{ - - // sanity - if( objectUnderConstruction == nullptr ) - return; - - // get our parent window - GameWindow *parent = m_contextParent[ CP_UNDER_CONSTRUCTION ]; - - // set the cancel construction button -/// @todo srj -- remove hard-coding here, please - const CommandButton *commandButton = findCommandButton( "Command_CancelConstruction" ); - NameKeyType id; - id = TheNameKeyGenerator->nameToKey( "ControlBar.wnd:ButtonCancelConstruction" ); - GameWindow *win = TheWindowManager->winGetWindowFromId( parent, id ); - - setControlCommand( win, commandButton ); - win->winSetStatus( WIN_STATUS_USE_OVERLAY_STATES ); - - // set the text description of what is building - updateConstructionTextDisplay( objectUnderConstruction ); - - // set the portrait for the thing being constructed - setPortraitByObject( objectUnderConstruction ); - - // and show the rally point, if it should have one, - ExitInterface *exit = objectUnderConstruction->getObjectExitInterface(); - if( exit ) - showRallyPoint( exit->getRallyPoint() ); - - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void ControlBar::updateContextUnderConstruction() -{ - Object *obj = m_currentSelectedDrawable->getObject(); - - // if the object is no longer under construction switch to a new appropriate context - if( !obj->getStatusBits().test( OBJECT_STATUS_UNDER_CONSTRUCTION ) ) - { - - evaluateContextUI(); - return; - - } - - // if the construction percent has changed since what was last shown to the user update the text - if( m_displayedConstructPercent != obj->getConstructionPercent() ) - updateConstructionTextDisplay( obj ); - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp deleted file mode 100644 index 205cbda9638..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: CheckBox.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: CheckBox.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Checkbox GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Keyboard.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetCheckBoxInput ======================================================== -/** Handle input for check box */ -//============================================================================= -WindowMsgHandledType GadgetCheckBoxInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - mData1 ); - //TheWindowManager->winSetFocus( window ); - - } - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - mData1 ); - } - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - { - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), GGM_LEFT_DRAG, - (WindowMsgData)window, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - - if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) == FALSE ) - { - // this up click was not meant for this button - return MSG_IGNORED; - } - - // Toggle the check state - instData->m_state ^= WIN_STATE_SELECTED; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), GBM_SELECTED, - (WindowMsgData)window, mData1 ); - - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_DOWN: - { - - break; - } - - //------------------------------------------------------------------------- - case GWM_RIGHT_UP: - { - // Need to be specially marked to care about right mouse events - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) ) - { - TheWindowManager->winSendSystemMsg( instData->getOwner(), GBM_SELECTED_RIGHT, - (WindowMsgData)window, mData1 ); - - BitClear( instData->m_state, WIN_STATE_SELECTED ); - } - else - { - // this up click was not meant for this button - return MSG_IGNORED; - } - break; - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_ENTER: - case KEY_SPACE: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // Toggle the check state - instData->m_state ^= WIN_STATE_SELECTED; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - 0 ); - } - break; - - } - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winNextTab(window); - break; - - } - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winPrevTab(window); - break; - - } - - // -------------------------------------------------------------------- - default: - { - - return MSG_IGNORED; - - } - - } - - break; - - } - - // ------------------------------------------------------------------------ - default: - { - - return MSG_IGNORED; - - } - - } - - return MSG_HANDLED; - -} - -// GadgetCheckBoxSystem ======================================================= -/** Handle system messages for check box */ -//============================================================================= -WindowMsgHandledType GadgetCheckBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - window->winSetText( *(UnicodeString*)mData1 ); - break; - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - - if( mData1 == FALSE ) - BitClear( instData->m_state, WIN_STATE_HILITED ); - else - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - if( mData1 == FALSE ) - *(Bool*)mData2 = FALSE; - else - *(Bool*)mData2 = TRUE; - - break; - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetCheckBoxSetText ====================================================== -/** Set the text for the control */ -//============================================================================= -void GadgetCheckBoxSetText( GameWindow *g, UnicodeString text ) -{ - - // sanity - if( g == nullptr ) - return; - - TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); - -} - -// GadgetCheckBoxSetChecked ============================================ -//============================================================================= -/** Set the check state for the check box */ -//============================================================================= -void GadgetCheckBoxSetChecked( GameWindow *g, Bool isChecked) -{ - WinInstanceData *instData = g->winGetInstanceData(); - if (isChecked) - { - BitSet(instData->m_state, WIN_STATE_SELECTED); - } - else - { - BitClear(instData->m_state, WIN_STATE_SELECTED); - } - - TheWindowManager->winSendSystemMsg( g->winGetOwner(), GBM_SELECTED, - (WindowMsgData)g, 0 ); - -} - -// GadgetCheckBoxToggle ============================================ -//============================================================================= -/** Toggle the check state for the check box */ -//============================================================================= -void GadgetCheckBoxToggle( GameWindow *g) -{ - WinInstanceData *instData = g->winGetInstanceData(); - Bool isChecked = BitIsSet(instData->m_state, WIN_STATE_SELECTED); - if (isChecked) - { - BitClear(instData->m_state, WIN_STATE_SELECTED); - } - else - { - BitSet(instData->m_state, WIN_STATE_SELECTED); - } - - TheWindowManager->winSendSystemMsg( g->winGetOwner(), GBM_SELECTED, - (WindowMsgData)g, 0 ); - -} - -// GadgetCheckBoxIsChecked ====================================================== -/** Check the check state */ -//============================================================================= -Bool GadgetCheckBoxIsChecked( GameWindow *g ) -{ - WinInstanceData *instData = g->winGetInstanceData(); - return (BitIsSet(instData->m_state, WIN_STATE_SELECTED)); -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp deleted file mode 100644 index 96769530207..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +++ /dev/null @@ -1,1107 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetComboBox.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: ListBox.cpp -// -// Created: Dean Iverson, March 1998 -// Colin Day, June 2001 -// -// Desc: ListBox GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "Common/AudioEventRTS.h" -#include "Common/GameAudio.h" -#include "Common/Debug.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetComboBox.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GameWindowGlobal.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -void HideListBox(GameWindow * window); - -// GadgetComboBoxInput ========================================================= -/** Handle input for Combo box */ -//============================================================================= -WindowMsgHandledType GadgetComboBoxInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// ComboBoxData *combo = (ComboBoxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - switch (msg) - { - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch (mData1) - { - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winNextTab(window); - break; - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winPrevTab(window); - break; - - // -------------------------------------------------------------------- - default: - return TheWindowManager->winSendInputMsg( editBox, GWM_CHAR, mData1, mData2 ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_DOWN: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_UP: - { - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); - ICoord2D winSize; - //ICoord2D winPosition; - ICoord2D newSize; - Int listX =0; - Int multiplier; - comboData->dontHide = FALSE; - AudioEventRTS buttonClick("GUIClick"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (listBox) - { - TheWindowManager->winSetLoneWindow(window); - // If the Listbox isn't showing, Show it. - if(listBox->winIsHidden()) - { - listBox->winHide(FALSE); - window->winGetSize(&winSize.x, &winSize.y); - WinInstanceData *listInstData = listBox->winGetInstanceData(); - ListboxData *listData = (ListboxData *)listBox->winGetUserData(); - // If we have less entries then our max display is set to, only show - // those entries and not additional blank lines. Also, just so it looks - // pretty, hide the list box's sliders if we don't need to scroll. - if(comboData->entryCount <= comboData->maxDisplay) - { - multiplier = comboData->entryCount; - listX = winSize.x;// + 16; - - if(listData->upButton) - listData->upButton->winHide(TRUE); - if(listData->downButton) - listData->downButton->winHide(TRUE); - if(listData->slider) - listData->slider->winHide(TRUE); - } - else - { - multiplier = comboData->maxDisplay; - listX = winSize.x; - if(listData->upButton) - listData->upButton->winHide(FALSE); - if(listData->downButton) - listData->downButton->winHide(FALSE); - if(listData->slider) - listData->slider->winHide(FALSE); - - } - - newSize.y = ((TheWindowManager->winFontHeight( listInstData->getFont() ) ) * multiplier) + multiplier * 2 + 4; - window->winSetSize(winSize.x , winSize.y + newSize.y ); - listBox->winSetPosition(0, winSize.y); - - listBox->winSetSize(listX , newSize.y); - } - // if the Listbox was showing, hide it. - else - { - HideListBox(window); - } - } break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_UP: - { - break; - - } - -/* - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - - break; - - } -*/ - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - 0 ); - break; - - // ------------------------------------------------------------------------ -// case GWM_LEFT_DOWN: - - // we want to eat the down... so we may receive the up. -// return MSG_HANDLED; - - //------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// HideListBox ================================================================ -/** Called to close the listbox if it is opened */ -//============================================================================= -void HideListBox(GameWindow * window) -{ - ICoord2D winSize; - ICoord2D newSize; - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (!listBox) - return; - - if(!listBox->winIsHidden()) - { - listBox->winHide(TRUE); - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - editBox->winGetSize(&winSize.x, &winSize.y); - window->winGetSize(&newSize.x, &newSize.y); - window->winSetSize(newSize.x, winSize.y ); - } -} - -// GadgetListBoxSystem ======================================================== -/** Handle system messages for list box */ -//============================================================================= -WindowMsgHandledType GadgetComboBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ComboBoxData *comboData = (ComboBoxData *)window->winGetUserData(); - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - instData->setText(*(UnicodeString*)mData1); - break; - - } - - // ------------------------------------------------------------------------ - case GCM_GET_TEXT: - { - if(comboData->editBox) - *(UnicodeString*)mData2 = GadgetTextEntryGetText(comboData->editBox); - break; - } - - // ------------------------------------------------------------------------ - case GCM_SET_TEXT: - { - if (comboData->editBox) - GadgetTextEntrySetText(comboData->editBox,*(const UnicodeString*)mData1); - break; - - } - - case GEM_UPDATE_TEXT: - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GCM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - if (comboData->listBox) - { - GadgetListBoxSetSelected(comboData->listBox, -1); - HideListBox(window); - } - break; - } - - // ------------------------------------------------------------------------ - // if we get sent an edit done message from the text box, lets notify the parent - case GEM_EDIT_DONE: - { - if ((GameWindow *)mData1 == comboData->editBox) - { - HideListBox(window); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GCM_SELECTED, - (WindowMsgData)window, - 0 ); - } - break; - } - // ------------------------------------------------------------------------ - // Set the selection in the listbox, this will trigger the listbox selected message - // which will set the edit box. - case GCM_SET_SELECTION: - { - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if(listBox) - { - if( !listBox->winIsHidden() && mData2 == TRUE ) - comboData->dontHide = TRUE; - - GadgetListBoxSetSelected(listBox, (Int)mData1); - } - break; - } - // ------------------------------------------------------------------------ - // Get what the listbox has selected. - case GCM_GET_SELECTION: - { - if(comboData->listBox) - GadgetListBoxGetSelected(comboData->listBox, (Int *)mData2); - else - { - DEBUG_CRASH(("We don't have a listbox as part of the combo box")); - *(Int *)mData2 = -1; - } - break; - } - // ------------------------------------------------------------------------ - // Set the User Data for the specified listbox element - case GCM_SET_ITEM_DATA: - { - if(comboData->listBox) - { - GadgetListBoxSetItemData(comboData->listBox, (void *)mData2, (Int)mData1 ); - } - - break; - } - // ------------------------------------------------------------------------ - // Get the user Data for the specified listbox element - case GCM_GET_ITEM_DATA: - { - if(comboData->listBox) - { - *(void **)mData2 = GadgetListBoxGetItemData(comboData->listBox, (Int) mData1, 0); - } - break; - } - // ------------------------------------------------------------------------ - // Pass onto the parent window the selection the listbox just made - case GLM_SELECTED: - { - if((GameWindow *) mData1 == comboData->listBox) - { - if( comboData->dontHide == TRUE ) - { - comboData->dontHide = FALSE; - } - else - HideListBox(window); - - // Nothing was actually selected, so we just want to - if( mData2 == -1) - { - break; - } - - //Grab the text that was selected - UnicodeString tempUString; - Color color; - tempUString = GadgetListBoxGetTextAndColor( comboData->listBox, &color, mData2, 0 ); - - GadgetTextEntrySetTextColor(comboData->editBox, color); - - GadgetTextEntrySetText(comboData->editBox, tempUString); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GCM_SELECTED, - (WindowMsgData)window, - 0 ); - } - break; - } - - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GCM_DEL_ALL: - { - if ( comboData->listBox ) - GadgetListBoxReset(comboData->listBox); - if ( comboData->editBox ) - GadgetTextEntrySetText(comboData->editBox, UnicodeString::TheEmptyString ); - comboData->entryCount = 0; - //HideListBox(window); - break; - - } - - // ------------------------------------------------------------------------ - case GCM_DEL_ENTRY: - { - - break; - - } - // ------------------------------------------------------------------------ - case GGM_CLOSE: - { - HideListBox(window); - break; - - } - - // ------------------------------------------------------------------------ - case GCM_ADD_ENTRY: - { - GameWindow *listBox = GadgetComboBoxGetListBox(window); - ListboxData *listData = (ListboxData *)listBox->winGetUserData(); - - Int addedIndex = -1; - if( listBox ) - { - //Increase our internal entry count - comboData->entryCount++; - //If we've exceeded the set listlength, resize it to twice the size - if(comboData->entryCount >= listData->listLength) - GadgetListBoxSetListLength(listBox,listData->listLength * 2); - //Add the entry to the Listbox - addedIndex = GadgetListBoxAddEntryText( listBox, *(UnicodeString*)mData1, mData2, -1, 0 ); - - // Now resize the list box - ICoord2D winSize; - ICoord2D newSize; - ICoord2D editBoxSize; - Int listX; - Int multiplier; - WinInstanceData *listInstData = listBox->winGetInstanceData(); - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - window->winGetSize(&winSize.x, &winSize.y); - editBox->winGetSize(&editBoxSize.x, &editBoxSize.y); - // If the listbox has less entries then the MaxDisplay, size it smaller - if(comboData->entryCount <= comboData->maxDisplay) - { - multiplier = comboData->entryCount; - listX = winSize.x + 16; - if(listData->upButton) - listData->upButton->winHide(TRUE); - if(listData->downButton) - listData->downButton->winHide(TRUE); - if(listData->slider) - listData->slider->winHide(TRUE); - } - else - { - //Else size it to the MaxDisplay Size - multiplier = comboData->maxDisplay; - listX = winSize.x; - if(listData->upButton) - listData->upButton->winHide(FALSE); - if(listData->downButton) - listData->downButton->winHide(FALSE); - if(listData->slider) - listData->slider->winHide(FALSE); - } - newSize.y = ((TheWindowManager->winFontHeight( listInstData->getFont() ) ) * multiplier) + multiplier * 2 + 4; - listBox->winSetPosition(0, editBoxSize.y); - listBox->winSetSize(listX , newSize.y); - } - - return( (WindowMsgHandledType) addedIndex ); - } - - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { - Int width = (Int)mData1; - Int height = (Int)mData2; - ICoord2D dropDownSize; - - // get needed window sizes - - comboData->dropDownButton->winGetSize( &dropDownSize.x, &dropDownSize.y ); - - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (listBox->winIsHidden()) - { - if (listBox) - listBox->winSetSize(width,height); - - if( comboData->dropDownButton ) - { - comboData->dropDownButton->winSetPosition( width - dropDownSize.x, 0 ); - } - - if( comboData->editBox ) - { - comboData->editBox->winSetPosition( 0, 0 ); - comboData->editBox->winSetSize( width - dropDownSize.x, height ); - } - } - break; - - } - - // ------------------------------------------------------------------------ - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - TheWindowManager->winSetLoneWindow(nullptr); // if we are transitioning screens, close all combo boxes - delete (ComboBoxData *)window->winGetUserData(); - window->winSetUserData(nullptr); - comboData = nullptr; - break; - } - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - // If we're losing focus - if( mData1 == FALSE ) - { - BitClear( instData->m_state, WIN_STATE_HILITED ); - } - else - { - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - Bool wantsFocus = FALSE; - GameWindow *editBox = GadgetComboBoxGetEditBox(window); - // we need to tell the text entry box to take the focus. - TheWindowManager->winSendSystemMsg( editBox, GWM_INPUT_FOCUS, mData1, (WindowMsgData)&wantsFocus ); - - *(Bool*)mData2 = TRUE; - break; - - } - - - case GBM_SELECTED: - { - // See if the drop down button was selected - if( (GameWindow *)mData1 == comboData->dropDownButton ) - { - ICoord2D winSize; - //ICoord2D winPosition; - ICoord2D newSize; - Int listX =0; - Int multiplier; - comboData->dontHide = FALSE; - GameWindow *listBox = GadgetComboBoxGetListBox(window); - if (listBox) - { - TheWindowManager->winSetLoneWindow(window); - // If the Listbox isn't showing, Show it. - if(listBox->winIsHidden()) - { - listBox->winHide(FALSE); - window->winGetSize(&winSize.x, &winSize.y); - WinInstanceData *listInstData = listBox->winGetInstanceData(); - ListboxData *listData = (ListboxData *)listBox->winGetUserData(); - // If we have less entries then our max display is set to, only show - // those entries and not additional blank lines. Also, just so it looks - // pretty, hide the list box's sliders if we don't need to scroll. - if(comboData->entryCount <= comboData->maxDisplay) - { - multiplier = comboData->entryCount; - listX = winSize.x;// + 16; - - if(listData->upButton) - listData->upButton->winHide(TRUE); - if(listData->downButton) - listData->downButton->winHide(TRUE); - if(listData->slider) - listData->slider->winHide(TRUE); - } - else - { - multiplier = comboData->maxDisplay; - listX = winSize.x; - if(listData->upButton) - listData->upButton->winHide(FALSE); - if(listData->downButton) - listData->downButton->winHide(FALSE); - if(listData->slider) - listData->slider->winHide(FALSE); - - } - - newSize.y = ((TheWindowManager->winFontHeight( listInstData->getFont() ) ) * multiplier) + multiplier * 2 + 4; - window->winSetSize(winSize.x , winSize.y + newSize.y ); - listBox->winSetPosition(0, winSize.y); - - listBox->winSetSize(listX , newSize.y); - } - // if the Listbox was showing, hide it. - else - { - HideListBox(window); - } - } - } - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetComboBoxSetColors ==================================================== -/** Set the colors for a Combo box, note that this will also automatically - * change the colors of any attached slider, slider thumb, and slider - * buttons */ -//============================================================================= -void GadgetComboBoxSetColors( GameWindow *comboBox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ) -{ -// ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - // enabled - -// enabled - GadgetComboBoxSetEnabledColor( comboBox, enabledColor); - GadgetComboBoxSetEnabledBorderColor( comboBox, enabledBorderColor ); - GadgetComboBoxSetEnabledSelectedItemColor( comboBox, enabledSelectedItemColor ); - GadgetComboBoxSetEnabledSelectedItemBorderColor( comboBox, enabledSelectedItemBorderColor ); - // disabled - GadgetComboBoxSetDisabledColor( comboBox, disabledColor ); - GadgetComboBoxSetDisabledBorderColor( comboBox, disabledBorderColor ); - GadgetComboBoxSetDisabledSelectedItemColor( comboBox, disabledSelectedItemColor ); - GadgetComboBoxSetDisabledSelectedItemBorderColor( comboBox, disabledSelectedItemBorderColor ); - // hilite - GadgetComboBoxSetHiliteColor( comboBox, hiliteColor ); - GadgetComboBoxSetHiliteBorderColor( comboBox,hiliteBorderColor ); - GadgetComboBoxSetHiliteSelectedItemColor( comboBox, hiliteSelectedItemColor ); - GadgetComboBoxSetHiliteSelectedItemBorderColor( comboBox, hiliteSelectedItemBorderColor ); - - GameWindow *editBox = GadgetComboBoxGetEditBox(comboBox); - if (editBox) - { - // enabled - GadgetButtonSetEnabledColor( editBox, enabledColor ); - GadgetButtonSetEnabledBorderColor( editBox, enabledBorderColor ); - GadgetButtonSetEnabledSelectedColor( editBox, enabledSelectedItemColor ); - GadgetButtonSetEnabledSelectedBorderColor( editBox, enabledSelectedItemBorderColor ); - // disabled - GadgetButtonSetDisabledColor( editBox, disabledColor ); - GadgetButtonSetDisabledBorderColor( editBox, disabledBorderColor ); - GadgetButtonSetDisabledSelectedColor( editBox, disabledSelectedItemColor ); - GadgetButtonSetDisabledSelectedBorderColor( editBox, disabledSelectedItemBorderColor ); - // hilite - GadgetButtonSetHiliteColor( editBox,hiliteColor ); - GadgetButtonSetHiliteBorderColor( editBox, hiliteBorderColor ); - GadgetButtonSetHiliteSelectedColor( editBox, hiliteSelectedItemColor ); - GadgetButtonSetHiliteSelectedBorderColor( editBox, hiliteSelectedItemBorderColor ); - } - - GameWindow *dropDownButton = GadgetComboBoxGetDropDownButton(comboBox); - if (dropDownButton) - { - // enabled - GadgetButtonSetEnabledColor( dropDownButton, enabledColor ); - GadgetButtonSetEnabledBorderColor( dropDownButton, enabledBorderColor ); - GadgetButtonSetEnabledSelectedColor( dropDownButton, enabledSelectedItemColor ); - GadgetButtonSetEnabledSelectedBorderColor( dropDownButton, enabledSelectedItemBorderColor ); - // disabled - GadgetButtonSetDisabledColor( dropDownButton, disabledColor ); - GadgetButtonSetDisabledBorderColor( dropDownButton, disabledBorderColor ); - GadgetButtonSetDisabledSelectedColor( dropDownButton, disabledSelectedItemColor ); - GadgetButtonSetDisabledSelectedBorderColor( dropDownButton, disabledSelectedItemBorderColor ); - // hilite - GadgetButtonSetHiliteColor( dropDownButton,hiliteColor ); - GadgetButtonSetHiliteBorderColor( dropDownButton, hiliteBorderColor ); - GadgetButtonSetHiliteSelectedColor( dropDownButton, hiliteSelectedItemColor ); - GadgetButtonSetHiliteSelectedBorderColor( dropDownButton, hiliteSelectedItemBorderColor ); - } - - GameWindow * listBox = GadgetComboBoxGetListBox( comboBox ); - if ( listBox ) - { - GadgetListBoxSetColors(listBox, - enabledColor, - enabledBorderColor, - enabledSelectedItemColor, - enabledSelectedItemBorderColor, - disabledColor, - disabledBorderColor, - disabledSelectedItemColor, - disabledSelectedItemBorderColor, - hiliteColor, - hiliteBorderColor, - hiliteSelectedItemColor, - hiliteSelectedItemBorderColor ); - } -} - -// GadgetComboBoxSetIsEditable ================================================ -/** Sets up the Text Entry gadget as editable or not */ -//============================================================================= -void GadgetComboBoxSetIsEditable(GameWindow *comboBox, Bool isEditable ) -{ - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - GameWindow *editBox = GadgetComboBoxGetEditBox(comboBox); - UnsignedInt status ; - if(!editBox) - return; - - comboData->isEditable = isEditable; - if (isEditable) - { - status = editBox->winGetStatus(); - - BitClear(status, WIN_STATUS_NO_INPUT); -// BitClear(status, WIN_STATUS_NO_FOCUS); - editBox->winSetStatus(status); - } - else - { - status = editBox->winGetStatus(); - - BitSet(status, WIN_STATUS_NO_INPUT); -// BitSet(status, WIN_STATUS_NO_FOCUS); - editBox->winSetStatus(status); - } -} - -// GadgetComboBoxSetIsAsciiOnly ================================================== -/** Get the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetLettersAndNumbersOnly(GameWindow *comboBox, Bool isLettersAndNumbersOnly) -{ - //sanity - if(comboBox == nullptr) - return; - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - - comboData->lettersAndNumbersOnly = isLettersAndNumbersOnly; - if(comboData->entryData) - comboData->entryData->alphaNumericalOnly = isLettersAndNumbersOnly; - -} - -// GadgetComboBoxSetAsciiOnly ================================================== -/** Get the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetAsciiOnly(GameWindow *comboBox, Bool isAsciiOnly ) -{ - //sanity - if(comboBox == nullptr) - return; - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - - comboData->asciiOnly = isAsciiOnly; - if(comboData->entryData) - comboData->entryData->aSCIIOnly = isAsciiOnly; - -} - -// GadgetComboBoxSetMaxChars ================================================== -/** Get the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetMaxChars( GameWindow *comboBox, Int maxChars ) -{ - //sanity - if(comboBox == nullptr) - return; - - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - comboData->maxChars = maxChars; - comboData->entryData->maxTextLen = maxChars; - -} - -// GadgetComboBoxSetMaxDisplay ================================================ -/** Sets the MaxDisplay variable to the new Max Display */ -//============================================================================= -void GadgetComboBoxSetMaxDisplay( GameWindow *comboBox, Int maxDisplay ) -{ - ComboBoxData *comboData = (ComboBoxData *)comboBox->winGetUserData(); - comboData->maxDisplay = maxDisplay; - -} - -// GadgetComboBoxGetText ======================================================= -/** Get the text the Combo Box */ -//============================================================================= -UnicodeString GadgetComboBoxGetText( GameWindow *comboBox ) -{ - - // sanity - if( comboBox == nullptr ) - return UnicodeString::TheEmptyString; - - // verify that this is a combo box - if( BitIsSet( comboBox->winGetStyle(), GWS_COMBO_BOX ) == FALSE ) - return UnicodeString::TheEmptyString; - - return GadgetTextEntryGetText( GadgetComboBoxGetEditBox(comboBox) ); -} - -// GadgetComboBoxSetText ======================================================= -/** Set the text the Combo Box */ -//============================================================================= -void GadgetComboBoxSetText( GameWindow *comboBox, UnicodeString text ) -{ - if( comboBox == nullptr ) - return; - - GadgetTextEntrySetText(GadgetComboBoxGetEditBox(comboBox), text); -} - -// GadgetComboBoxAddEntry ======================================================= -/** Convenience wrapper function for adding an entry */ -//============================================================================= -Int GadgetComboBoxAddEntry( GameWindow *comboBox, UnicodeString text, Color color ) -{ - // sanity - if( comboBox == nullptr ) - return -1; - return (Int)TheWindowManager->winSendSystemMsg( comboBox, GCM_ADD_ENTRY, (WindowMsgData)&text, color ); -} -// GadgetComboBoxReset ======================================================= -/** Convenience wrapper function for resetting the Combo Box entries */ -//============================================================================= -void GadgetComboBoxReset( GameWindow *comboBox ) -{ - // sanity - if( comboBox == nullptr ) - return; - // reset via system message - TheWindowManager->winSendSystemMsg( comboBox, GCM_DEL_ALL, 0, 0 ); -} -// GadgetComboBoxHideList ======================================================= -/** Convenience wrapper function hiding the list */ -//============================================================================= -void GadgetComboBoxHideList( GameWindow *comboBox ) -{ - // sanity - if( comboBox == nullptr ) - return; - // reset via system message - TheWindowManager->winSendSystemMsg( comboBox, GGM_CLOSE, 0, 0 ); -} -// GadgetComboBoxSetFont ======================================================= -/** Function used to set the Font of the combo box and all sub gadgets */ -//============================================================================= -void GadgetComboBoxSetFont( GameWindow *comboBox, GameFont *font ) -{ - // sanity - if( comboBox == nullptr ) - return; - - // set the ListBox gadget's font - GameWindow *listBox = GadgetComboBoxGetListBox(comboBox); - if(listBox) - listBox->winSetFont( font); - - // set the Text Entry gadget's font - GameWindow *editBox = GadgetComboBoxGetEditBox(comboBox); - if(editBox) - editBox->winSetFont(font); - - //Need to setup the default window font - DisplayString *dString; - - // set the font for the display strings all windows have - dString = comboBox->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = comboBox->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); -} - -// GadgetComboBoxSetEnabledTextColors ========================================= -/** Set the Enabled Text Colors for the Sub Gadgets*/ -//============================================================================= -void GadgetComboBoxSetEnabledTextColors(GameWindow *comboBox, Color color, Color borderColor ) -{ - // sanity - if( comboBox == nullptr ) - return; - - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - if(comboBoxData->listBox) - comboBoxData->listBox->winSetEnabledTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetEnabledTextColors(color,borderColor); -} -// GadgetComboBoxSetDisabledTextColors ======================================== -/** Set the Disabled Text Colors for the Sub Gadgets */ -//============================================================================= -void GadgetComboBoxSetDisabledTextColors(GameWindow *comboBox, Color color, Color borderColor ) -{ - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - // sanity - if( comboBox == nullptr ) - return; - - if(comboBoxData->listBox) - comboBoxData->listBox->winSetDisabledTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetDisabledTextColors(color,borderColor); -} -// GadgetComboBoxSetHiliteTextColors ========================================== -/** Set the Hilite Text Colors for the Sub Gadgets */ -//============================================================================= -void GadgetComboBoxSetHiliteTextColors( GameWindow *comboBox,Color color, Color borderColor ) -{ - // sanity - if( comboBox == nullptr ) - return; - - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - - if(comboBoxData->listBox) - comboBoxData->listBox->winSetHiliteTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetHiliteTextColors(color,borderColor); -} -// GadgetComboBoxSetIMECompositeTextColors ==================================== -/** Set the IME Composite Text Colors Text Colors for the Sub Gadgets */ -//============================================================================= -void GadgetComboBoxSetIMECompositeTextColors(GameWindow *comboBox, Color color, Color borderColor ) -{ - // sanity - if( comboBox == nullptr ) - return; - - ComboBoxData *comboBoxData = (ComboBoxData *)comboBox->winGetUserData(); - - if(comboBoxData->listBox) - comboBoxData->listBox->winSetIMECompositeTextColors( color,borderColor); - if(comboBoxData->editBox) - comboBoxData->editBox->winSetIMECompositeTextColors(color,borderColor); -} - -// GadgetComboBoxGetSelectedPos =============================================== -/** Convenience wrapper function for getting the selected Position */ -//============================================================================= -void GadgetComboBoxGetSelectedPos( GameWindow *comboBox, Int *selectedIndex ) -{ - // sanity - if( comboBox == nullptr ) - return; - - // get selected indices via system message - TheWindowManager->winSendSystemMsg( comboBox, GCM_GET_SELECTION, 0, (WindowMsgData)selectedIndex ); -} - -// GadgetComboBoxSetSelectedPos =============================================== -/** Convenience wrapper function for setting the selected Position, if don't hide - is set to true, the listbox won't be forced to hide when the Selected call is - passed back */ -//============================================================================= -void GadgetComboBoxSetSelectedPos( GameWindow *comboBox, Int selectedIndex, Bool dontHide ) -{ - // sanity - if( comboBox == nullptr ) - return; - - // get selected indices via system message - TheWindowManager->winSendSystemMsg( comboBox, GCM_SET_SELECTION, selectedIndex, dontHide ); -} -// GadgetComboBoxSetItemData ================================================== -/** Convenience wrapper function for setting the Item data for the listbox under the combo box */ -//============================================================================= -void GadgetComboBoxSetItemData( GameWindow *comboBox, Int index, void *data ) -{ - if (comboBox) - TheWindowManager->winSendSystemMsg( comboBox, GCM_SET_ITEM_DATA, index, (WindowMsgData)data); -} -// GadgetComboBoxGetItemData ================================================== -/** Convenience wrapper function for getting the Item data from the listbox under the combo Box */ -//============================================================================= -void *GadgetComboBoxGetItemData( GameWindow *comboBox, Int index ) -{ - void *data = nullptr; - - if (comboBox) - { - TheWindowManager->winSendSystemMsg( comboBox, GCM_GET_ITEM_DATA, index, (WindowMsgData)&data); - } - return (data); -} - -// GadgetComboBoxGetLength ================================================= -/** Get the list length data contained in the listboxData - * parameter. */ -//============================================================================= -Int GadgetComboBoxGetLength( GameWindow *combobox ) -{ - ComboBoxData *comboboxData = (ComboBoxData *)combobox->winGetUserData(); - if (comboboxData) - return comboboxData->entryCount; - - return 0; -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp deleted file mode 100644 index cd943ef7a47..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp +++ /dev/null @@ -1,2825 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetListBox.cpp //////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: ListBox.cpp -// -// Created: Dean Iverson, March 1998 -// Colin Day, June 2001 -// -// Desc: ListBox GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/AudioEventRTS.h" -#include "Common/Language.h" -#include "Common/Debug.h" -#include "Common/GameAudio.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetListBox.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/GadgetSlider.h" -#include "GameClient/GameWindowGlobal.h" -#include "GameClient/Keyboard.h" - - -// DEFINES //////////////////////////////////////////////////////////////////// -// Sets up the user's OS set doubleclick time so if they don't like it... they can -// change it in their OS. -static UnsignedInt doubleClickTime = GetDoubleClickTime(); - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// -typedef struct _AddMessageStruct -{ - Int row; // The row to add the data to - Int column; // The column to add the data to - const void *data; // void pointer, can be either an DisplayString or an Image - Int type; // Can either be set to LISTBOX_TEXT or LISTBOX_IMAGE - Bool overwrite; // Do we overwrite existing data? - Int width; // set to -1 if we want the defaults - Int height; // set to -1 if we want the defaults -} AddMessageStruct; - - -typedef struct _TextAndColor -{ - UnicodeString string; // Holds a unicode String - Color color; // holds a text's color -} TextAndColor; - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -static void doAudioFeedback(GameWindow *window) -{ - if (!window) - return; - - ListboxData *lData = (ListboxData *)window->winGetUserData(); - if (!lData) - return; - - if (lData->audioFeedback) - { - AudioEventRTS buttonClick("GUIComboBoxClick"); - - if( TheAudio ) - { - TheAudio->addAudioEvent( &buttonClick ); - } - } -} - -static Int getListboxEntryBasedOnCoord(GameWindow *window, Int x, Int y, Int &row, Int &column) -{ - Int pos; - Int winx, winy, i; - WinInstanceData *instData = window->winGetInstanceData(); - ListboxData *list = (ListboxData *)window->winGetUserData(); - - window->winGetScreenPosition( &winx, &winy ); - - // Adjust for title if present - if( instData->getTextLength() ) - winy += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - pos = -2; - - for( i=0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - pos = -1; - break; - } - - if( i == list->endPos ) - { - pos = -1; - break; - } - - if( list->listData[i].listHeight > (y - winy + list->displayPos) ) - break; - } - - column = -1; - if( pos == -2 ) - { - pos = i; - Int total = 0; - for( i = 0; i < list->columns ;i++) - { - total += list->columnWidth[i]; - if(x - winx < total) - { - column = i; - break; - } - } - } - row = pos; - return pos; -} - -Int GadgetListBoxGetEntryBasedOnXY( GameWindow *listbox, Int x, Int y, Int &row, Int &column) -{ - return getListboxEntryBasedOnCoord( listbox, x, y, row, column ); - -} - -// getListboxTopEntry ========================================================= -//============================================================================= -static Int getListboxTopEntry( ListboxData *list ) -{ - Int entry; - - // determine which entry is at the top of the display area - for( entry=0; ; entry++ ) - { - if( list->listData[entry].listHeight > list->displayPos ) - return entry; - - if( entry >= list->endPos ) - return 0; - } - - return 0; -} - -// getListboxTopEntry ========================================================= -//============================================================================= -static Int getListboxBottomEntry( ListboxData *list ) -{ - Int entry; - - // determine which entry is at the top of the display area - for( entry=list->endPos - 1; ; entry-- ) - { - if( entry < 0 ) - return 0; - if( list->listData[entry].listHeight == list->displayPos + list->displayHeight ) - return entry; - if( list->listData[entry].listHeight < list->displayPos + list->displayHeight && entry != list->endPos - 1) - return entry + 1; - if( list->listData[entry].listHeight < list->displayPos + list->displayHeight) - return entry; - } - - return 0; -} - - -// removeSelection ============================================================ -/** Remove Selection from a multiple selection list */ -//============================================================================= -static void removeSelection( ListboxData *list, Int i ) -{ - memcpy( &list->selections[i], &list->selections[(i+1)], - ((list->listLength - i) * sizeof(Int)) ); - - // put -1 at end of list just for safety - list->selections[(list->listLength - 1)] = -1; -} - -// adjustDisplay ============================================================== -/** Update Display List information including scrollbar */ -//============================================================================= -static void adjustDisplay( GameWindow *window, Int adjustment, - Bool updateSlider ) -{ - Int entry; - SliderData *sData; - ListboxData *list = (ListboxData *)window->winGetUserData(); - - // determine which entry is at the top of the display area - entry = getListboxTopEntry( list ) + adjustment; - - if( entry < 0 ) - entry = 0; - else if( entry >= list->endPos ) - entry = list->endPos - 1; - - if( updateSlider ) - { - if( entry > 0 ) - list->displayPos = list->listData[(entry - 1)].listHeight + 1; - else - list->displayPos = 0; - } - - if( list->slider != nullptr ) - { - ICoord2D sliderSize, sliderChildSize; - GameWindow *child; - - sData = (SliderData *)list->slider->winGetUserData(); - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - // Take into account that there is a line-drawn outline surrounding listbox - sData->maxVal = list->totalHeight - ( list->displayHeight - TOTAL_OUTLINE_HEIGHT ) + 1; - - if( sData->maxVal < 0 ) - { - sData->maxVal = 0; - } - - child = list->slider->winGetChild(); - child->winGetSize( &sliderChildSize.x, &sliderChildSize.y ); - sData->numTicks = (float)((sliderSize.y - sliderChildSize.y) / (float)sData->maxVal); - - if( updateSlider ) - TheWindowManager->winSendSystemMsg( list->slider, - GSM_SET_SLIDER, - (sData->maxVal - list->displayPos), - 0 ); - } - -} - -// computeTotalHeight ========================================================= -/** Compute Total Height and fill in listHeight values */ -//============================================================================= -static void computeTotalHeight( GameWindow *window ) -{ - Int i, height = 0; - Int tempHeight; - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - for( i=0; iendPos; i++ ) - { - - if(!list->listData[i].cell) - continue; - tempHeight = 0; - - for (Int j = 0; j < list->columns; j++) - { - Int cellHeight = 0; - if(list->listData[i].cell[j].cellType == LISTBOX_TEXT) - { - if( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) == TRUE ) - { - cellHeight = TheWindowManager->winFontHeight( instData->getFont() ); - } - else - { - DisplayString *displayString = (DisplayString *)list->listData[i].cell[j].data; - if(displayString) - displayString->getSize( nullptr, &cellHeight ); - } - } - else if(list->listData[i].cell[j].cellType == LISTBOX_IMAGE) - { - if(list->listData[i].cell[j].height > 0) - cellHeight = list->listData[i].cell[j].height + 1; - else - cellHeight = TheWindowManager->winFontHeight( instData->getFont() ); - } - if(cellHeight > tempHeight) - tempHeight = cellHeight; - } - list->listData[i].height = tempHeight; - height += (list->listData[i].height + 1); - list->listData[i].listHeight = height; - } - - list->totalHeight = height; - - adjustDisplay( window, 0, TRUE ); -} - -// addImageEntry ============================================================== -/** Add Images to position and column. Row and Column are both based from starting - Position 0 */ -//============================================================================= -static Int addImageEntry( const Image *image, Color color, Int row, Int column, GameWindow *window, Bool overwrite, Int width, Int height ) -{ -// WinInstanceData *instData = window->winGetInstanceData(); - ListboxData *list = (ListboxData *)window->winGetUserData(); - - if( column >= list->columns || row >= list->listLength ) - { - DEBUG_CRASH(("Tried to add Image to Listbox at invalid position")); - return -1; - } - - // If we want to just add an entry to the bottom, set the defaults - if (row == -1) - { - row = list->insertPos; - list->insertPos++; - list->endPos++; - } - if( column == -1 ) - column = 0; - - ListEntryRow *listRow = &list->listData[row]; - - // Check and see if we have allocated cells for that row yet, if not, allocate them - if(!listRow->cell) - { - listRow->cell = NEW ListEntryCell[list->columns]; - memset(listRow->cell,0,list->columns * sizeof(ListEntryCell)); - } - // if we're copying over strings, then lets first deallocate them. - if(listRow->cell[column].cellType == LISTBOX_TEXT) - { - TheDisplayStringManager->freeDisplayString((DisplayString *)listRow->cell[column].data); - - } - //add Image to selected row/cell - listRow->cell[column].cellType = LISTBOX_IMAGE; - listRow->cell[column].data = (void *)image; - listRow->cell[column].color = color; - listRow->cell[column].height = height; - listRow->cell[column].width = width; - - computeTotalHeight( window ); - - return (row); - -} - -// startingRow will get moved to startingRow+1, etc. This assumes there is space!!!!! -static Int moveRowsDown(ListboxData *list, Int startingRow) -{ - // - // copy the cells down - // - Int copyLen = (list->endPos - startingRow) * sizeof(ListEntryRow); - char *buf = NEW char[copyLen]; - memcpy(buf, list->listData + startingRow, copyLen); - memcpy(list->listData + startingRow + 1, buf, copyLen ); - delete[] buf; - - list->endPos ++; - list->insertPos = list->endPos; - - // - // remove the display or links to images after the shift - // - list->listData[startingRow].cell = nullptr; - list->listData[startingRow].height = 0; - list->listData[startingRow].listHeight = 0; - - if( list->multiSelect ) - { - Int i = 0; - - while( list->selections[i] >= 0 ) - { - if( startingRow <= list->selections[i] ) - list->selections[i]++; - i++; - } - } - else - { - if( list->selectPos >= startingRow ) - list->selectPos++; - } - - /* - if( list->displayPos > 0 ) - adjustDisplay( window, (-1 * mData1), TRUE ); - - computeTotalHeight( window ); - */ - - return 1; -} - -// addEntry =================================================================== -/** Add and process one string at insertPos */ -//============================================================================= -static Int addEntry( UnicodeString *string, Int color, Int row, Int column, GameWindow *window, Bool overwrite ) -{ -// WinInstanceData *instData = window->winGetInstanceData(); - ListboxData *list = (ListboxData *)window->winGetUserData(); - Int width; - DisplayString *displayString; - - // make sure our params are good - if( column >= list->columns || row >= list->listLength ) - { - DEBUG_CRASH(("Tried to add text to Listbox at invalid position")); - return -1; - } - - // If we want to just add an entry to the bottom, set the defaults - if (row == -1) - { - row = list->insertPos; - list->insertPos++; - list->endPos++; - } - if( column == -1 ) - column = 0; - - width = list->columnWidth[column] - TEXT_WIDTH_OFFSET; - - Int rowsAdded = 0; - - ListEntryRow *listRow = &list->listData[row]; - // Here I've decided to just overwrite what's in the row, if that's not what we want, change it here - // Check and see if we have allocated cells for that row yet, if not, allocate them - if(!listRow->cell) - { - listRow->cell = NEW ListEntryCell[list->columns]; - memset(listRow->cell,0,list->columns * sizeof(ListEntryCell)); - rowsAdded = 1; - } - else if (!overwrite) - { - // Shove things down - moveRowsDown(list, row); - listRow->cell = NEW ListEntryCell[list->columns]; - memset(listRow->cell,0,list->columns * sizeof(ListEntryCell)); - rowsAdded = 1; - } - - //add Image to selected row/cell - listRow->cell[column].cellType = LISTBOX_TEXT; - - // assign the color to the list data element - listRow->cell[column].color = color; - - // copy text - if( !listRow->cell[column].data ) - listRow->cell[column].data = (void *) TheDisplayStringManager->newDisplayString(); - displayString = (DisplayString *) listRow->cell[column].data; - if ( BitIsSet( window->winGetStatus(), WIN_STATUS_ONE_LINE ) == FALSE ) - displayString->setWordWrap( width ); - displayString->setText( *string ); - - /** @todo we need for formalize this, but for now just set the font - of this listbox entry to the font of the window */ - displayString->setFont( window->winGetFont() ); - - if (overwrite) - { - Int oldRowHeight = listRow->height; - Int oldTotalHeight = listRow->listHeight; - Int rowHeight; - Int totalHeight; - - if (!oldTotalHeight && row) - { - oldTotalHeight = list->listData[row-1].listHeight; - } - - displayString->getSize( nullptr, &rowHeight ); - if (rowHeight > oldRowHeight) - { - totalHeight = oldTotalHeight + (rowHeight - oldRowHeight); - listRow->height = rowHeight; - listRow->listHeight = totalHeight + rowsAdded; - list->totalHeight += (rowHeight - oldRowHeight) + rowsAdded; - adjustDisplay( window, 0, TRUE ); - } - } - else - { - computeTotalHeight( window ); - } - - return (row); -} - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetListBoxInput ========================================================= -/** Handle input for list box */ -//============================================================================= -WindowMsgHandledType GadgetListBoxInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch (msg) - { - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch (mData1) - { - - // -------------------------------------------------------------------- - case KEY_ENTER: - case KEY_SPACE: - { - - if( BitIsSet( mData2, KEY_STATE_UP ) ) - { - doAudioFeedback(window); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_DOUBLE_CLICKED, - (WindowMsgData)window, - list->selectPos ); - } - - break; - - } - - // -------------------------------------------------------------------- - case KEY_DOWN: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( list->selectPos == -1 ) - { - list->selectPos = 0; - adjustDisplay( window, 0, TRUE ); - } - else if( list->selectPos < list->endPos - 1 ) - { - - list->selectPos++; - - while (1) - { - Int cellBottom = list->listData[list->selectPos].listHeight; - Int cellTop = cellBottom - list->listData[list->selectPos].height; - Int displayTop = list->displayPos; - Int displayBottom = list->displayPos + list->displayHeight - 1; // account for the border - - if ( cellTop < displayTop ) - { - adjustDisplay(window, -1, TRUE ); - } - else if ( cellBottom < displayBottom ) - { - adjustDisplay(window, 0, TRUE ); - break; - } - else - { - adjustDisplay(window, 1, TRUE ); - } - } - - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - } - - break; - - } - - // -------------------------------------------------------------------- - case KEY_UP: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( list->selectPos == -1 ) - { - list->selectPos = 0; - adjustDisplay( window, 0, TRUE ); - } - else if( list->selectPos > 0 ) - { - - list->selectPos--; - - while (1) - { - if( list->listData[list->selectPos].listHeight - list->listData[list->selectPos].height < list->displayPos ) - { - list->displayPos = list->listData[list->selectPos].listHeight +1; - adjustDisplay( window, -1, TRUE ); - } - else if( list->listData[list->selectPos].listHeight > list->displayPos + list->displayHeight) - { - list->displayPos = list->listData[list->selectPos].listHeight - list->displayHeight; - adjustDisplay(window, 1, TRUE); - } - else - { - adjustDisplay(window, 0, TRUE); - break; - } - } - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - } - - break; - - } - - // -------------------------------------------------------------------- - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winNextTab(window); - break; - - // -------------------------------------------------------------------- - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - TheWindowManager->winPrevTab(window); - break; - - // -------------------------------------------------------------------- - default: - { - Bool foundIt = false; - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // set the position to start looking for the line of text with this character - Int position = list->selectPos; - // only search the max number of times so that we're not looping over and over - for(Int i = 0; i < list->endPos; ++i) - { - // start at the next position - ++position; - // if we've reached the end of the list, start at the beginning - if( position >= list->endPos) - position = 0; - - ListEntryCell *cell = nullptr; - // go through the columns until we find a column with text - Int j = 0; - for(; j < list->columns; ++j) - { - cell = &list->listData[position].cell[j]; - if(cell && cell->cellType == LISTBOX_TEXT && cell->data) - { - break; - } - } - if(!cell || cell->cellType != LISTBOX_TEXT) - continue; - DisplayString *dString = (DisplayString *)cell->data; - if(!dString) - continue; - for(j = 0; j < TheKeyboard->MAX_KEY_STATES; ++j) - { - if(dString->getText().getCharAt(0) == TheKeyboard->getPrintableKey((KeyDefType)mData1, j)) - { - list->selectPos = position; - Int prevPos = getListboxTopEntry(list); - //list->displayPos = list->listData[position].listHeight - list->displayHeight; - adjustDisplay(window, position - prevPos, TRUE); - foundIt = TRUE; - break; - } - } - if(foundIt) - { - doAudioFeedback(window); - break; - } - - } - - - } - - if (!foundIt) - return MSG_IGNORED; - } - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_DOWN: - { - if( list->endPos <= 0) - break; - - if (list->listData[list->endPos - 1].listHeight > list->displayHeight + list->displayPos) - adjustDisplay( window, 1, TRUE ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_UP: - { - if( list->endPos <= 0) - break; - - adjustDisplay( window, -1, TRUE ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - TheWindowManager->winSetFocus( window ); -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - Int oldPos = list->selectPos; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - list->selectPos = -2; - - for( i=0; ; i++ ) - { - - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight) ) - { - list->selectPos = -1; - break; - } - - if( i == list->endPos ) - { - list->selectPos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - //Bool dblClicked = FALSE; - if( list->doubleClickTime + doubleClickTime > timeGetTime() && - (i == oldPos || (oldPos == -1 && ( i>=0 && iendPos ) )) ) - { - int temp; - list->doubleClickTime = 0; - if( oldPos == -1 ) - temp = i; - else - temp = oldPos; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_DOUBLE_CLICKED, - (WindowMsgData)window, - temp ); - //break; - } - if( (i == oldPos) && (list->forceSelect == FALSE) ) - { - list->selectPos = -1; - } - - if( (list->selectPos == -2) && (i < list->endPos) ) - { - list->selectPos = i; - } - - if( (list->selectPos < 0) && (list->forceSelect) ) - { - list->selectPos = oldPos; - } - list->doubleClickTime = timeGetTime(); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_DOWN: - doAudioFeedback(window); - break; // if we're in game, we want to eat this message because we're right clicking on a listbox - case GWM_RIGHT_UP: - { - TheWindowManager->winSetFocus( window ); - Int pos; - Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - RightClickStruct rc; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - pos = -2; - - for( i=0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - pos = -1; - break; - } - - if( i == list->endPos ) - { - pos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( pos == -2 ) - pos = i; - - rc.pos = pos; - rc.mouseX = mousex; - rc.mouseY = mousey; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_RIGHT_CLICKED, - (WindowMsgData)window, - (WindowMsgData)&rc ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - 0 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - doAudioFeedback(window); - // we want to eat the down... so we may receive the up. - return MSG_HANDLED; - - //------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetListBoxMultiInput ==================================================== -/** Handle input for multiple selection list box */ -//============================================================================= -WindowMsgHandledType GadgetListBoxMultiInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_TAB: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - default: - return MSG_IGNORED; - } - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - //case GWM_LEFT_CLICK: - { - TheWindowManager->winSetFocus( window ); -// Int *selections = list->selections; - Int selectPos = -2; -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - Bool removed = FALSE; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - for( i = 0; ; i++ ) - { - - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - selectPos = -1; - break; - } - - if( i == list->endPos ) - { - selectPos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( selectPos == -2 ) - selectPos = i; - - i = 0; - while( list->selections[i] >= 0 ) - { - if( list->selections[i] == selectPos ) - { - removeSelection( list, i ); - removed = TRUE; - break; - } - - i++; - } - - if( removed == FALSE ) - { - list->selections[ i] = selectPos; - list->selections[ i + 1 ] = -1; - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - selectPos ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_RIGHT_UP: - { -/* - Int selectPos = -2; -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - for( i = 0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - selectPos = -1; - break; - } - - if( i == list->endPos ) - { - selectPos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( selectPos == -2 ) - selectPos = i; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_RIGHT_CLICKED, - (WindowMsgData)window, - selectPos );*/ - TheWindowManager->winSetFocus( window ); - Int pos; - Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - Int x, y, i; - RightClickStruct rc; - - window->winGetScreenPosition( &x, &y ); - - // Adjust for title if present - if( instData->getTextLength() ) - y += TheWindowManager->winFontHeight( instData->getFont() ) + 1; - - pos = -2; - - for( i=0; ; i++ ) - { - if( i > 0 ) - if( list->listData[ i - 1 ].listHeight > - (list->displayPos + list->displayHeight ) ) - { - pos = -1; - break; - } - - if( i == list->endPos ) - { - pos = -1; - break; - } - - if( list->listData[i].listHeight > (mousey - y + list->displayPos) ) - break; - } - - if( pos == -2 ) - pos = i; - - rc.pos = pos; - rc.mouseX = mousex; - rc.mouseY = mousey; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_RIGHT_CLICKED, - (WindowMsgData)window, - (WindowMsgData)&rc ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_WHEEL_DOWN: - - // Simulate the down button if it exists - if( list->downButton ) - { - if( list->displayPos + list->displayHeight <= list->totalHeight ) - adjustDisplay( window, 1, TRUE ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_WHEEL_UP: - - // Simulate the up button if it exists - if( list->upButton ) - { - if( list->displayPos > 0 ) - adjustDisplay( window, -1, TRUE ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - 0 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - doAudioFeedback(window); - // we want to eat the down... so we may receive the up. - return MSG_HANDLED; - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetListBoxSystem ======================================================== -/** Handle system messages for list box */ -//============================================================================= -WindowMsgHandledType GadgetListBoxSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - ListboxData *list = (ListboxData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ICoord2D *pos; - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - instData->setText(*(UnicodeString*)mData1); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_GET_TEXT: - { - pos = (ICoord2D *)mData1; - TextAndColor *tAndC = (TextAndColor *)mData2; - - if(pos->x >= list->columns || pos->y >= list->listLength || - list->listData[pos->y].cell[pos->x].cellType != LISTBOX_TEXT) - { - tAndC->string = UnicodeString::TheEmptyString; - tAndC->color = 0; - } - else - { - tAndC->string = ((DisplayString *)list->listData[ pos->y ].cell[pos->x].data)->getText(); - tAndC->color = list->listData[ pos->y ].cell[pos->x].color; - } - break; - } - - // ------------------------------------------------------------------------ - case GBM_SELECTED: - { - - // See if the up button was selected - if( (GameWindow *)mData1 == list->upButton ) - { - if( list->displayPos > 0 ) - adjustDisplay( window, -1, TRUE ); - } - else if( (GameWindow *)mData1 == list->downButton ) - { - if( list->displayPos + list->displayHeight <= list->totalHeight ) - adjustDisplay( window, 1, TRUE ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { - - if( (GameWindow *)mData1 == list->upButton ) - { - if( list->displayPos > 0 ) - adjustDisplay( window, -1, TRUE ); - } - else if( (GameWindow *)mData1 == list->downButton ) - { - if( list->displayPos + list->displayHeight <= list->totalHeight ) - adjustDisplay( window, 1, TRUE ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_DEL_ALL: - { - - // - // Reset the listbox by freeing all the display string stuff and setting - // everything else to zero - // - // Loop through and destroy any display strings we've allocated that aren't used - for( Int i = 0; i < list->listLength; i++ ) - { - // Loop though - ListEntryCell *cells = list->listData[i].cell; - for (int j = list->columns - 1; j >=0; j-- ) - { - if(!cells) - break; - if( cells[j].cellType == LISTBOX_TEXT ) - { - if ( cells[j].data ) - { - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - } - } - - cells[j].userData = nullptr; - cells[j].data = nullptr; - } - delete[](list->listData[i].cell); - list->listData[i].cell = nullptr; - } - //zero out the header structure - memset(list->listData,0,list->listLength * sizeof(ListEntryRow)); - - if( mData1 != GP_DONT_UPDATE ) - { - list->displayPos = 0; - } - - if( list->multiSelect ) - memset( list->selections, -1, list->listLength * sizeof( Int ) ); - else - list->selectPos = -1; - - list->insertPos = 0; - list->endPos = 0; - - list->totalHeight = 0; - - adjustDisplay( window, 0, TRUE ); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_DEL_ENTRY: - { - Int i; - - if( list->endPos <= (Int)mData1 ) - break; - - ListEntryCell *cells = list->listData[mData1].cell; - if(cells) - for( i = 0; i <= list->columns; i ++ ) - { - if( cells[i].cellType == LISTBOX_TEXT && cells[i].data ) - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[i].data ); - cells[i].data = nullptr; - cells[i].userData = nullptr; - } - - delete[](list->listData[mData1].cell); - list->listData[mData1].cell = nullptr; - - memcpy( &list->listData[mData1], &list->listData[(mData1+1)], - (list->endPos - mData1 - 1) * sizeof(ListEntryRow) ); - - list->endPos--; - list->insertPos = list->endPos; - - if( list->multiSelect ) - { - i = 0; - - while( list->selections[i] >= 0 ) - { - if( (Int)mData1 < list->selections[i] ) - list->selections[i]--; - else if ( (Int)mData1 == list->selections[i] ) - { - removeSelection( list, i ); - i--; // compensate for lost entry - } - - i++; - } - } - else - { - if( (Int)mData1 < list->selectPos ) - list->selectPos--; - else if ( (Int)mData1 == list->selectPos ) - list->selectPos = -1; - } - - computeTotalHeight( window ); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_ADD_ENTRY: - { - Bool success = TRUE; - Int addedIndex = -1; - AddMessageStruct *addInfo = (AddMessageStruct*)mData1; - if (addInfo->row >= list->insertPos) - addInfo->row = -1; - - Int row = addInfo->row; - // Special case, we're just appending and we've reached the end. - if( addInfo->row == -1 && list->insertPos == list->listLength ) - { - row = list->insertPos; - // Check to see if we've filled our buffer and need to scroll the window - if( list->insertPos == list->listLength ) - { - if( list->autoPurge ) - TheWindowManager->winSendSystemMsg( window, GLM_SCROLL_BUFFER, 1, 0 ); - else - success = FALSE; - } - } - else if (addInfo->row != -1 && !addInfo->overwrite && list->insertPos == list->listLength) - { - // We're inserting into the middle with no space - see if we can scroll the window - if( list->autoPurge ) - TheWindowManager->winSendSystemMsg( window, GLM_SCROLL_BUFFER, 1, 0 ); - else - success = FALSE; - } - - if(success) - { - if( addInfo->type == LISTBOX_TEXT ) - { - addedIndex = addEntry( (UnicodeString *)addInfo->data, mData2, addInfo->row, addInfo->column, window, addInfo->overwrite ); - } - else if ( addInfo->type == LISTBOX_IMAGE ) - { - addedIndex = addImageEntry( (const Image *)addInfo->data, mData2, addInfo->row, addInfo->column, window, addInfo->overwrite,addInfo->width, addInfo->height ); - } - else - success = FALSE; - } - - if( success ) - { - - if( list->autoScroll ) - { - - while( TRUE ) - { - // If off bottom of screen, scroll and try again. - // we use -1 because insertPos was increased in addEntry - if( row == -1 ) - { - if( list->listData[(list->insertPos - 1)].listHeight >= - (list->displayPos + list->displayHeight) ) - adjustDisplay( window, 1, TRUE ); - else - break; - } - else - { - if( list->listData[( row )].listHeight >= - (list->displayPos + list->displayHeight) ) - adjustDisplay( window, 1, TRUE ); - else - break; - } - } - - } - - if( list->multiSelect ) - { - Int i = 0; - - while( list->selections[i] >= 0 ) - { - - if( (row = list->selections[i]) != 0 ) - list->selections[i] = -1; - - i++; - - } - - } - else - { - if( row == list->selectPos ) - list->selectPos = -1; - } - - } - - return((WindowMsgHandledType) addedIndex ); - - } - - // ------------------------------------------------------------------------ - case GLM_TOGGLE_MULTI_SELECTION: - { - - if( (Int)mData1 < 0 ) - { - // a negative number will purge the entire list. - if( list->multiSelect ) - memset( list->selections, -1, list->listLength * sizeof(Int) ); - else - { - // this message has no effect in a non-multi listbox - } - - break; - } - - // if there is no cells we shouldn't be selecting this entry - if( !list->listData[ mData1 ].cell ) - break; - - if( list->multiSelect ) - { - Int i = 0; - Bool removed = FALSE; - - while( list->selections[i] >= 0 ) - { - if( list->selections[i] == (Int)mData1 ) - { - removeSelection( list, i ); - removed = TRUE; - break; - } - - i++; - } - - if( removed == FALSE ) - { - list->selections[i] = (Int)mData1; - list->selections[i+1] = -1; - } - } - else - { - // this message has no effect in a non-multi listbox - } - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_SET_SELECTION: - { - const Int *selectList = (const Int *)mData1; - Int selectCount = (Int)mData2; - DEBUG_ASSERTCRASH( list->multiSelect || selectCount == 1, ("Bad selection size")); - - if( selectList[0] < 0 || list->listLength <= selectList[0] ) - { - - if( list->multiSelect ) - memset( list->selections, -1, list->listLength * sizeof(Int) ); - else - list->selectPos = -1; - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - - break; - - } - - if( list->multiSelect ) - { - // forced selections override the entire selection list. - Int i=0; - for (; iendPos; ++i) - { - // don't select off the end - if (list->listLength <= selectList[i]) - { - break; - } - - // if there is no cells we shouldn't be selecting this entry - if( !list->listData[ selectList[i] ].cell ) - { - break; - } - - list->selections[i] = selectList[i]; - } - list->selections[i] = -1; - } - else - { - // if there is no cells we shouldn't be selecting this entry - if( !list->listData[ selectList[0] ].cell ) - { - break; - } - - list->selectPos = selectList[0]; - GameWindow *parent = window->winGetParent(); - if( parent && BitIsSet( parent->winGetStyle(), GWS_COMBO_BOX ) ) - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - break; - } - if( list->listData[list->selectPos].listHeight < list->displayPos ) - { - - TheWindowManager->winSendSystemMsg( window, GLM_UPDATE_DISPLAY, - list->selectPos, 0 ); - } - else if( list->listData[list->selectPos].listHeight > - (list->displayPos + list->displayHeight) ) - { - - if( list->selectPos > 0 ) - list->displayPos = - list->listData[list->selectPos].listHeight - list->displayHeight; - else - list->displayPos = 0; - - adjustDisplay( window, 0, TRUE ); - - } - - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GLM_SELECTED, - (WindowMsgData)window, - list->selectPos ); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_SCROLL_BUFFER: - { - - if( list->endPos < (Int)mData1 ) - break; - - // - // scroll buffer literally scrolls the entire list data buffer - // up one entry, effectively removing the top entry. - // - - // - // Loop through and remove all the entries from the top up until we reach - // the position mData1 contains - // - ListEntryCell *cells = nullptr; - Int i = 0; - for (; i < (Int)mData1; i++) - { - cells = list->listData[i].cell; - - if(cells) - for( Int j = 0; j < list->columns; j++ ) - { - if( cells[j].cellType == LISTBOX_TEXT && cells[j].data ) - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - -// free(cells[i].userData); - cells[j].data = nullptr; - cells[j].userData = nullptr; - cells[j].color = 0; - cells[j].cellType = 0; - } - - delete[](list->listData[i].cell); - list->listData[i].cell = nullptr; - } - - - // - // copy the cells up - // - memcpy(list->listData, &list->listData[mData1], - (list->endPos - mData1) * sizeof(ListEntryRow) ); - - list->endPos -= mData1; - list->insertPos = list->endPos; - - // - // remove the display or links to images after the shift - // - for(i = 0; i < (Int)mData1; i ++) - { - list->listData[list->endPos + i].cell = nullptr; - } - - - if( list->multiSelect ) - { - Int i = 0; - - while( list->selections[i] >= 0 ) - { - if( (Int)mData1 >= list->selections[i] ) - list->selections[i] -= (Int)mData1; - else - { - removeSelection( list, i ); - i--; // compensate for lost entry - } - - i++; - } - } - else - { - if( list->selectPos > 0 ) - list->selectPos -= mData1; - } - - if( list->displayPos > 0 ) - adjustDisplay( window, (-1 * mData1), TRUE ); - - computeTotalHeight( window ); - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_GET_SELECTION: - { - - if( list->multiSelect ) - *(Int*)mData2 = (Int)list->selections; - else - *(Int*)mData2 = list->selectPos; - - break; - - } - - // ------------------------------------------------------------------------ - case GLM_SET_UP_BUTTON: - list->upButton = (GameWindow *)mData1; - break; - - // ------------------------------------------------------------------------ - case GLM_SET_DOWN_BUTTON: - list->downButton = (GameWindow *)mData1; - break; - - // ------------------------------------------------------------------------ - case GLM_SET_SLIDER: - list->slider = (GameWindow *)mData1; - break; - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { - Int width = (Int)mData1; - Int height = (Int)mData2; - ICoord2D downSize = {0, 0}; - ICoord2D upSize = {0, 0}; - ICoord2D sliderSize = {0, 0}; - GameWindow *child = nullptr; - ICoord2D sliderChildSize = {0, 0}; - - // get needed window sizes - if (list->downButton) - list->downButton->winGetSize( &downSize.x, &downSize.y ); - if (list->upButton) - list->upButton->winGetSize( &upSize.x, &upSize.y ); - if (list->slider) - { - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - child = list->slider->winGetChild(); - if (child) - child->winGetSize( &sliderChildSize.x, &sliderChildSize.y ); - } - - if( list->upButton ) - { - - list->upButton->winSetPosition( width - upSize.x - 2, 2 ); - - } - - if( list->downButton ) - { - - list->downButton->winSetPosition( width - downSize.x - 2, - height - downSize.y - 2 ); - - } - - if( list->slider ) - { - list->slider->winSetSize( sliderSize.x, - height - (2 * upSize.y) -6 ); - list->slider->winSetPosition( width - sliderSize.x -2, upSize.y + 3 ); - - } - - list->displayHeight = height; - // store display height - if( instData->getTextLength() ) - { - list->displayHeight -= TheWindowManager->winFontHeight( instData->getFont() ); - } - - // - // Setup listbox Columns - // - if( list->columns == 1 ) - { - list->columnWidth[0] = width; - if( list->slider ) - { - ICoord2D sliderSize; - - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - list->columnWidth[0] -= sliderSize.x; - - } - } - else - { - if( !list->columnWidthPercentage ) - break; - if(!list->columnWidth) - break; - - Int totalWidth = width; - if( list->slider ) - { - ICoord2D sliderSize; - - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - totalWidth -= sliderSize.x; - - } - for(Int i = 0; i < list->columns; i++ ) - { - list->columnWidth[i] = list->columnWidthPercentage[i] * totalWidth / 100; - } - } - //reset the total height - computeTotalHeight(window); - break; - - } - - // ------------------------------------------------------------------------ - case GLM_UPDATE_DISPLAY: - { - - if( mData1 > 0 ) - // set the display to the top of a specific entry - // which is the previous listHeight + 1 - list->displayPos = list->listData[(mData1 - 1)].listHeight + 1; - else - list->displayPos = 0; - - if( list->displayPos + list->displayHeight >= list->totalHeight ) - { - list->displayPos = list->totalHeight - list->displayHeight; - } - adjustDisplay( window, 0, TRUE ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - Int i; - - // Loop through and destroy any display strings we've allocated - for( i = 0; i < list->listLength; i++ ) - { - //We're now onto a row of cells we are not using anymore Pull off the cells and loop through them - ListEntryCell *cells = list->listData[i].cell; - for (int j = list->columns - 1; j >=0; j-- ) - { - if(!cells) - break; - if( cells[j].cellType == LISTBOX_TEXT ) - { - // If we can delete the stuff that won't be showing up in the new listData structure - if ( cells[j].data ) - { - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - } - } -// free(cells[j].userData); - - // Null out the data pointers so they're not destroyed when we free up this listdata - cells[j].userData = nullptr; - cells[j].data = nullptr; - } - delete[](list->listData[i].cell); - list->listData[i].cell = nullptr; - } - - delete[]( list->listData ); - delete[]( list->columnWidth ); - delete[]( list->columnWidthPercentage ); - if( list->multiSelect ) - delete[]( list->selections ); - - delete (ListboxData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - list = nullptr; - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - // If we're losing focus - if( mData1 == FALSE ) - { - BitClear( instData->m_state, WIN_STATE_HILITED ); - } - else - { - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - } - // ------------------------------------------------------------------------ - case GSM_SLIDER_TRACK: - { - SliderData *sData = (SliderData *)list->slider->winGetUserData(); - list->displayPos = sData->maxVal - mData2; - - if( list->displayPos > (list->totalHeight - list->displayHeight + 1) ) - list->displayPos = (list->totalHeight - list->displayHeight + 1); - - if( list->displayPos < 0) - list->displayPos = 0; - - adjustDisplay( window, 0, FALSE ); - break; - - } - // ------------------------------------------------------------------------ - case GLM_SET_ITEM_DATA: - { - void *data = (void *)mData2; - pos = (ICoord2D *)mData1; - - if (pos->y >= 0 && pos->y < list->endPos && list->listData[pos->y].cell) - list->listData[pos->y].cell[pos->x].userData = data; - - break; - } - // ------------------------------------------------------------------------ - case GLM_GET_ITEM_DATA: - { - pos = (ICoord2D *)mData1; - void **data = (void **)mData2; - - *data = nullptr; // initialize to nullptr - if (pos->y >= 0 && pos->y < list->endPos && list->listData[pos->y].cell) - *data = list->listData[pos->y].cell[pos->x].userData; - - break; - } - - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetListBoxSetColors ===================================================== -/** Set the colors for a list box, note that this will also automatically - * change the colors of any attached slider, slider thumb, and slider - * buttons */ -//============================================================================= -void GadgetListBoxSetColors( GameWindow *listbox, - Color enabledColor, - Color enabledBorderColor, - Color enabledSelectedItemColor, - Color enabledSelectedItemBorderColor, - Color disabledColor, - Color disabledBorderColor, - Color disabledSelectedItemColor, - Color disabledSelectedItemBorderColor, - Color hiliteColor, - Color hiliteBorderColor, - Color hiliteSelectedItemColor, - Color hiliteSelectedItemBorderColor ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - - // enabled - GadgetListBoxSetEnabledColor( listbox, enabledColor ); - GadgetListBoxSetEnabledBorderColor( listbox, enabledBorderColor ); - GadgetListBoxSetEnabledSelectedItemColor( listbox, enabledSelectedItemColor ); - GadgetListBoxSetEnabledSelectedItemBorderColor( listbox, enabledSelectedItemBorderColor ); - - // disabled - GadgetListBoxSetDisabledColor( listbox, disabledColor ); - GadgetListBoxSetDisabledBorderColor( listbox, disabledBorderColor ); - GadgetListBoxSetDisabledSelectedItemColor( listbox, disabledSelectedItemColor ); - GadgetListBoxSetDisabledSelectedItemBorderColor( listbox, disabledSelectedItemBorderColor ); - - // hilited - GadgetListBoxSetHiliteColor( listbox, hiliteColor ); - GadgetListBoxSetHiliteBorderColor( listbox, hiliteBorderColor ); - GadgetListBoxSetHiliteSelectedItemColor( listbox, hiliteSelectedItemColor ); - GadgetListBoxSetHiliteSelectedItemBorderColor( listbox, hiliteSelectedItemBorderColor ); - - // assign default slider colors and images as part of the list box - GameWindow *slider = listboxData->slider; - if( slider ) - { - GameWindow *upButton = listboxData->upButton; - GameWindow *downButton = listboxData->downButton; - - // slider and slider thumb ---------------------------------------------- - - // enabled - GadgetSliderSetEnabledColor( slider, GadgetListBoxGetEnabledColor( listbox ) ); - GadgetSliderSetEnabledBorderColor( slider, GadgetListBoxGetEnabledBorderColor( listbox ) ); - - // Disabled - GadgetSliderSetDisabledColor( slider, GadgetListBoxGetDisabledColor( listbox ) ); - GadgetSliderSetDisabledBorderColor( slider, GadgetListBoxGetDisabledBorderColor( listbox ) ); - - // Hilite - GadgetSliderSetHiliteColor( slider, GadgetListBoxGetHiliteColor( listbox ) ); - GadgetSliderSetHiliteBorderColor( slider, GadgetListBoxGetHiliteBorderColor( listbox ) ); - - // up button ------------------------------------------------------------ - - // enabled - GadgetButtonSetEnabledColor( upButton, GadgetSliderGetEnabledColor( slider ) ); - GadgetButtonSetEnabledBorderColor( upButton, GadgetSliderGetEnabledBorderColor( slider ) ); - GadgetButtonSetEnabledSelectedColor( upButton, GadgetSliderGetEnabledSelectedThumbColor( slider ) ); - GadgetButtonSetEnabledSelectedBorderColor( upButton, GadgetSliderGetEnabledSelectedThumbBorderColor( slider ) ); - - // disabled - GadgetButtonSetDisabledColor( upButton, GadgetSliderGetDisabledColor( slider ) ); - GadgetButtonSetDisabledBorderColor( upButton, GadgetSliderGetDisabledBorderColor( slider ) ); - GadgetButtonSetDisabledSelectedColor( upButton, GadgetSliderGetDisabledSelectedThumbColor( slider ) ); - GadgetButtonSetDisabledSelectedBorderColor( upButton, GadgetSliderGetDisabledSelectedThumbBorderColor( slider ) ); - - // hilite - GadgetButtonSetHiliteColor( upButton, GadgetSliderGetHiliteColor( slider ) ); - GadgetButtonSetHiliteBorderColor( upButton, GadgetSliderGetHiliteBorderColor( slider ) ); - GadgetButtonSetHiliteSelectedColor( upButton, GadgetSliderGetHiliteSelectedThumbColor( slider ) ); - GadgetButtonSetHiliteSelectedBorderColor( upButton, GadgetSliderGetHiliteSelectedThumbBorderColor( slider ) ); - - // down button ---------------------------------------------------------- - - // enabled - GadgetButtonSetEnabledColor( downButton, GadgetSliderGetEnabledColor( slider ) ); - GadgetButtonSetEnabledBorderColor( downButton, GadgetSliderGetEnabledBorderColor( slider ) ); - GadgetButtonSetEnabledSelectedColor( downButton, GadgetSliderGetEnabledSelectedThumbColor( slider ) ); - GadgetButtonSetEnabledSelectedBorderColor( downButton, GadgetSliderGetEnabledSelectedThumbBorderColor( slider ) ); - - // disabled - GadgetButtonSetDisabledColor( downButton, GadgetSliderGetDisabledColor( slider ) ); - GadgetButtonSetDisabledBorderColor( downButton, GadgetSliderGetDisabledBorderColor( slider ) ); - GadgetButtonSetDisabledSelectedColor( downButton, GadgetSliderGetDisabledSelectedThumbColor( slider ) ); - GadgetButtonSetDisabledSelectedBorderColor( downButton, GadgetSliderGetDisabledSelectedThumbBorderColor( slider ) ); - - // hilite - GadgetButtonSetHiliteColor( downButton, GadgetSliderGetHiliteColor( slider ) ); - GadgetButtonSetHiliteBorderColor( downButton, GadgetSliderGetHiliteBorderColor( slider ) ); - GadgetButtonSetHiliteSelectedColor( downButton, GadgetSliderGetHiliteSelectedThumbColor( slider ) ); - GadgetButtonSetHiliteSelectedBorderColor( downButton, GadgetSliderGetHiliteSelectedThumbBorderColor( slider ) ); - - } - -} - -// GadgetListBoxGetText ======================================================= -/** Get the text for a list box entry */ -//============================================================================= -UnicodeString GadgetListBoxGetText( GameWindow *listbox, Int row, Int column) -{ - Color color; - return GadgetListBoxGetTextAndColor( listbox,&color,row,column ); -} - -// GadgetListBoxGetText ======================================================= -/** Get the text for a list box entry */ -//============================================================================= -UnicodeString GadgetListBoxGetTextAndColor( GameWindow *listbox, Color *color, Int row, Int column) -{ - *color = 0; - // sanity - if( listbox == nullptr || row == -1 || column == -1) - return UnicodeString::TheEmptyString; - - // verify that this is a list box - if( BitIsSet( listbox->winGetStyle(), GWS_SCROLL_LISTBOX ) == FALSE ) - return UnicodeString::TheEmptyString; - TextAndColor tAndC; - //UnicodeString result; - ICoord2D pos; - pos.x = column; - pos.y = row; - TheWindowManager->winSendSystemMsg( listbox, GLM_GET_TEXT, (WindowMsgData)&pos, (WindowMsgData)&tAndC ); - - - *color = tAndC.color; - return tAndC.string; - - //return UnicodeString::TheEmptyString; - -} - -// GadgetListBoxAddEntryText ================================================== -/** Add a new string entry into the listbox at the insert position */ -//============================================================================= -Int GadgetListBoxAddEntryText( GameWindow *listbox, - UnicodeString text, - Color color, Int row, Int column, Bool overwrite ) -{ - if (!listbox) - return -1; - if (text.isEmpty()) - text = L" "; - Int index; - AddMessageStruct addInfo; - addInfo.row = row; - addInfo.column = column; - addInfo.type = LISTBOX_TEXT; - addInfo.data = &text; - addInfo.overwrite = overwrite; - addInfo.height = -1; - addInfo.width = -1; - - ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - if (listData == nullptr) - return -1; - Bool wasFull = (listData->listLength <= listData->endPos); - Int newEntryOffset = (wasFull)?0:1; - Int oldBottomIndex = GadgetListBoxGetBottomVisibleEntry(listbox); - - /// @TODO: Don't do this type cast! - index = (Int) TheWindowManager->winSendSystemMsg( listbox, GLM_ADD_ENTRY, (WindowMsgData)&addInfo, color ); - - //DEBUG_ASSERTLOG(!listData->scrollIfAtEnd, ("Adding line %d (orig end was %d, newEntryOffset is %d, (%d-%d)?=%d, isFull=%d/%d ll=%d, end=%d", - //index, oldBottomIndex, newEntryOffset, index, oldBottomIndex, newEntryOffset, wasFull, GadgetListBoxIsFull(listbox), listData->listLength, listData->endPos)); - if(listData->scrollIfAtEnd && index - oldBottomIndex == newEntryOffset && GadgetListBoxIsFull(listbox)) - { - GadgetListBoxSetBottomVisibleEntry( listbox, index ); - } - - return (index); -} - -// GadgetListBoxAddEntryImage ================================================= -/** Add a new string entry into the listbox at the insert position */ -//============================================================================= -Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column, - Int hight, Int width, - Bool overwrite, Color color ) -{ - Int index; - AddMessageStruct addInfo; - addInfo.row = row; - addInfo.column = column; - addInfo.type = LISTBOX_IMAGE; - addInfo.data = image; - addInfo.overwrite = overwrite; - addInfo.height = hight; - addInfo.width = width; - /// @TODO: Don't do this type cast! - index = (Int) TheWindowManager->winSendSystemMsg( listbox, GLM_ADD_ENTRY, (WindowMsgData)&addInfo, color ); - return (index); -} - -Int GadgetListBoxAddEntryImage( GameWindow *listbox, const Image *image, - Int row, Int column, - Bool overwrite, Color color ) -{ - return GadgetListBoxAddEntryImage(listbox, image, row, column, -1, -1, overwrite, color); -} - -// GadgetListBoxSetFont ======================================================= -/** Set the font for a listbox control, we need to set the window - * text font, the tooltip font, and the edit text display strings for - * the text data itself and the secret text */ -//============================================================================= -void GadgetListBoxSetFont( GameWindow *g, GameFont *font ) -{ - ListboxData *listData = (ListboxData *)g->winGetUserData(); - DisplayString *dString; - - // set the font for the display strings all windows have - dString = g->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = g->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); - - // listbox specific - if( listData ) - for( Int i = 0; i < listData->listLength; i++ ) - { - if(listData->listData[i].cell) - for( Int j = 0; j < listData->columns; j++ ) - { - if( listData->listData[i].cell[j].cellType == LISTBOX_TEXT && listData->listData[i].cell[j].data ) - { - dString = (DisplayString *)listData->listData[i].cell[j].data; - dString->setFont( font ); - } - } - } - -} - -// GadgetListboxCreateScrollbar =============================================== -/** Create the scroll bar using a slider and two buttons for a listbox */ -//============================================================================= -void GadgetListboxCreateScrollbar( GameWindow *listbox ) -{ - ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - WinInstanceData winInstData; - SliderData sData = { 0 }; - Int buttonWidth, buttonHeight; - Int sliderButtonWidth, sliderButtonHeight; - Int fontHeight; - Int top; - Int bottom; - UnsignedInt status = listbox->winGetStatus(); - Bool title = FALSE; - Int width, height; - - // get width and height of listbox - listbox->winGetSize( &width, &height ); - - // do we have a title - if( listbox->winGetTextLength() ) - title = TRUE; - - // remove unwanted status bits. - status &= ~(WIN_STATUS_BORDER | WIN_STATUS_HIDDEN | WIN_STATUS_NO_INPUT); - - fontHeight = TheWindowManager->winFontHeight( listbox->winGetFont() ); - top = title ? (fontHeight + 1):0; - bottom = title ? (height - (fontHeight + 1)):height; - - // initialize instData - winInstData.init(); - - // size of button - buttonWidth = 21;//GADGET_SIZE; - buttonHeight = 22;//GADGET_SIZE; - - // ---------------------------------------------------------------------- - // Create Top Button - // ---------------------------------------------------------------------- - status |= WIN_STATUS_IMAGE; - - winInstData.m_owner = listbox; - winInstData.m_style = GWS_PUSH_BUTTON; - - // if listbox tracks, so will this sub control - if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - listData->upButton = - TheWindowManager->gogoGadgetPushButton( listbox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - buttonWidth -2, top+2, - buttonWidth, buttonHeight, - &winInstData, nullptr, TRUE ); - - // ---------------------------------------------------------------------- - // Create Bottom Button - // ---------------------------------------------------------------------- - - winInstData.init(); - winInstData.m_style = GWS_PUSH_BUTTON; - winInstData.m_owner = listbox; - - // if listbox tracks, so will this sub control - if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - listData->downButton = - TheWindowManager->gogoGadgetPushButton( listbox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - buttonWidth -2, - (top + bottom - buttonHeight -2), - buttonWidth, buttonHeight, - &winInstData, nullptr, TRUE ); - - // ---------------------------------------------------------------------- - // create the slider - // ---------------------------------------------------------------------- - - // size of button - sliderButtonWidth = buttonWidth;//GADGET_SIZE; - sliderButtonHeight = GADGET_SIZE; - - // initialize instData - winInstData.init(); - winInstData.m_style = GWS_VERT_SLIDER; - winInstData.m_owner = listbox; - - // if listbox tracks, so will this sub control - if( BitIsSet( listbox->winGetStyle(), GWS_MOUSE_TRACK ) ) - BitSet( winInstData.m_style, GWS_MOUSE_TRACK ); - - // initialize sData - memset( &sData, 0, sizeof(SliderData) ); - - // Create Slider - listData->slider = - TheWindowManager->gogoGadgetSlider( listbox, - status | WIN_STATUS_ACTIVE | WIN_STATUS_ENABLED, - width - sliderButtonWidth - 2, - (top + buttonHeight + 3), - sliderButtonWidth, bottom - (2 * buttonHeight) - 6, - &winInstData, &sData, nullptr, TRUE ); - - // we now have all the scrollbar parts, this better be set :) - listData->scrollBar = TRUE; - -} - -// GadgetListBoxAddMultiSelect ================================================ -/** Enable multi selections for a listbox - * - * ASSUMPTION: The listLength must already be set at this time so - * that we can make enough space to hold all the selection data, if you - * change the list length you must also change the selection array - * for multi select listboxes - */ -//============================================================================= -void GadgetListBoxAddMultiSelect( GameWindow *listbox ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - - DEBUG_ASSERTCRASH(listboxData && listboxData->selections == nullptr, ("selections is not null")); - listboxData->selections = NEW Int [listboxData->listLength]; - DEBUG_LOG(( "Enable list box multi select: listLength (select) = %d * %d = %d bytes;", - listboxData->listLength, sizeof(Int), - listboxData->listLength *sizeof(Int) )); - - if( listboxData->selections == nullptr ) - { - - delete[]( listboxData->listData ); - listboxData->listData = nullptr; - return; - - } - - memset( listboxData->selections, -1, - listboxData->listLength * sizeof(Int) ); - - // set mutliselect flag - listboxData->multiSelect = TRUE; - - // adjust the input procedure for the listbox - listbox->winSetInputFunc( GadgetListBoxMultiInput ); - -} - -// GadgetListBoxRemoveMultiSelect ============================================= -/** Remove multi select capability from a listbox */ -//============================================================================= -void GadgetListBoxRemoveMultiSelect( GameWindow *listbox ) -{ - ListboxData *listData = (ListboxData *)listbox->winGetUserData(); - - delete[]( listData->selections ); - listData->selections = nullptr; - - listData->multiSelect = FALSE; - - // adjust the input procedure for the listbox - listbox->winSetInputFunc( GadgetListBoxInput ); - -} - -// GadgetListBoxSetListLength ================================================= -/** Set OR reset the list length data contained in the listboxData - * parameter. When adjusting the size of lists we also have to - * adjust multiselection lists if present and any display - * strings present */ -//============================================================================= -void GadgetListBoxSetListLength( GameWindow *listbox, Int newLength ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - - -// ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); -// ListEntry *newData = (ListEntry *)malloc(newLength * sizeof(ListEntry)); - DEBUG_ASSERTCRASH(listboxData, ("We don't have our needed listboxData!")); - if( !listboxData ) - return; - DEBUG_ASSERTCRASH(listboxData->columns > 0,("We need at least one Column in the listbox")); - if( listboxData->columns < 1 ) - return; - - Int columns = listboxData->columns; - ListEntryRow *newData = NEW ListEntryRow[ newLength ]; - DEBUG_ASSERTCRASH(newData, ("Unable to allocate new data structures for the Listbox")); - if( !newData ) - return; - Int i; - // zero out the new Data structure - memset( newData, 0, newLength * sizeof( ListEntryRow ) ); - - // we want to copy over different amounts of data depending on if we're adding - // to the list box or removing from the listbox - if(newLength >= listboxData->listLength) - { - memcpy(newData,listboxData->listData,listboxData->listLength * sizeof( ListEntryRow ) ); - } - else - { - // If we're removing entries from the listbox, we need to reset the length, - // position, and selection to their new places - if( listboxData->displayPos >newLength) - listboxData->displayPos = newLength; - //if we're multiselect, just select no position - if(listboxData->selectPos > newLength || listboxData->multiSelect) - listboxData->selectPos = -1; - if(listboxData->insertPos > newLength) - listboxData->insertPos = newLength; - - listboxData->endPos = newLength; - //copy only the data that we'll be needing. - memcpy(newData,listboxData->listData,newLength * sizeof( ListEntryRow ) ); - } - - // Loop through and destroy any display strings we've allocated that aren't used - for( i = 0; i < listboxData->listLength; i++ ) - { - //We're now onto a row of cells we are not using anymore Pull off the cells and loop through them - ListEntryCell *cells = listboxData->listData[i].cell; - for (int j = columns - 1; j >=0; j-- ) - { - if(!cells) - break; - if ( i >= newLength ) - { - if( cells[j].cellType == LISTBOX_TEXT && i >= newLength) - { - // If we can delete the stuff that won't be showing up in the new listData structure - if ( cells[j].data ) - { - TheDisplayStringManager->freeDisplayString((DisplayString *) cells[j].data ); - } - } -// free(cells[j].userData); - } - } - if (i >= newLength) { - delete[](listboxData->listData[i].cell); - listboxData->listData[i].cell = nullptr; - } - } - - listboxData->listLength = newLength; - - delete[]( listboxData->listData ); - listboxData->listData = newData; - - //reset the total height - computeTotalHeight(listbox); - - // Sanity check that everything was created properly - if( listboxData->listData == nullptr ) - { - - DEBUG_LOG(( "Unable to allocate listbox data pointer" )); - assert( 0 ); - return; - - } - - // adjust the selection array for multi select listboxes - if( listboxData->multiSelect ) - { - - GadgetListBoxRemoveMultiSelect( listbox ); - GadgetListBoxAddMultiSelect( listbox ); - - } - -} - -//============================================================================= -Int GadgetListBoxGetListLength( GameWindow *listbox ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (listboxData) - return listboxData->listLength; - - return 0; -} - -//============================================================================= -Int GadgetListBoxGetMaxSelectedLength( GameWindow *listbox ) -{ - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (listboxData) - return listboxData->multiSelect ? listboxData->listLength : 1; - - return 0; -} - -// GadgetListBoxGetNumEntries ================================================= -/** Get the list length data contained in the listboxData - * parameter. */ -//============================================================================= -Int GadgetListBoxGetNumEntries( GameWindow *listbox ) -{ - if (!listbox) - return 0; - - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (listboxData) - return listboxData->endPos; - - return 0; -} - -//------------------------------------------------------------------------------------------------- -/** Get the selected item(s) of a listbox. For a single select listbox the parameter - * should be a single integer pointer. For a multi select listbox the parameter - * should be an (Int *), this array returned will be an array of indices of the selected items - * of the list box. An entry of -1 in this array is the "end" of the selected list, - * and this list will never be larger than the max items in the list box */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxGetSelected( GameWindow *listbox, Int *selectList ) -{ - - // sanity - if( listbox == nullptr ) - return; - - // get selected indices via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_GET_SELECTION, 0, (WindowMsgData)selectList ); - -} - -//------------------------------------------------------------------------------------------------- -/** Set the selected item of a listbox. The parameter is a single integer. If - * the selected index is less than 0, nothing is selected. */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetSelected( GameWindow *listbox, Int selectIndex ) -{ - - // sanity - if( listbox == nullptr ) - return; - - // set selected index via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)(&selectIndex), 1 ); - -} - -//------------------------------------------------------------------------------------------------- -/** Set the selected item of a listbox. */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetSelected( GameWindow *listbox, const Int *selectList, Int selectCount ) -{ - // sanity - if( listbox == nullptr ) - return; - // set selected index via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_SET_SELECTION, (WindowMsgData)selectList, selectCount ); -} - -//------------------------------------------------------------------------------------------------- -/** Reset the content of the listbox */ -//------------------------------------------------------------------------------------------------- -void GadgetListBoxReset( GameWindow *listbox ) -{ - - // sanity - if( listbox == nullptr ) - return; - - // reset via system message - TheWindowManager->winSendSystemMsg( listbox, GLM_DEL_ALL, 0, 0 ); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetItemData( GameWindow *listbox, void *data, Int row, Int column ) -{ - ICoord2D pos; - pos.x = column; - pos.y = row; - - if (listbox) - TheWindowManager->winSendSystemMsg( listbox, GLM_SET_ITEM_DATA, (WindowMsgData)&pos, (WindowMsgData)data); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void *GadgetListBoxGetItemData( GameWindow *listbox, Int row, Int column) -{ - void *data = nullptr; - ICoord2D pos; - pos.x = column; - pos.y = row; - - if (listbox) - { - TheWindowManager->winSendSystemMsg( listbox, GLM_GET_ITEM_DATA, (WindowMsgData)&pos, (WindowMsgData)&data); - } - return (data); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetBottomVisibleEntry( GameWindow *window ) -{ - if (!window) - return 0; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return 0; - - return getListboxBottomEntry(listData); - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -bool GadgetListBoxIsFull(GameWindow *window) -{ - if (!window) - return FALSE; - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return FALSE; - - Int entry = getListboxBottomEntry(listData); - if(listData->listData[entry].listHeight >= listData->displayPos + listData->displayHeight - 5) - return TRUE; - else - return FALSE; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetBottomVisibleEntry( GameWindow *window, Int newPos ) -{ - if (!window) - return; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return; - - int prevPos = GadgetListBoxGetBottomVisibleEntry( window ); - - adjustDisplay(window, newPos - prevPos + 1, true); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetTopVisibleEntry( GameWindow *window ) -{ - if (!window) - return 0; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return 0; - - return getListboxTopEntry(listData); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetTopVisibleEntry( GameWindow *window, Int newPos ) -{ - if (!window) - return; - - ListboxData *listData = (ListboxData *)window->winGetUserData(); - if (!listData) - return; - - int prevPos = GadgetListBoxGetTopVisibleEntry( window ); - - adjustDisplay(window, newPos - prevPos, true); -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -void GadgetListBoxSetAudioFeedback( GameWindow *listbox, Bool enable ) -{ - if (!listbox) - return; - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (!listboxData) - return; - - listboxData->audioFeedback = enable; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetNumColumns( GameWindow *listbox ) -{ - if (!listbox) - return 0; - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (!listboxData) - return 0; - - return listboxData->columns; -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -Int GadgetListBoxGetColumnWidth( GameWindow *listbox, Int column ) -{ - if (!listbox) - return 0; - ListboxData *listboxData = (ListboxData *)listbox->winGetUserData(); - if (!listboxData) - return 0; - if (listboxData->columns <= column || column < 0) - return 0; - - return listboxData->columnWidth[column]; -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp deleted file mode 100644 index d798d23f0d6..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +++ /dev/null @@ -1,118 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: ProgressBar.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: ProgressBar.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Progress bar GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - -// GadgetProgressBarSystem ==================================================== -/** Handle system messages for Progress Bar */ -//============================================================================= -WindowMsgHandledType GadgetProgressBarSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - window->winSetUserData( nullptr ); - break; - } - - // ------------------------------------------------------------------------ - case GPM_SET_PROGRESS: - { - Int newPos = (Int)mData1; - - if (newPos < 0 || newPos > 100) - break; - - window->winSetUserData( (void *)newPos ); - - break; - - } - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetProgressBarSetProgress =============================================== -/** send progress system message to Progress Bar */ -//============================================================================= -void GadgetProgressBarSetProgress( GameWindow *g, Int progress ) -{ - if(!g) - return; - - TheWindowManager->winSendSystemMsg( g, GPM_SET_PROGRESS, progress, 0); -} diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 1f4ce0de287..6d123aeb7a5 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -143,7 +143,7 @@ set(GAMEENGINE_SRC # Include/GameClient/Color.h Include/GameClient/CommandXlat.h Include/GameClient/ControlBar.h - Include/GameClient/ControlBarResizer.h +# Include/GameClient/ControlBarResizer.h Include/GameClient/ControlBarScheme.h # Include/GameClient/Credits.h # Include/GameClient/DebugDisplay.h @@ -161,11 +161,11 @@ set(GAMEENGINE_SRC Include/GameClient/FontDesc.h # Include/GameClient/FXList.h Include/GameClient/Gadget.h - Include/GameClient/GadgetCheckBox.h - Include/GameClient/GadgetComboBox.h - Include/GameClient/GadgetListBox.h - Include/GameClient/GadgetProgressBar.h - Include/GameClient/GadgetPushButton.h +# Include/GameClient/GadgetCheckBox.h +# Include/GameClient/GadgetComboBox.h +# Include/GameClient/GadgetListBox.h +# Include/GameClient/GadgetProgressBar.h +# Include/GameClient/GadgetPushButton.h Include/GameClient/GadgetRadioButton.h Include/GameClient/GadgetSlider.h Include/GameClient/GadgetStaticText.h @@ -700,21 +700,21 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/ControlBar/ControlBarBeacon.cpp Source/GameClient/GUI/ControlBar/ControlBarCommand.cpp Source/GameClient/GUI/ControlBar/ControlBarCommandProcessing.cpp - Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp - Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp +# Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp +# Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp Source/GameClient/GUI/ControlBar/ControlBarOCLTimer.cpp - Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp - Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp +# Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp +# Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp Source/GameClient/GUI/ControlBar/ControlBarScheme.cpp Source/GameClient/GUI/ControlBar/ControlBarStructureInventory.cpp - Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp +# Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp Source/GameClient/GUI/DisconnectMenu/DisconnectMenu.cpp Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp - Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp - Source/GameClient/GUI/Gadget/GadgetComboBox.cpp +# Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp +# Source/GameClient/GUI/Gadget/GadgetComboBox.cpp Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp - Source/GameClient/GUI/Gadget/GadgetListBox.cpp - Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp +# Source/GameClient/GUI/Gadget/GadgetListBox.cpp +# Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp Source/GameClient/GUI/Gadget/GadgetPushButton.cpp Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp Source/GameClient/GUI/Gadget/GadgetStaticText.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index d7c9a72fb88..f7aa3c15ad4 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -505,6 +505,22 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/HotKey.h", Game.CORE, "GameEngine/Include/GameClient/HotKey.h") #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GameWindowID.h", Game.CORE, "GameEngine/Include/GameClient/GameWindowID.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarMultiSelect.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarObserver.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarPrintPositions.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarResizer.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/ControlBarResizer.h", Game.CORE, "GameEngine/Include/GameClient/ControlBarResizer.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/ControlBar/ControlBarUnderConstruction.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetCheckBox.h", Game.CORE, "GameEngine/Include/GameClient/GadgetCheckBox.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetComboBox.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetComboBox.h", Game.CORE, "GameEngine/Include/GameClient/GadgetComboBox.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetListBox.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetListBox.h", Game.CORE, "GameEngine/Include/GameClient/GadgetListBox.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetProgressBar.h", Game.CORE, "GameEngine/Include/GameClient/GadgetProgressBar.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetPushButton.h", Game.CORE, "GameEngine/Include/GameClient/GadgetPushButton.h") + return From 824dab208f0498db06b9c2c1748e3bead1443587 Mon Sep 17 00:00:00 2001 From: DevGeniusCode <136935333+DevGeniusCode@users.noreply.github.com> Date: Wed, 22 Apr 2026 06:10:05 +0300 Subject: [PATCH 3/3] unify(client): Move remaining gadgets and popups to Core (#2619) --- Core/GameEngine/CMakeLists.txt | 30 +- .../Include/GameClient/GadgetRadioButton.h | 0 .../Include/GameClient/GadgetSlider.h | 0 .../Include/GameClient/GadgetStaticText.h | 0 .../Include/GameClient/GadgetTabControl.h | 0 .../Include/GameClient/GadgetTextEntry.h | 0 .../GUI/GUICallbacks/InGameChat.cpp | 0 .../GUI/GUICallbacks/InGamePopupMessage.cpp | 0 .../GUICallbacks/Menus/PopupCommunicator.cpp | 0 .../GUI/GUICallbacks/Menus/PopupJoinGame.cpp | 0 .../GUI/Gadget/GadgetHorizontalSlider.cpp | 0 .../GUI/Gadget/GadgetRadioButton.cpp | 0 .../GUI/Gadget/GadgetStaticText.cpp | 0 .../GUI/Gadget/GadgetTabControl.cpp | 0 .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 0 .../GUI/Gadget/GadgetVerticalSlider.cpp | 0 Generals/Code/GameEngine/CMakeLists.txt | 30 +- .../Include/GameClient/GadgetRadioButton.h | 146 ----- .../Include/GameClient/GadgetSlider.h | 439 ------------- .../Include/GameClient/GadgetStaticText.h | 100 --- .../Include/GameClient/GadgetTabControl.h | 273 -------- .../Include/GameClient/GadgetTextEntry.h | 124 ---- .../GUI/GUICallbacks/InGameChat.cpp | 361 ----------- .../GUI/GUICallbacks/InGamePopupMessage.cpp | 250 -------- .../GUICallbacks/Menus/PopupCommunicator.cpp | 207 ------ .../GUI/GUICallbacks/Menus/PopupJoinGame.cpp | 263 -------- .../GUI/Gadget/GadgetHorizontalSlider.cpp | 481 -------------- .../GUI/Gadget/GadgetRadioButton.cpp | 448 ------------- .../GUI/Gadget/GadgetStaticText.cpp | 226 ------- .../GUI/Gadget/GadgetTabControl.cpp | 366 ----------- .../GameClient/GUI/Gadget/GadgetTextEntry.cpp | 598 ------------------ .../GUI/Gadget/GadgetVerticalSlider.cpp | 470 -------------- GeneralsMD/Code/GameEngine/CMakeLists.txt | 30 +- scripts/cpp/unify_move_files.py | 16 + 34 files changed, 61 insertions(+), 4797 deletions(-) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetRadioButton.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetSlider.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetStaticText.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetTabControl.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Include/GameClient/GadgetTextEntry.h (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp (100%) rename {GeneralsMD/Code => Core}/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp (100%) delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h delete mode 100644 Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp delete mode 100644 Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp diff --git a/Core/GameEngine/CMakeLists.txt b/Core/GameEngine/CMakeLists.txt index 44dc742d056..5f26e644f89 100644 --- a/Core/GameEngine/CMakeLists.txt +++ b/Core/GameEngine/CMakeLists.txt @@ -173,11 +173,11 @@ set(GAMEENGINE_SRC Include/GameClient/GadgetListBox.h Include/GameClient/GadgetProgressBar.h Include/GameClient/GadgetPushButton.h -# Include/GameClient/GadgetRadioButton.h -# Include/GameClient/GadgetSlider.h -# Include/GameClient/GadgetStaticText.h -# Include/GameClient/GadgetTabControl.h -# Include/GameClient/GadgetTextEntry.h + Include/GameClient/GadgetRadioButton.h + Include/GameClient/GadgetSlider.h + Include/GameClient/GadgetStaticText.h + Include/GameClient/GadgetTabControl.h + Include/GameClient/GadgetTextEntry.h # Include/GameClient/GameClient.h Include/GameClient/GameFont.h # Include/GameClient/GameInfoWindow.h @@ -727,15 +727,15 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp Source/GameClient/GUI/Gadget/GadgetComboBox.cpp -# Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp + Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp Source/GameClient/GUI/Gadget/GadgetListBox.cpp Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp # Source/GameClient/GUI/Gadget/GadgetPushButton.cpp -# Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp -# Source/GameClient/GUI/Gadget/GadgetStaticText.cpp -# Source/GameClient/GUI/Gadget/GadgetTabControl.cpp -# Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp -# Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp + Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp + Source/GameClient/GUI/Gadget/GadgetStaticText.cpp + Source/GameClient/GUI/Gadget/GadgetTabControl.cpp + Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp + Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp Source/GameClient/GUI/GameFont.cpp Source/GameClient/GUI/GameWindow.cpp Source/GameClient/GUI/GameWindowGlobal.cpp @@ -749,8 +749,8 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp # Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp # Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp -# Source/GameClient/GUI/GUICallbacks/InGameChat.cpp -# Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp + Source/GameClient/GUI/GUICallbacks/InGameChat.cpp + Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp # Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -766,9 +766,9 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp # Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp # Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp + Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp -# Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp + Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp # Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetRadioButton.h b/Core/GameEngine/Include/GameClient/GadgetRadioButton.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetRadioButton.h rename to Core/GameEngine/Include/GameClient/GadgetRadioButton.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h b/Core/GameEngine/Include/GameClient/GadgetSlider.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetSlider.h rename to Core/GameEngine/Include/GameClient/GadgetSlider.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetStaticText.h b/Core/GameEngine/Include/GameClient/GadgetStaticText.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetStaticText.h rename to Core/GameEngine/Include/GameClient/GadgetStaticText.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTabControl.h b/Core/GameEngine/Include/GameClient/GadgetTabControl.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTabControl.h rename to Core/GameEngine/Include/GameClient/GadgetTabControl.h diff --git a/GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTextEntry.h b/Core/GameEngine/Include/GameClient/GadgetTextEntry.h similarity index 100% rename from GeneralsMD/Code/GameEngine/Include/GameClient/GadgetTextEntry.h rename to Core/GameEngine/Include/GameClient/GadgetTextEntry.h diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp rename to Core/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp similarity index 100% rename from GeneralsMD/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp rename to Core/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp diff --git a/Generals/Code/GameEngine/CMakeLists.txt b/Generals/Code/GameEngine/CMakeLists.txt index 041759c9b0f..1bd29230b30 100644 --- a/Generals/Code/GameEngine/CMakeLists.txt +++ b/Generals/Code/GameEngine/CMakeLists.txt @@ -160,11 +160,11 @@ set(GAMEENGINE_SRC # Include/GameClient/GadgetListBox.h # Include/GameClient/GadgetProgressBar.h # Include/GameClient/GadgetPushButton.h - Include/GameClient/GadgetRadioButton.h - Include/GameClient/GadgetSlider.h - Include/GameClient/GadgetStaticText.h - Include/GameClient/GadgetTabControl.h - Include/GameClient/GadgetTextEntry.h +# Include/GameClient/GadgetRadioButton.h +# Include/GameClient/GadgetSlider.h +# Include/GameClient/GadgetStaticText.h +# Include/GameClient/GadgetTabControl.h +# Include/GameClient/GadgetTextEntry.h Include/GameClient/GameClient.h # Include/GameClient/GameFont.h Include/GameClient/GameInfoWindow.h @@ -671,15 +671,15 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp # Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp # Source/GameClient/GUI/Gadget/GadgetComboBox.cpp - Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp # Source/GameClient/GUI/Gadget/GadgetListBox.cpp # Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp Source/GameClient/GUI/Gadget/GadgetPushButton.cpp - Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp - Source/GameClient/GUI/Gadget/GadgetStaticText.cpp - Source/GameClient/GUI/Gadget/GadgetTabControl.cpp - Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp - Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +# Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +# Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +# Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +# Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp # Source/GameClient/GUI/GameFont.cpp # Source/GameClient/GUI/GameWindow.cpp # Source/GameClient/GUI/GameWindowGlobal.cpp @@ -693,8 +693,8 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp - Source/GameClient/GUI/GUICallbacks/InGameChat.cpp - Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +# Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +# Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/DisconnectWindow.cpp @@ -709,9 +709,9 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h b/Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h deleted file mode 100644 index 331927813cd..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetRadioButton.h +++ /dev/null @@ -1,146 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetRadioButton.h ////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetRadioButton.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for RadioButtons -// -// RadioButton IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// enabledDrawData[ 1 ] is the enabled, unselected radio box -// enabledDrawData[ 2 ] is the enabled, selected radio box -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// disabledDrawData[ 1 ] is the disabled, unselected radio box -// disabledDrawData[ 2 ] si the disabled, selected radio box -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// hiliteDrawData[ 1 ] is the hilited, unselected radio box -// hiliteDrawData[ 2 ] is the hilited, selected radio box -// -// GadgetRadioGetEnabledImage // LEFT -// GadgetRadioGetEnabledUncheckedBoxImage // Middle -// GadgetRadioGetEnabledCheckedBoxImage // right -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetRadioSetText( GameWindow *g, UnicodeString text ); -extern void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ); -extern void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen ); - -inline void GadgetRadioSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetRadioSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetRadioSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline void GadgetRadioSetEnabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetRadioSetEnabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 1, color ); } -inline void GadgetRadioSetEnabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 1, color ); } -inline void GadgetRadioSetEnabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetRadioSetEnabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 2, color ); } -inline void GadgetRadioSetEnabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 2, color ); } -inline const Image *GadgetRadioGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetRadioGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetRadioGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } -inline const Image *GadgetRadioGetEnabledUncheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline Color GadgetRadioGetEnabledUncheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 1 ); } -inline Color GadgetRadioGetEnabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 1 ); } -inline const Image *GadgetRadioGetEnabledCheckedBoxImage( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline Color GadgetRadioGetEnabledCheckedBoxColor( GameWindow *g ) { return g->winGetEnabledColor( 2 ); } -inline Color GadgetRadioGetEnabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 2 ); } - -inline void GadgetRadioSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetRadioSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetRadioSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline void GadgetRadioSetDisabledUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetRadioSetDisabledUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 1, color ); } -inline void GadgetRadioSetDisabledUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 1, color ); } -inline void GadgetRadioSetDisabledCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetRadioSetDisabledCheckedBoxColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 2, color ); } -inline void GadgetRadioSetDisabledCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 2, color ); } -inline const Image *GadgetRadioGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetRadioGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetRadioGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } -inline const Image *GadgetRadioGetDisabledUncheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline Color GadgetRadioGetDisabledUncheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 1 ); } -inline Color GadgetRadioGetDisabledUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 1 ); } -inline const Image *GadgetRadioGetDisabledCheckedBoxImage( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline Color GadgetRadioGetDisabledCheckedBoxColor( GameWindow *g ) { return g->winGetDisabledColor( 2 ); } -inline Color GadgetRadioGetDisabledCheckedBoxBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 2 ); } - -inline void GadgetRadioSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetRadioSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetRadioSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline void GadgetRadioSetHiliteUncheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetRadioSetHiliteUncheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 1, color ); } -inline void GadgetRadioSetHiliteUncheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 1, color ); } -inline void GadgetRadioSetHiliteCheckedBoxImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetRadioSetHiliteCheckedBoxColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 2, color ); } -inline void GadgetRadioSetHiliteCheckedBoxBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 2, color ); } -inline const Image *GadgetRadioGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetRadioGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetRadioGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } -inline const Image *GadgetRadioGetHiliteUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline Color GadgetRadioGetHiliteUncheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 1 ); } -inline Color GadgetRadioGetHiliteUncheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 1 ); } -inline const Image *GadgetRadioGetHiliteCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline Color GadgetRadioGetHiliteCheckedBoxColor( GameWindow *g ) { return g->winGetHiliteColor( 2 ); } -inline Color GadgetRadioGetHiliteCheckedBoxBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 2 ); } - -inline const Image *GadgetRadioGetSelectedImage( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline const Image *GadgetRadioGetSelectedUncheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 4 ); } -inline const Image *GadgetRadioGetSelectedCheckedBoxImage( GameWindow *g ) { return g->winGetHiliteImage( 5 ); } - - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h b/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h deleted file mode 100644 index 1b3cfb034ab..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetSlider.h +++ /dev/null @@ -1,439 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetSlider.h /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetSlider.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for Sliders -// -// Slider Sliders are constructed of 4 pieces, two end pieces, -// a repeating center, and a smaller repeating center pieces -// to fill small seams. Since there are vertical sliders -// and horizontal sliders, the LEFT end of a horizontal -// slider is stored in the same place as the TOP end for a -// vertical slider. The RIGHT end of a horizontal is -// also equivalent to the BOTTOM end of a vertical one. -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/GadgetPushButton.h" -#include "GameClient/Gadget.h" -#include "GameClient/Image.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// -enum{ -HORIZONTAL_SLIDER_THUMB_POSITION = HORIZONTAL_SLIDER_THUMB_HEIGHT *2/3 -}; -// INLINING /////////////////////////////////////////////////////////////////// - -inline void GadgetSliderGetMinMax( GameWindow *g, Int *min, Int *max ) -{ - SliderData *sData = (SliderData *)g->winGetUserData(); - - *max = sData->maxVal; - *min = sData->minVal; - -} -inline GameWindow *GadgetSliderGetThumb( GameWindow *g ) { return g->winGetChild(); } - -inline void GadgetSliderSetPosition( GameWindow *win, Int pos ) -{ - TheWindowManager->winSendSystemMsg( win, - GSM_SET_SLIDER, - pos, - 0 ); -} - -inline Int GadgetSliderGetPosition( GameWindow *win ) -{ - SliderData *sData = (SliderData *)win->winGetUserData(); - if (sData) - { - return sData->position; - } - return -1; -} - -// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center -inline void GadgetSliderSetEnabledImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter ) -{ - g->winSetEnabledImage( 0, left ); - g->winSetEnabledImage( 1, right ); - g->winSetEnabledImage( 2, center ); - g->winSetEnabledImage( 3, smallCenter ); -} -inline void GadgetSliderSetEnabledImageLeft( GameWindow *g, const Image *left ) { g->winSetEnabledImage( 0, left ); } -inline void GadgetSliderSetEnabledImageTop( GameWindow *g, const Image *left ) { g->winSetEnabledImage( 0, left ); } -inline void GadgetSliderSetEnabledImageRight( GameWindow *g, const Image *right ) { g->winSetEnabledImage( 1, right ); } -inline void GadgetSliderSetEnabledImageBottom( GameWindow *g, const Image *right ) { g->winSetEnabledImage( 1, right ); } -inline void GadgetSliderSetEnabledImageCenter( GameWindow *g, const Image *center ) { g->winSetEnabledImage( 2, center ); } -inline void GadgetSliderSetEnabledImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetEnabledImage( 3, smallCenter ); } -inline void GadgetSliderSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetSliderSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline const Image *GadgetSliderGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetSliderGetEnabledImageTop( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetSliderGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetSliderGetEnabledImageBottom( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetSliderGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetSliderGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline Color GadgetSliderGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetSliderGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } - -// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center -inline void GadgetSliderSetDisabledImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter ) -{ - g->winSetDisabledImage( 0, left ); - g->winSetDisabledImage( 1, right ); - g->winSetDisabledImage( 2, center ); - g->winSetDisabledImage( 3, smallCenter ); -} -inline void GadgetSliderSetDisabledImageLeft( GameWindow *g, const Image *left ) { g->winSetDisabledImage( 0, left ); } -inline void GadgetSliderSetDisabledImageTop( GameWindow *g, const Image *left ) { g->winSetDisabledImage( 0, left ); } -inline void GadgetSliderSetDisabledImageRight( GameWindow *g, const Image *right ) { g->winSetDisabledImage( 1, right ); } -inline void GadgetSliderSetDisabledImageBottom( GameWindow *g, const Image *right ) { g->winSetDisabledImage( 1, right ); } -inline void GadgetSliderSetDisabledImageCenter( GameWindow *g, const Image *center ) { g->winSetDisabledImage( 2, center ); } -inline void GadgetSliderSetDisabledImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetDisabledImage( 3, smallCenter ); } -inline void GadgetSliderSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetSliderSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline const Image *GadgetSliderGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetSliderGetDisabledImageTop( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetSliderGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetSliderGetDisabledImageBottom( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetSliderGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetSliderGetDisabledImageSmallCenter( GameWindow *g ){ return g->winGetDisabledImage( 3 ); } -inline Color GadgetSliderGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetSliderGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } - -// sliders are drawn from pieces, a left/top, right/bottom, repeating center, and small repeating center -inline void GadgetSliderSetHiliteImages( GameWindow *g, const Image *left, const Image *right, const Image *center, const Image *smallCenter ) -{ - g->winSetHiliteImage( 0, left ); - g->winSetHiliteImage( 1, right ); - g->winSetHiliteImage( 2, center ); - g->winSetHiliteImage( 3, smallCenter ); -} -inline void GadgetSliderSetHiliteImageLeft( GameWindow *g, const Image *left ) { g->winSetHiliteImage( 0, left ); } -inline void GadgetSliderSetHiliteImageTop( GameWindow *g, const Image *left ) { g->winSetHiliteImage( 0, left ); } -inline void GadgetSliderSetHiliteImageRight( GameWindow *g, const Image *right ) { g->winSetHiliteImage( 1, right ); } -inline void GadgetSliderSetHiliteImageBottom( GameWindow *g, const Image *right ) { g->winSetHiliteImage( 1, right ); } -inline void GadgetSliderSetHiliteImageCenter( GameWindow *g, const Image *center ) { g->winSetHiliteImage( 2, center ); } -inline void GadgetSliderSetHiliteImageSmallCenter( GameWindow *g, const Image *smallCenter ) { g->winSetHiliteImage( 3, smallCenter ); } -inline void GadgetSliderSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetSliderSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline const Image *GadgetSliderGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetSliderGetHiliteImageTop( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetSliderGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetSliderGetHiliteImageBottom( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetSliderGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetSliderGetHiliteImageSmallCenter( GameWindow *g ){ return g->winGetHiliteImage( 3 ); } -inline Color GadgetSliderGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetSliderGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } - -/////////////////////////////////////////////////////////////////////////////// -// Functions to set the images and colors for the slider thumb -/////////////////////////////////////////////////////////////////////////////// - -// enabled -inline void GadgetSliderSetEnabledThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledImage( thumb, image ); - } -inline void GadgetSliderSetEnabledThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledColor( thumb, color ); - } -inline void GadgetSliderSetEnabledThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledBorderColor( thumb, color ); - } -inline void GadgetSliderSetEnabledSelectedThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledSelectedImage( thumb, image ); - } -inline void GadgetSliderSetEnabledSelectedThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledSelectedColor( thumb, color ); - } -inline void GadgetSliderSetEnabledSelectedThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetEnabledSelectedBorderColor( thumb, color ); - } -inline const Image *GadgetSliderGetEnabledThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetEnabledThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetEnabledThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline const Image *GadgetSliderGetEnabledSelectedThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledSelectedImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetEnabledSelectedThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledSelectedColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetEnabledSelectedThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetEnabledSelectedBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } - - -// disabled -inline void GadgetSliderSetDisabledThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledImage( thumb, image ); - } -inline void GadgetSliderSetDisabledThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledColor( thumb, color ); - } -inline void GadgetSliderSetDisabledThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledBorderColor( thumb, color ); - } -inline void GadgetSliderSetDisabledSelectedThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledSelectedImage( thumb, image ); - } -inline void GadgetSliderSetDisabledSelectedThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledSelectedColor( thumb, color ); - } -inline void GadgetSliderSetDisabledSelectedThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetDisabledSelectedBorderColor( thumb, color ); - } -inline const Image *GadgetSliderGetDisabledThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetDisabledThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetDisabledThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline const Image *GadgetSliderGetDisabledSelectedThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledSelectedImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetDisabledSelectedThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledSelectedColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetDisabledSelectedThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetDisabledSelectedBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } - -// hilite -inline void GadgetSliderSetHiliteThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteImage( thumb, image ); - } -inline void GadgetSliderSetHiliteThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteColor( thumb, color ); - } -inline void GadgetSliderSetHiliteThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteBorderColor( thumb, color ); - } -inline void GadgetSliderSetHiliteSelectedThumbImage( GameWindow *g, const Image *image ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteSelectedImage( thumb, image ); - } -inline void GadgetSliderSetHiliteSelectedThumbColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteSelectedColor( thumb, color ); - } -inline void GadgetSliderSetHiliteSelectedThumbBorderColor( GameWindow *g, Color color ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - GadgetButtonSetHiliteSelectedBorderColor( thumb, color ); - } -inline const Image *GadgetSliderGetHiliteThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetHiliteThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetHiliteThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline const Image *GadgetSliderGetHiliteSelectedThumbImage( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteSelectedImage( thumb ); - else - return nullptr; - } -inline Color GadgetSliderGetHiliteSelectedThumbColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteSelectedColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } -inline Color GadgetSliderGetHiliteSelectedThumbBorderColor( GameWindow *g ) - { - GameWindow *thumb = g->winGetChild(); - if( thumb ) - return GadgetButtonGetHiliteSelectedBorderColor( thumb ); - else - return WIN_COLOR_UNDEFINED; - } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h b/Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h deleted file mode 100644 index 83090aec761..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetStaticText.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetStaticText.h /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetStaticText.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for StaticTexts -// -// StaticText IMAGE/COLOR organization -// When control is enabled: -// enabledDrawData[ 0 ] is the background image for the whole enabled control -// -// When control is disabled: -// disabledDrawData[ 0 ] is the background image for the whole disabled control -// -// When control is hilited (mouse over it and enabled) -// hiliteDrawData[ 0 ] is the background image for the whole hilited control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" -// FORWARD REFERENCES ///////////////////////////////////////////////////////// - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -extern void GadgetStaticTextSetText( GameWindow *window, UnicodeString text ); -extern UnicodeString GadgetStaticTextGetText( GameWindow *window ); -extern void GadgetStaticTextSetFont( GameWindow *window, GameFont *font ); - -// text colors - -// enabled background -inline void GadgetStaticTextSetEnabledImage( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetStaticTextSetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetStaticTextSetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline const Image *GadgetStaticTextGetEnabledImage( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline Color GadgetStaticTextGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetStaticTextGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } - -// disabled background -inline void GadgetStaticTextSetDisabledImage( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetStaticTextSetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetStaticTextSetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline const Image *GadgetStaticTextGetDisabledImage( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline Color GadgetStaticTextGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetStaticTextGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } - -// hilite if we choose to use it -inline void GadgetStaticTextSetHiliteImage( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetStaticTextSetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetStaticTextSetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline const Image *GadgetStaticTextGetHiliteImage( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline Color GadgetStaticTextGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetStaticTextGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h b/Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h deleted file mode 100644 index 17a91ba631a..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetTabControl.h +++ /dev/null @@ -1,273 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: C:\projects\RTS\code\gameengine\Include\GameClient\GadgetTabControl.h -// -// Created: Graham Smallwood, November 2001 -// -// Desc: Helpful interface for TabControls -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -enum -{ - GTC_BACKGROUND = 0, - GTC_TAB_0, - GTC_TAB_1, - GTC_TAB_2, - GTC_TAB_3, - GTC_TAB_4, - GTC_TAB_5, - GTC_TAB_6, - GTC_TAB_7 -}; -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindow.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -extern void GadgetTabControlComputeTabRegion( GameWindow *tabControl );///< Recalc the tab positions based on userData -extern void GadgetTabControlCreateSubPanes( GameWindow *tabControl);///< Create (destroy old) Windows attached to userData as Panes -extern void GadgetTabControlComputeSubPaneSize( GameWindow *tabControl, Int *width, Int *height, Int *x, Int *y );///winSetEnabledImage( GTC_TAB_0, image ); } -inline void GadgetTabControlSetEnabledColorTabZero( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_0, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabZero( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_0, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabZero( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_0 ); } -inline Color GadgetTabControlGetEnabledColorTabZero( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_0 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabZero( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_0 ); } - -inline void GadgetTabControlSetEnabledImageTabOne( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_1, image ); } -inline void GadgetTabControlSetEnabledColorTabOne( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_1, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabOne( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_1, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabOne( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_1 ); } -inline Color GadgetTabControlGetEnabledColorTabOne( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_1 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabOne( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_1 ); } - -inline void GadgetTabControlSetEnabledImageTabTwo( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_2, image ); } -inline void GadgetTabControlSetEnabledColorTabTwo( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_2, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_2, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabTwo( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_2 ); } -inline Color GadgetTabControlGetEnabledColorTabTwo( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_2 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabTwo( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_2 ); } - -inline void GadgetTabControlSetEnabledImageTabThree( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_3, image ); } -inline void GadgetTabControlSetEnabledColorTabThree( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_3, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabThree( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_3, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabThree( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_3 ); } -inline Color GadgetTabControlGetEnabledColorTabThree( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_3 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabThree( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_3 ); } - -inline void GadgetTabControlSetEnabledImageTabFour( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_4, image ); } -inline void GadgetTabControlSetEnabledColorTabFour( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_4, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabFour( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_4, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabFour( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_4 ); } -inline Color GadgetTabControlGetEnabledColorTabFour( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_4 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabFour( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_4 ); } - -inline void GadgetTabControlSetEnabledImageTabFive( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_5, image ); } -inline void GadgetTabControlSetEnabledColorTabFive( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_5, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabFive( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_5, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabFive( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_5 ); } -inline Color GadgetTabControlGetEnabledColorTabFive( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_5 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabFive( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_5 ); } - -inline void GadgetTabControlSetEnabledImageTabSix( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_6, image ); } -inline void GadgetTabControlSetEnabledColorTabSix( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_6, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabSix( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_6, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabSix( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_6 ); } -inline Color GadgetTabControlGetEnabledColorTabSix( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_6 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabSix( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_6 ); } - -inline void GadgetTabControlSetEnabledImageTabSeven( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_TAB_7, image ); } -inline void GadgetTabControlSetEnabledColorTabSeven( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_TAB_7, color ); } -inline void GadgetTabControlSetEnabledBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_TAB_7, color ); } -inline const Image *GadgetTabControlGetEnabledImageTabSeven( GameWindow *g ) { return g->winGetEnabledImage( GTC_TAB_7 ); } -inline Color GadgetTabControlGetEnabledColorTabSeven( GameWindow *g ) { return g->winGetEnabledColor( GTC_TAB_7 ); } -inline Color GadgetTabControlGetEnabledBorderColorTabSeven( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_TAB_7 ); } - -inline void GadgetTabControlSetEnabledImageBackground( GameWindow *g, const Image *image ) { g->winSetEnabledImage( GTC_BACKGROUND, image ); } -inline void GadgetTabControlSetEnabledColorBackground( GameWindow *g, Color color ) { g->winSetEnabledColor( GTC_BACKGROUND, color ); } -inline void GadgetTabControlSetEnabledBorderColorBackground( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( GTC_BACKGROUND, color ); } -inline const Image *GadgetTabControlGetEnabledImageBackground( GameWindow *g ) { return g->winGetEnabledImage( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetEnabledColorBackground( GameWindow *g ) { return g->winGetEnabledColor( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetEnabledBorderColorBackground( GameWindow *g ) { return g->winGetEnabledBorderColor( GTC_BACKGROUND ); } - - - - -inline void GadgetTabControlSetDisabledImageTabZero( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_0, image ); } -inline void GadgetTabControlSetDisabledColorTabZero( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_0, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabZero( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_0, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabZero( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_0 ); } -inline Color GadgetTabControlGetDisabledColorTabZero( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_0 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabZero( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_0 ); } - -inline void GadgetTabControlSetDisabledImageTabOne( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_1, image ); } -inline void GadgetTabControlSetDisabledColorTabOne( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_1, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabOne( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_1, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabOne( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_1 ); } -inline Color GadgetTabControlGetDisabledColorTabOne( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_1 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabOne( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_1 ); } - -inline void GadgetTabControlSetDisabledImageTabTwo( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_2, image ); } -inline void GadgetTabControlSetDisabledColorTabTwo( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_2, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_2, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabTwo( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_2 ); } -inline Color GadgetTabControlGetDisabledColorTabTwo( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_2 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabTwo( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_2 ); } - -inline void GadgetTabControlSetDisabledImageTabThree( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_3, image ); } -inline void GadgetTabControlSetDisabledColorTabThree( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_3, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabThree( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_3, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabThree( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_3 ); } -inline Color GadgetTabControlGetDisabledColorTabThree( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_3 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabThree( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_3 ); } - -inline void GadgetTabControlSetDisabledImageTabFour( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_4, image ); } -inline void GadgetTabControlSetDisabledColorTabFour( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_4, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabFour( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_4, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabFour( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_4 ); } -inline Color GadgetTabControlGetDisabledColorTabFour( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_4 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabFour( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_4 ); } - -inline void GadgetTabControlSetDisabledImageTabFive( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_5, image ); } -inline void GadgetTabControlSetDisabledColorTabFive( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_5, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabFive( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_5, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabFive( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_5 ); } -inline Color GadgetTabControlGetDisabledColorTabFive( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_5 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabFive( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_5 ); } - -inline void GadgetTabControlSetDisabledImageTabSix( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_6, image ); } -inline void GadgetTabControlSetDisabledColorTabSix( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_6, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabSix( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_6, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabSix( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_6 ); } -inline Color GadgetTabControlGetDisabledColorTabSix( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_6 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabSix( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_6 ); } - -inline void GadgetTabControlSetDisabledImageTabSeven( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_TAB_7, image ); } -inline void GadgetTabControlSetDisabledColorTabSeven( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_TAB_7, color ); } -inline void GadgetTabControlSetDisabledBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_TAB_7, color ); } -inline const Image *GadgetTabControlGetDisabledImageTabSeven( GameWindow *g ) { return g->winGetDisabledImage( GTC_TAB_7 ); } -inline Color GadgetTabControlGetDisabledColorTabSeven( GameWindow *g ) { return g->winGetDisabledColor( GTC_TAB_7 ); } -inline Color GadgetTabControlGetDisabledBorderColorTabSeven( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_TAB_7 ); } - -inline void GadgetTabControlSetDisabledImageBackground( GameWindow *g, const Image *image ) { g->winSetDisabledImage( GTC_BACKGROUND, image ); } -inline void GadgetTabControlSetDisabledColorBackground( GameWindow *g, Color color ) { g->winSetDisabledColor( GTC_BACKGROUND, color ); } -inline void GadgetTabControlSetDisabledBorderColorBackground( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( GTC_BACKGROUND, color ); } -inline const Image *GadgetTabControlGetDisabledImageBackground( GameWindow *g ) { return g->winGetDisabledImage( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetDisabledColorBackground( GameWindow *g ) { return g->winGetDisabledColor( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetDisabledBorderColorBackground( GameWindow *g ) { return g->winGetDisabledBorderColor( GTC_BACKGROUND ); } - - - - -inline void GadgetTabControlSetHiliteImageTabZero( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_0, image ); } -inline void GadgetTabControlSetHiliteColorTabZero( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_0, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabZero( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_0, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabZero( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_0 ); } -inline Color GadgetTabControlGetHiliteColorTabZero( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_0 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabZero( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_0 ); } - -inline void GadgetTabControlSetHiliteImageTabOne( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_1, image ); } -inline void GadgetTabControlSetHiliteColorTabOne( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_1, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabOne( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_1, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabOne( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_1 ); } -inline Color GadgetTabControlGetHiliteColorTabOne( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_1 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabOne( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_1 ); } - -inline void GadgetTabControlSetHiliteImageTabTwo( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_2, image ); } -inline void GadgetTabControlSetHiliteColorTabTwo( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_2, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabTwo( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_2, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabTwo( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_2 ); } -inline Color GadgetTabControlGetHiliteColorTabTwo( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_2 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabTwo( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_2 ); } - -inline void GadgetTabControlSetHiliteImageTabThree( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_3, image ); } -inline void GadgetTabControlSetHiliteColorTabThree( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_3, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabThree( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_3, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabThree( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_3 ); } -inline Color GadgetTabControlGetHiliteColorTabThree( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_3 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabThree( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_3 ); } - -inline void GadgetTabControlSetHiliteImageTabFour( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_4, image ); } -inline void GadgetTabControlSetHiliteColorTabFour( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_4, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabFour( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_4, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabFour( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_4 ); } -inline Color GadgetTabControlGetHiliteColorTabFour( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_4 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabFour( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_4 ); } - -inline void GadgetTabControlSetHiliteImageTabFive( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_5, image ); } -inline void GadgetTabControlSetHiliteColorTabFive( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_5, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabFive( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_5, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabFive( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_5 ); } -inline Color GadgetTabControlGetHiliteColorTabFive( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_5 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabFive( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_5 ); } - -inline void GadgetTabControlSetHiliteImageTabSix( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_6, image ); } -inline void GadgetTabControlSetHiliteColorTabSix( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_6, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabSix( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_6, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabSix( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_6 ); } -inline Color GadgetTabControlGetHiliteColorTabSix( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_6 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabSix( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_6 ); } - -inline void GadgetTabControlSetHiliteImageTabSeven( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_TAB_7, image ); } -inline void GadgetTabControlSetHiliteColorTabSeven( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_TAB_7, color ); } -inline void GadgetTabControlSetHiliteBorderColorTabSeven( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_TAB_7, color ); } -inline const Image *GadgetTabControlGetHiliteImageTabSeven( GameWindow *g ) { return g->winGetHiliteImage( GTC_TAB_7 ); } -inline Color GadgetTabControlGetHiliteColorTabSeven( GameWindow *g ) { return g->winGetHiliteColor( GTC_TAB_7 ); } -inline Color GadgetTabControlGetHiliteBorderColorTabSeven( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_TAB_7 ); } - -inline void GadgetTabControlSetHiliteImageBackground( GameWindow *g, const Image *image ) { g->winSetHiliteImage( GTC_BACKGROUND, image ); } -inline void GadgetTabControlSetHiliteColorBackground( GameWindow *g, Color color ) { g->winSetHiliteColor( GTC_BACKGROUND, color ); } -inline void GadgetTabControlSetHiliteBorderColorBackground( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( GTC_BACKGROUND, color ); } -inline const Image *GadgetTabControlGetHiliteImageBackground( GameWindow *g ) { return g->winGetHiliteImage( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetHiliteColorBackground( GameWindow *g ) { return g->winGetHiliteColor( GTC_BACKGROUND ); } -inline Color GadgetTabControlGetHiliteBorderColorBackground( GameWindow *g ) { return g->winGetHiliteBorderColor( GTC_BACKGROUND ); } - - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h b/Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h deleted file mode 100644 index 5d9dd65703d..00000000000 --- a/Generals/Code/GameEngine/Include/GameClient/GadgetTextEntry.h +++ /dev/null @@ -1,124 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: GadgetTextEntry.h //////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: GadgetTextEntry.h -// -// Created: Colin Day, June 2001 -// -// Desc: Helpful interface for TextEntrys -// -// TextEntry IMAGE/COLOR organization -// -// note that windows that have an outlined text field will use the color -// for the outline specified with the TextBorder... functions -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -#pragma once - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "GameClient/GameWindowManager.h" - -// FORWARD REFERENCES ///////////////////////////////////////////////////////// -class GameWindow; - -// TYPE DEFINES /////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// INLINING /////////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -inline void GadgetTextEntrySetText( GameWindow *g, UnicodeString text ) -{ - TheWindowManager->winSendSystemMsg( g, GEM_SET_TEXT, (WindowMsgData)&text, 0 ); -} -extern UnicodeString GadgetTextEntryGetText( GameWindow *textentry ); ///< Get the text from the text entry field -extern void GadgetTextEntrySetMaxLen( GameWindow *g, Short length ); -extern void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ); ///< set font for window and edit text display strings -inline void GadgetTextEntrySetTextColor( GameWindow *g, Color color ) -{ - Color back = g->winGetEnabledTextBorderColor(); - g->winSetEnabledTextColors(color,back); - g->winSetDisabledTextColors(GameDarkenColor(color, 25),back); -} -// text colors - -// enabled -inline void GadgetTextEntrySetEnabledImageLeft( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 0, image ); } -inline void GadgetTextEntrySetEnabledImageRight( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 1, image ); } -inline void GadgetTextEntrySetEnabledImageCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 2, image ); } -inline void GadgetTextEntrySetEnabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetEnabledImage( 3, image ); } -inline void GadgetTextEntrySetEnabledColor( GameWindow *g, Color color ) { g->winSetEnabledColor( 0, color ); } -inline void GadgetTextEntrySetEnabledBorderColor( GameWindow *g, Color color ) { g->winSetEnabledBorderColor( 0, color ); } -inline const Image *GadgetTextEntryGetEnabledImageLeft( GameWindow *g ) { return g->winGetEnabledImage( 0 ); } -inline const Image *GadgetTextEntryGetEnabledImageRight( GameWindow *g ) { return g->winGetEnabledImage( 1 ); } -inline const Image *GadgetTextEntryGetEnabledImageCenter( GameWindow *g ) { return g->winGetEnabledImage( 2 ); } -inline const Image *GadgetTextEntryGetEnabledImageSmallCenter( GameWindow *g ) { return g->winGetEnabledImage( 3 ); } -inline Color GadgetTextEntryGetEnabledColor( GameWindow *g ) { return g->winGetEnabledColor( 0 ); } -inline Color GadgetTextEntryGetEnabledBorderColor( GameWindow *g ) { return g->winGetEnabledBorderColor( 0 ); } - -// disabled -inline void GadgetTextEntrySetDisabledImageLeft( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 0, image ); } -inline void GadgetTextEntrySetDisabledImageRight( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 1, image ); } -inline void GadgetTextEntrySetDisabledImageCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 2, image ); } -inline void GadgetTextEntrySetDisabledImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetDisabledImage( 3, image ); } -inline void GadgetTextEntrySetDisabledColor( GameWindow *g, Color color ) { g->winSetDisabledColor( 0, color ); } -inline void GadgetTextEntrySetDisabledBorderColor( GameWindow *g, Color color ) { g->winSetDisabledBorderColor( 0, color ); } -inline const Image *GadgetTextEntryGetDisabledImageLeft( GameWindow *g ) { return g->winGetDisabledImage( 0 ); } -inline const Image *GadgetTextEntryGetDisabledImageRight( GameWindow *g ) { return g->winGetDisabledImage( 1 ); } -inline const Image *GadgetTextEntryGetDisabledImageCenter( GameWindow *g ) { return g->winGetDisabledImage( 2 ); } -inline const Image *GadgetTextEntryGetDisabledImageSmallCenter( GameWindow *g ) { return g->winGetDisabledImage( 3 ); } -inline Color GadgetTextEntryGetDisabledColor( GameWindow *g ) { return g->winGetDisabledColor( 0 ); } -inline Color GadgetTextEntryGetDisabledBorderColor( GameWindow *g ) { return g->winGetDisabledBorderColor( 0 ); } - -// hilite -inline void GadgetTextEntrySetHiliteImageLeft( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 0, image ); } -inline void GadgetTextEntrySetHiliteImageRight( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 1, image ); } -inline void GadgetTextEntrySetHiliteImageCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 2, image ); } -inline void GadgetTextEntrySetHiliteImageSmallCenter( GameWindow *g, const Image *image ) { g->winSetHiliteImage( 3, image ); } -inline void GadgetTextEntrySetHiliteColor( GameWindow *g, Color color ) { g->winSetHiliteColor( 0, color ); } -inline void GadgetTextEntrySetHiliteBorderColor( GameWindow *g, Color color ) { g->winSetHiliteBorderColor( 0, color ); } -inline const Image *GadgetTextEntryGetHiliteImageLeft( GameWindow *g ) { return g->winGetHiliteImage( 0 ); } -inline const Image *GadgetTextEntryGetHiliteImageRight( GameWindow *g ) { return g->winGetHiliteImage( 1 ); } -inline const Image *GadgetTextEntryGetHiliteImageCenter( GameWindow *g ) { return g->winGetHiliteImage( 2 ); } -inline const Image *GadgetTextEntryGetHiliteImageSmallCenter( GameWindow *g ) { return g->winGetHiliteImage( 3 ); } -inline Color GadgetTextEntryGetHiliteColor( GameWindow *g ) { return g->winGetHiliteColor( 0 ); } -inline Color GadgetTextEntryGetHiliteBorderColor( GameWindow *g ) { return g->winGetHiliteBorderColor( 0 ); } - -// EXTERNALS ////////////////////////////////////////////////////////////////// diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp deleted file mode 100644 index 0080b64a8dd..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +++ /dev/null @@ -1,361 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: InGameChat.cpp /////////////////////////////////////////////////////////////////////// -// Author: Matthew D. Campbell - June 2002 -// Desc: GUI callbacks for the in-game chat entry -/////////////////////////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/Player.h" -#include "Common/PlayerList.h" -#include "GameClient/DisconnectMenu.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/GameClient.h" -#include "GameClient/GameText.h" -#include "GameClient/GUICallbacks.h" -#include "GameClient/InGameUI.h" -#include "GameClient/LanguageFilter.h" -#include "GameLogic/GameLogic.h" -#include "GameNetwork/GameInfo.h" -#include "GameNetwork/NetworkInterface.h" - -static GameWindow *chatWindow = nullptr; -static GameWindow *chatTextEntry = nullptr; -static GameWindow *chatTypeStaticText = nullptr; -static UnicodeString s_savedChat; -static InGameChatType inGameChatType; - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ShowInGameChat( Bool immediate ) -{ - if (TheGameLogic->isInReplayGame()) - return; - - if (TheInGameUI->isQuitMenuVisible()) - return; - - if (TheDisconnectMenu && TheDisconnectMenu->isScreenVisible()) - return; - - if (chatWindow) - { - chatWindow->winHide(FALSE); - chatWindow->winEnable(TRUE); - chatTextEntry->winHide(FALSE); - chatTextEntry->winEnable(TRUE); - GadgetTextEntrySetText( chatTextEntry, s_savedChat ); - s_savedChat.clear(); - } - else - { - chatWindow = TheWindowManager->winCreateFromScript( "InGameChat.wnd" ); - - static NameKeyType textEntryChatID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:TextEntryChat" ); - chatTextEntry = TheWindowManager->winGetWindowFromId( nullptr, textEntryChatID ); - GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); - - static NameKeyType chatTypeStaticTextID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:StaticTextChatType" ); - chatTypeStaticText = TheWindowManager->winGetWindowFromId( nullptr, chatTypeStaticTextID ); - } - TheWindowManager->winSetFocus( chatTextEntry ); - SetInGameChatType( INGAME_CHAT_EVERYONE ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ResetInGameChat() -{ - if(chatWindow) - TheWindowManager->winDestroy( chatWindow ); - chatWindow = nullptr; - chatTextEntry = nullptr; - chatTypeStaticText = nullptr; - s_savedChat.clear(); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void HideInGameChat( Bool immediate ) -{ - if (chatWindow) - { - s_savedChat = GadgetTextEntryGetText( chatTextEntry ); - chatWindow->winHide(TRUE); - chatWindow->winEnable(FALSE); - chatTextEntry->winHide(TRUE); - chatTextEntry->winEnable(FALSE); - TheWindowManager->winSetFocus( nullptr ); - } - TheWindowManager->winSetFocus( nullptr ); -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void SetInGameChatType( InGameChatType chatType ) -{ - inGameChatType = chatType; - if (chatTypeStaticText) - { - switch (inGameChatType) - { - case INGAME_CHAT_EVERYONE: - if (ThePlayerList->getLocalPlayer()->isPlayerActive()) - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Everyone") ); - else - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Observers") ); - break; - case INGAME_CHAT_ALLIES: - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Allies") ); - break; - case INGAME_CHAT_PLAYERS: - GadgetStaticTextSetText( chatTypeStaticText, TheGameText->fetch("Chat:Players") ); - break; - } - } -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -Bool IsInGameChatActive() { - if (chatWindow != nullptr) { - if (chatWindow->winIsHidden() == FALSE) { - return TRUE; - } - } - return FALSE; -} - -// Slash commands ------------------------------------------------------------------------- -extern "C" { -int getQR2HostingStatus(); -} -extern int isThreadHosting; - -Bool handleInGameSlashCommands(UnicodeString uText) -{ - AsciiString message; - message.translate(uText); - - if (message.getCharAt(0) != '/') - { - return FALSE; // not a slash command - } - - AsciiString remainder = message.str() + 1; - AsciiString token; - remainder.nextToken(&token); - token.toLower(); - - if (token == "host") - { - UnicodeString s; - s.format(L"Hosting qr2:%d thread:%d", getQR2HostingStatus(), isThreadHosting); - TheInGameUI->message(s); - return TRUE; // was a slash command - } - - return FALSE; // not a slash command -} - -// ------------------------------------------------------------------------------------------------ -// ------------------------------------------------------------------------------------------------ -void ToggleInGameChat( Bool immediate ) -{ - static Bool justHid = false; - if (justHid) - { - justHid = false; - return; - } - - if (TheGameLogic->isInReplayGame()) - return; - - if (!TheGameInfo->isMultiPlayer() && TheGlobalData->m_netMinPlayers) - return; - - if (chatWindow) - { - Bool show = chatWindow->winIsHidden(); - if (show) - ShowInGameChat( immediate ); - else - { - if (chatTextEntry) - { - // Send what is there, clear it out, and hide the window - UnicodeString msg = GadgetTextEntryGetText( chatTextEntry ); - msg.trim(); - if (!msg.isEmpty() && !handleInGameSlashCommands(msg)) - { - const Player *localPlayer = ThePlayerList->getLocalPlayer(); - AsciiString playerName; - Int playerMask = 0; - - for (Int i=0; ifindPlayerWithNameKey( TheNameKeyGenerator->nameToKey( playerName ) ); - if (player && localPlayer) - { - switch (inGameChatType) - { - case INGAME_CHAT_EVERYONE: - if (!TheGameInfo->getConstSlot(i)->isMuted()) - playerMask |= (1<getRelationship(localPlayer->getDefaultTeam()) == ALLIES && - localPlayer->getRelationship(player->getDefaultTeam()) == ALLIES) || player==localPlayer ) - playerMask |= (1<filterLine(msg); - TheNetwork->sendChat(msg, playerMask); - } - GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); - HideInGameChat( immediate ); - justHid = true; - } - } - } - else - { - ShowInGameChat( immediate ); - } -} - - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGameChatInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; -// UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - HideInGameChat(); - return MSG_HANDLED; - //return MSG_IGNORED; - } - - } - - return MSG_HANDLED; - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGameChatSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - //--------------------------------------------------------------------------------------------- - case GGM_FOCUS_CHANGE: - { -// Bool focus = (Bool) mData1; - //if (focus) - //TheWindowManager->winSetGrabWindow( chatTextEntry ); - break; - } - - //--------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - return MSG_HANDLED; - } - - //--------------------------------------------------------------------------------------------- - case GEM_EDIT_DONE: - { - ToggleInGameChat(); - //HideInGameChat(); - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - static NameKeyType buttonClearID = TheNameKeyGenerator->nameToKey( "InGameChat.wnd:ButtonClear" ); - if (control && control->winGetWindowId() == buttonClearID) - { - if (chatTextEntry) - GadgetTextEntrySetText( chatTextEntry, UnicodeString::TheEmptyString ); - s_savedChat.clear(); - } - break; - - } - - //--------------------------------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp deleted file mode 100644 index e2013ac2748..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +++ /dev/null @@ -1,250 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: InGamePopupMessage.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: InGamePopupMessage.cpp -// -// author: Chris Huybregts -// -// purpose: Init, input, and system for the in game message popup -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GlobalData.h" -#include "Common/NameKeyGenerator.h" -#include "Common/version.h" -#include "Common/MessageStream.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetStaticText.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/InGameUI.h" -#include "GameClient/DisplayStringManager.h" - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static NameKeyType parentID = NAMEKEY_INVALID; -static NameKeyType staticTextMessageID = NAMEKEY_INVALID; -static NameKeyType buttonOkID = NAMEKEY_INVALID; - - -static GameWindow *parent = nullptr; -static GameWindow *staticTextMessage = nullptr; -static GameWindow *buttonOk = nullptr; - - -static Bool pause = FALSE; -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -/** Initialize the InGamePopupMessageInit menu */ -//------------------------------------------------------------------------------------------------- -void InGamePopupMessageInit( WindowLayout *layout, void *userData ) -{ - - parentID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:InGamePopupMessageParent"); - parent = TheWindowManager->winGetWindowFromId(nullptr, parentID); - - staticTextMessageID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:StaticTextMessage"); - staticTextMessage = TheWindowManager->winGetWindowFromId(parent, staticTextMessageID); - buttonOkID = TheNameKeyGenerator->nameToKey("InGamePopupMessage.wnd:ButtonOk"); - buttonOk = TheWindowManager->winGetWindowFromId(parent, buttonOkID); - - PopupMessageData *pMData = TheInGameUI->getPopupMessageData(); - - if(!pMData) - { - DEBUG_ASSERTCRASH(pMData, ("We're in InGamePopupMessage without a pointer to pMData") ); - ///< @todo: add a call to the close this bitch method when I implement it CLH - return; - } - - DisplayString *tempString = TheDisplayStringManager->newDisplayString(); - tempString->setText(pMData->message); - tempString->setFont(staticTextMessage->winGetFont()); - tempString->setWordWrap(pMData->width - 14); - Int width, height; - tempString->getSize(&width, &height); - TheDisplayStringManager->freeDisplayString(tempString); - - GadgetStaticTextSetText(staticTextMessage, pMData->message); - // set the positions/sizes - Int widthOk, heightOk; - buttonOk->winGetSize(&widthOk, &heightOk); - parent->winSetPosition( pMData->x, pMData->y); - parent->winSetSize( pMData->width, height + 7 + 2 + 2 + heightOk + 2 ); - staticTextMessage->winSetPosition( 2, 2); - staticTextMessage->winSetSize( pMData->width - 4, height + 7); - buttonOk->winSetPosition(pMData->width - widthOk - 2, height + 7 + 2 + 2); - staticTextMessage->winSetEnabledTextColors(pMData->textColor, 0); - pause = pMData->pause; - if(pMData->pause) - TheWindowManager->winSetModal( parent ); - - TheWindowManager->winSetFocus( parent ); - - parent->winHide(FALSE); - parent->winBringToTop(); -} - -//------------------------------------------------------------------------------------------------- -/** InGamePopupMessageInput callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGamePopupMessageInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - // if (buttonPushed) - // break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ENTER: - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonOk, buttonOkID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - return MSG_IGNORED; - - -} - -//------------------------------------------------------------------------------------------------- -/** InGamePopupMessageSystem callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType InGamePopupMessageSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonOkID ) - { - if(!pause) - TheMessageStream->appendMessage( GameMessage::MSG_CLEAR_INGAME_POPUP_MESSAGE ); - else - TheInGameUI->clearPopupMessageData(); - } - break; - } - default: - return MSG_IGNORED; - - } - - - return MSG_HANDLED; - -} - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp deleted file mode 100644 index 1a4cb024866..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PopupCommunicator.cpp ///////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: PopupCommunicator.cpp -// -// Created: Chris Brue, July 2002 -// -// Desc: Electronic Arts instant messaging system -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// INCLUDES /////////////////////////////////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "GameClient/GUICallbacks.h" -#include "GameClient/GameWindowManager.h" - -// PRIVATE DATA /////////////////////////////////////////////////////////////////////////////////// -static NameKeyType buttonOkID = NAMEKEY_INVALID; -static GameWindow *buttonOk = nullptr; -static GameWindow *parent = nullptr; - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////////////////////////// - -//------------------------------------------------------------------------------------------------- -/** Initialize the Popup Communicator */ -//------------------------------------------------------------------------------------------------- -void PopupCommunicatorInit( WindowLayout *layout, void *userData ) -{ - - //set keyboard focus to main parent and set modal - NameKeyType parentID = TheNameKeyGenerator->nameToKey("PopupCommunicator.wnd:PopupCommunicator"); - parent = TheWindowManager->winGetWindowFromId( nullptr, parentID ); - TheWindowManager->winSetFocus( parent ); - TheWindowManager->winSetModal( parent ); - - // get ids for our children controls - buttonOkID = TheNameKeyGenerator->nameToKey( "PopupCommunicator.wnd:ButtonOk" ); - buttonOk = TheWindowManager->winGetWindowFromId( parent, buttonOkID ); - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator shutdown method */ -//------------------------------------------------------------------------------------------------- -void PopupCommunicatorShutdown( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator update method */ -//------------------------------------------------------------------------------------------------- -void PopupcommunicatorUpdate( WindowLayout *layout, void *userData ) -{ - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator input callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupCommunicatorInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - - TheWindowManager->winSendSystemMsg( window, GBM_SELECTED, - (WindowMsgData)buttonOk, buttonOkID ); - - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** Popup Communicator window system callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupCommunicatorSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == buttonOkID ) - { - WindowLayout *popupCommunicatorLayout = window->winGetLayout(); - if (popupCommunicatorLayout) - { - popupCommunicatorLayout->destroyWindows(); - deleteInstance(popupCommunicatorLayout); - popupCommunicatorLayout = nullptr; - } - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp deleted file mode 100644 index 193183b0665..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +++ /dev/null @@ -1,263 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: PopupJoinGame.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Electronic Arts Pacific. -// -// Confidential Information -// Copyright (C) 2002 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// created: Jul 2002 -// -// Filename: PopupJoinGame.cpp -// -// author: Matthew D. Campbell -// -// purpose: Contains the Callbacks for the Join Game Popup -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -//----------------------------------------------------------------------------- -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// USER INCLUDES ////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -#include "Common/GlobalData.h" -#include "Common/NameKeyGenerator.h" -#include "GameClient/WindowLayout.h" -#include "GameClient/Gadget.h" -#include "GameClient/KeyDefs.h" -#include "GameClient/GadgetTextEntry.h" -#include "GameClient/GadgetStaticText.h" -#include "GameNetwork/GameSpy/PeerDefs.h" -#include "GameNetwork/GameSpy/PeerThread.h" -#include "GameNetwork/GameSpyOverlay.h" - - -//----------------------------------------------------------------------------- -// DEFINES //////////////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static NameKeyType parentPopupID = NAMEKEY_INVALID; -static NameKeyType textEntryGamePasswordID = NAMEKEY_INVALID; -static NameKeyType buttonCancelID = NAMEKEY_INVALID; - -static GameWindow *parentPopup = nullptr; -static GameWindow *textEntryGamePassword = nullptr; - -static void joinGame( AsciiString password ); - -//----------------------------------------------------------------------------- -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------------------------- -/** Initialize the PopupHostGameInit menu */ -//------------------------------------------------------------------------------------------------- -void PopupJoinGameInit( WindowLayout *layout, void *userData ) -{ - parentPopupID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:ParentJoinPopUp"); - parentPopup = TheWindowManager->winGetWindowFromId(nullptr, parentPopupID); - - textEntryGamePasswordID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:TextEntryGamePassword"); - textEntryGamePassword = TheWindowManager->winGetWindowFromId(parentPopup, textEntryGamePasswordID); - GadgetTextEntrySetText(textEntryGamePassword, UnicodeString::TheEmptyString); - - NameKeyType staticTextGameNameID = TheNameKeyGenerator->nameToKey("PopupJoinGame.wnd:StaticTextGameName"); - GameWindow *staticTextGameName = TheWindowManager->winGetWindowFromId(parentPopup, staticTextGameNameID); - GadgetStaticTextSetText(staticTextGameName, UnicodeString::TheEmptyString); - - buttonCancelID = NAMEKEY("PopupJoinGame.wnd:ButtonCancel"); - - GameSpyStagingRoom *ourRoom = TheGameSpyInfo->findStagingRoomByID(TheGameSpyInfo->getCurrentStagingRoomID()); - if (ourRoom) - GadgetStaticTextSetText(staticTextGameName, ourRoom->getGameName()); - - TheWindowManager->winSetFocus( parentPopup ); - TheWindowManager->winSetModal( parentPopup ); - -} - -//------------------------------------------------------------------------------------------------- -/** PopupHostGameInput callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupJoinGameInput( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CHAR: - { - UnsignedByte key = mData1; - UnsignedByte state = mData2; -// if (buttonPushed) -// break; - - switch( key ) - { - - // ---------------------------------------------------------------------------------------- - case KEY_ESC: - { - - // - // send a simulated selected event to the parent window of the - // back/exit button - // - if( BitIsSet( state, KEY_STATE_UP ) ) - { - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - SetLobbyAttemptHostJoin( FALSE ); - parentPopup = nullptr; - } - - // don't let key fall through anywhere else - return MSG_HANDLED; - - } - - } - - } - - } - - return MSG_IGNORED; - -} - -//------------------------------------------------------------------------------------------------- -/** PopupHostGameSystem callback */ -//------------------------------------------------------------------------------------------------- -WindowMsgHandledType PopupJoinGameSystem( GameWindow *window, UnsignedInt msg, WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - - // -------------------------------------------------------------------------------------------- - case GWM_CREATE: - { - - break; - - } - //--------------------------------------------------------------------------------------------- - case GWM_DESTROY: - { - - break; - - } - - //--------------------------------------------------------------------------------------------- - case GBM_SELECTED: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - if (controlID == buttonCancelID) - { - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - SetLobbyAttemptHostJoin( FALSE ); - parentPopup = nullptr; - } - break; - } - - //---------------------------------------------------------------------------------------------- - case GWM_INPUT_FOCUS: - { - - // if we're givin the opportunity to take the keyboard focus we must say we want it - if( mData1 == TRUE ) - *(Bool *)mData2 = TRUE; - - break; - - } - //--------------------------------------------------------------------------------------------- - case GEM_EDIT_DONE: - { - GameWindow *control = (GameWindow *)mData1; - Int controlID = control->winGetWindowId(); - - if( controlID == textEntryGamePasswordID ) - { - // read the user's input and clear the entry box - UnicodeString txtInput; - txtInput.set(GadgetTextEntryGetText( textEntryGamePassword )); - GadgetTextEntrySetText(textEntryGamePassword, UnicodeString::TheEmptyString); - txtInput.trim(); - if (!txtInput.isEmpty()) - { - AsciiString munkee; - munkee.translate(txtInput); - joinGame(munkee); - } - } - break; - } - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - - -//----------------------------------------------------------------------------- -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- - -static void joinGame( AsciiString password ) -{ - GameSpyStagingRoom *ourRoom = TheGameSpyInfo->findStagingRoomByID(TheGameSpyInfo->getCurrentStagingRoomID()); - if (!ourRoom) - { - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - SetLobbyAttemptHostJoin( FALSE ); - parentPopup = nullptr; - return; - } - PeerRequest req; - req.peerRequestType = PeerRequest::PEERREQUEST_JOINSTAGINGROOM; - req.text = ourRoom->getGameName().str(); - req.stagingRoom.id = ourRoom->getID(); - req.password = password.str(); - TheGameSpyPeerMessageQueue->addRequest(req); - DEBUG_LOG(("Attempting to join game %d(%ls) with password [%s]", ourRoom->getID(), ourRoom->getGameName().str(), password.str())); - GameSpyCloseOverlay(GSOVERLAY_GAMEPASSWORD); - parentPopup = nullptr; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp deleted file mode 100644 index 6be12558529..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +++ /dev/null @@ -1,481 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: HorizontalSlider.cpp ///////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: HorizontalSlider.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Horizontal GUI slider -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetSlider.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetHorizontalSliderInput ================================================ -/** Handle input for horizontal slider */ -//============================================================================= -WindowMsgHandledType GadgetHorizontalSliderInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ICoord2D size, childSize, childCenter; - window->winGetSize( &size.x, &size.y ); - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - - if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) - { - WinInstanceData *instDataChild = window->winGetChild()->winGetInstanceData(); - BitSet(instDataChild->m_state, WIN_STATE_HILITED); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK )) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - if(window->winGetChild() && BitIsSet(window->winGetChild()->winGetStyle(),GWS_PUSH_BUTTON) ) - { - WinInstanceData *instDataChild = window->winGetChild()->winGetInstanceData(); - BitClear(instDataChild->m_state, WIN_STATE_HILITED); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - mData1 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - Int x, y; - Int mousex = mData1 & 0xFFFF; -// Int mousey = mData1 >> 16; - - GameWindow *child = window->winGetChild(); - Int pageClickSize, clickPos; - - window->winGetScreenPosition( &x, &y ); - - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetPosition( &childCenter.x, &childCenter.y ); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // when you click on the slider, but not the button, we will jump - // the slider position up/down by this much - // - pageClickSize = size.x / 5; - - clickPos = mousex - x; - if( clickPos >= childCenter.x ) - { - - clickPos = childCenter.x + pageClickSize; - if( clickPos > mousex - x ) - clickPos = mousex - x; - - } - else - { - - clickPos = childCenter.x - pageClickSize; - if( clickPos < mousex - x ) - clickPos = mousex - x; - - } - - // keep it all valid to the window - if( clickPos > x + size.x - childSize.x / 2 ) - clickPos = x + size.y - childSize.x / 2; - if( clickPos < childSize.x / 2 ) - clickPos = childSize.x / 2; - - child->winSetPosition( clickPos - childSize.x / 2, HORIZONTAL_SLIDER_THUMB_POSITION); - TheWindowManager->winSendSystemMsg( window, GGM_LEFT_DRAG, 0, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_RIGHT: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position > s->minVal + 1 ) - { - GameWindow *child = window->winGetChild(); - - s->position -= 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - - // Translate to window coords - child->winSetPosition( (Int)((s->position - s->minVal) * s->numTicks), HORIZONTAL_SLIDER_THUMB_POSITION ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position < s->maxVal - 1 ) - { - GameWindow *child = window->winGetChild(); - - s->position += 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - - // Translate to window coords - child->winSetPosition( (Int)((s->position - s->minVal) * s->numTicks),HORIZONTAL_SLIDER_THUMB_POSITION ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - case KEY_UP: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - // -------------------------------------------------------------------- - default: - return MSG_IGNORED; - - } - - break; - - } - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetHorizontalSliderSystem =============================================== -/** Handle system messages for horizontal slider */ -//============================================================================= -WindowMsgHandledType GadgetHorizontalSliderSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - ICoord2D size, childSize, childCenter,childRelativePos; - window->winGetSize( &size.x, &size.y ); - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { - Int mousex = mData2 & 0xFFFF; -// Int mousey = mData2 >> 16; - Int x, y, delta; - GameWindow *child = window->winGetChild(); - - - window->winGetScreenPosition( &x, &y ); - - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetScreenPosition( &childCenter.x, &childCenter.y ); - child->winGetPosition(&childRelativePos.x, &childRelativePos.y); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // ignore drag attempts when the mouse is right or left of slider totally - // and put the dragging thumb back at the slider pos - // - if( mousex > x + size.x -HORIZONTAL_SLIDER_THUMB_WIDTH/2 ) - { - - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->maxVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - else if( mousex < x + HORIZONTAL_SLIDER_THUMB_WIDTH/2) - { - - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->minVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - - if( childCenter.x < x + childSize.x / 2 ) - { - child->winSetPosition( 0,HORIZONTAL_SLIDER_THUMB_POSITION ); - s->position = s->minVal; - - } - else if( childCenter.x >= x + size.x - childSize.x / 2 ) - { - child->winSetPosition( (Int)((s->maxVal - s->minVal) * s->numTicks) -HORIZONTAL_SLIDER_THUMB_WIDTH/2 , HORIZONTAL_SLIDER_THUMB_POSITION ); - s->position = s->maxVal; - - } - else - { - delta = childCenter.x - x -HORIZONTAL_SLIDER_THUMB_WIDTH/2; - - // Calc slider position - s->position = (Int)((delta) / s->numTicks)+ s->minVal ; - - /* - s->position += s->minVal; - */ - - if( s->position > s->maxVal ) - s->position = s->maxVal; - if( s->position < s->minVal) - s->position = s->minVal; - - child->winSetPosition( childRelativePos.x, HORIZONTAL_SLIDER_THUMB_POSITION ); - } - - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_SLIDER: - { - Int newPos = (Int)mData1; - GameWindow *child = window->winGetChild(); - - // TheSuperHackers @fix No longer reject out of bounds positions to prevent - // reset of custom option.ini settings to 0. - - s->position = newPos; - - // Translate to window coords - newPos = (Int)((newPos - s->minVal) * s->numTicks); - newPos = clamp(0, newPos, (Int)((s->maxVal - s->minVal) * s->numTicks)); - - child->winSetPosition( newPos , HORIZONTAL_SLIDER_THUMB_POSITION ); - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_MIN_MAX: - { - ICoord2D size; - GameWindow *child = window->winGetChild(); - - window->winGetSize( &size.x, &size.y ); - - s->minVal = (Int)mData1; - s->maxVal = (Int)mData2; - s->numTicks = (Real)(size.x - HORIZONTAL_SLIDER_THUMB_WIDTH)/(Real)(s->maxVal - s->minVal); - s->position = s->minVal; - - child->winSetPosition( 0, HORIZONTAL_SLIDER_THUMB_POSITION ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - delete ( (SliderData *)window->winGetUserData() ); - window->winSetUserData(nullptr); - s = nullptr; - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - // If we're losing focus - if( mData1 == FALSE ) - BitClear( instData->m_state, WIN_STATE_HILITED ); - else - BitSet( instData->m_state, WIN_STATE_HILITED ); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - } - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { -// Int width = (Int)mData1; - Int height = (Int)mData2; - GameWindow *thumb = window->winGetChild(); - - if( thumb ) - thumb->winSetSize( GADGET_SIZE, height ); - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp deleted file mode 100644 index de74e32a20e..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +++ /dev/null @@ -1,448 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: RadioButton.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: RadioButton.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Radio button GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// doRadioUnselect ============================================================ -/** Do the unselect of matching group not including exception window */ -//============================================================================= -static void doRadioUnselect( GameWindow *window, Int group, Int screen, - GameWindow *except ) -{ - - // - // if this is a radio button we have something to consider, but we - // will ignore the except window - // - if( window != except && BitIsSet( window->winGetStyle(), GWS_RADIO_BUTTON ) ) - { - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - - if( radioData->group == group && radioData->screen == screen ) - { - WinInstanceData *instData = window->winGetInstanceData(); - - BitClear( instData->m_state, WIN_STATE_SELECTED ); - - } - - } - - // recursively call on all my children - GameWindow *child; - - for( child = window->winGetChild(); child; child = child->winGetNext() ) - doRadioUnselect( child, group, screen, except ); - -} - -// unselectOtherRadioOfGroup ================================================== -/** Go through the entire window system, including child windows and - * unselect any radio buttons of the specified group, but not the - * window specified */ -//============================================================================= -static void unselectOtherRadioOfGroup( Int group, Int screen, - GameWindow *except ) -{ - GameWindow *window = TheWindowManager->winGetWindowList(); - - for( window = TheWindowManager->winGetWindowList(); - window; - window = window->winGetNext() ) - doRadioUnselect( window, group, screen, except ); - -} - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - -// GadgetRadioButtonInput ===================================================== -/** Handle input for radio button */ -//============================================================================= -WindowMsgHandledType GadgetRadioButtonInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( instData->getOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - mData1 ); - //TheWindowManager->winSetFocus( window ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - { - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( instData->getOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - mData1 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - { - - TheWindowManager->winSendSystemMsg( instData->getOwner(), GGM_LEFT_DRAG, - (WindowMsgData)window, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - { - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) == FALSE ) - { - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - mData1 ); - - // - // unselect any windows in the system (including children) that - // are radio buttons with this same group and screen ID - // - if( radioData->group != 0 ) - unselectOtherRadioOfGroup(radioData->group, radioData->screen, window ); - - // this button is now selected - BitSet( instData->m_state, WIN_STATE_SELECTED ); - - } - else if( BitIsSet( instData->getState(), WIN_STATE_HILITED ) == FALSE ) - { - - // this up click was not meant for this button - return MSG_IGNORED; - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch( mData1 ) - { - - // -------------------------------------------------------------------- - case KEY_ENTER: - case KEY_SPACE: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) == FALSE ) - { - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - mData1 ); - - // - // unselect any windows in the system (including children) that - // are radio buttons with this same group and screen ID - // - if( radioData->group != 0 ) - unselectOtherRadioOfGroup(radioData->group, radioData->screen, window ); - - // this button is now selected - BitSet( instData->m_state, WIN_STATE_SELECTED ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - } - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - { - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - } - - // -------------------------------------------------------------------- - default: - { - - return MSG_IGNORED; - - } - - } - - break; - - } - - // ------------------------------------------------------------------------ - default: - { - - return MSG_IGNORED; - - } - - } - - return MSG_HANDLED; - -} - -// GadgetRadioButtonSystem ==================================================== -/** Handle system messages for radio button */ -//============================================================================= -WindowMsgHandledType GadgetRadioButtonSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GBM_SET_SELECTION: - { - - if( BitIsSet( instData->getState(), WIN_STATE_SELECTED ) == FALSE ) - { - - // do we want to send a selected message? - if( (Bool)mData1 == TRUE ) - { - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_SELECTED, - (WindowMsgData)window, - 0 ); - } - - // - // unselect any windows in the system (including children) that - // are radio buttons with this same group and screen ID - // - RadioButtonData *radioData = (RadioButtonData *)window->winGetUserData(); - if( radioData->group != 0 ) - unselectOtherRadioOfGroup(radioData->group, radioData->screen, window ); - - // this button is now selected - BitSet( instData->m_state, WIN_STATE_SELECTED ); - - } - - break; - - } - - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - - window->winSetText( *(UnicodeString*)mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - // free radio button user data - delete (RadioButtonData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - { - - if( mData1 == FALSE ) - BitClear( instData->m_state, WIN_STATE_HILITED ); - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetRadioSetText ========================================================= -/** Set the text for the control */ -//============================================================================= -void GadgetRadioSetText( GameWindow *g, UnicodeString text ) -{ - - // sanity - if( g == nullptr ) - return; - - TheWindowManager->winSendSystemMsg( g, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); - -} - -// GadgetRadioSetGroup ======================================================== -/** Set the group number for a radio button, only one radio button of - * a group can be selected at any given time */ -//============================================================================= -void GadgetRadioSetGroup( GameWindow *g, Int group, Int screen ) -{ - RadioButtonData *radioData = (RadioButtonData *)g->winGetUserData(); - - radioData->group = group; - radioData->screen = screen; - -} - - -// GadgetRadioSetText ========================================================= -/** Set the text for the control */ -//============================================================================= -void GadgetRadioSetSelection( GameWindow *g, Bool sendMsg ) -{ - - // sanity - if( g == nullptr ) - return; - - TheWindowManager->winSendSystemMsg( g, GBM_SET_SELECTION, (WindowMsgData)&sendMsg, 0 ); - -} - diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp deleted file mode 100644 index 68a010e6bac..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: StaticText.cpp /////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: StaticText.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Static text control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetStaticTextInput ====================================================== -/** Handle input for text field */ -//============================================================================= -WindowMsgHandledType GadgetStaticTextInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_CHAR: - switch (mData1) - { - - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - // Just in case some fool sets static text as a tab stop - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - case KEY_UP: - case KEY_LEFT: - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - default: - return MSG_IGNORED; - } - - break; - - default: - return MSG_IGNORED; - - } - return MSG_HANDLED; - - -} - -// GadgetStaticTextSystem ===================================================== -/** Handle system messages for text field */ -//============================================================================= -WindowMsgHandledType GadgetStaticTextSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GGM_GET_LABEL: - { - TextData *tData = (TextData *)window->winGetUserData(); - if (tData && tData->text) - *(UnicodeString*)mData2 = tData->text->getText(); - break; - - } - - // ------------------------------------------------------------------------ - case GGM_SET_LABEL: - { - if( mData1 ) - { - TextData *tData = (TextData *)window->winGetUserData(); - if (tData && tData->text) - tData->text->setText( *(UnicodeString*)mData1 ); - } - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - TextData *data = (TextData *)window->winGetUserData(); - - // free the display string - TheDisplayStringManager->freeDisplayString( data->text ); - - // free text data - delete (TextData *)window->winGetUserData(); - window->winSetUserData( nullptr ); - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; -} - -// GadgetStaticTextSetText ==================================================== -/** Set the text for a static text control */ -//============================================================================= -void GadgetStaticTextSetText( GameWindow *window, UnicodeString text ) -{ - if(!window) - return; - TheWindowManager->winSendSystemMsg( window, GGM_SET_LABEL, (WindowMsgData)&text, 0 ); - -} - -UnicodeString GadgetStaticTextGetText( GameWindow *window ) -{ - if(!window) - return UnicodeString::TheEmptyString; - TextData *tData = (TextData *)window->winGetUserData(); - if(!tData) - return UnicodeString::TheEmptyString; - return tData->text->getText(); -} - -// GadgetStaticTextSetFont ==================================================== -/** Set the font for a text control, we need to set the window - * text font, the tooltip font, and the static text display strings for - * the text data itself */ -//============================================================================= -void GadgetStaticTextSetFont( GameWindow *g, GameFont *font ) -{ - TextData *textData = (TextData *)g->winGetUserData(); - DisplayString *dString; - - // set the font for the display strings all windows have - dString = g->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = g->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); - - // static text specific - if( textData ) - { - - dString = textData->text; - if( dString ) - dString->setFont( font ); - - } - -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp deleted file mode 100644 index 8262f771162..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +++ /dev/null @@ -1,366 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: RadioButton.cpp ////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: \projects\RTS\code\gameengine\Source\GameClient\GUI\Gadget\GadgetTabControl.cpp -// -// Created: Graham Smallwood, November 2001 -// -// Desc: Tab Set GUI control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" -#include "GameClient/GadgetTabControl.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// - -// GadgetTabControlInput ===================================================== -/** Handle input for TabControl */ -//============================================================================= -WindowMsgHandledType GadgetTabControlInput( GameWindow *tabControl, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ -// WinInstanceData *instData = tabControl->winGetInstanceData(); - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - Int tabX, tabY; - tabControl->winGetScreenPosition( &tabX, &tabY ); - Int mouseX = LOLONGTOSHORT(mData1) - tabX;//mData1 is packedMouseCoords in screen space - Int mouseY = HILONGTOSHORT(mData1) - tabY; - Int tabsLeft = tabData->tabsLeftLimit; - Int tabsRight = tabData->tabsRightLimit; - Int tabsBottom = tabData->tabsBottomLimit; - Int tabsTop = tabData->tabsTopLimit; - - switch( msg ) - { - case GWM_LEFT_DOWN: - { - if( (mouseX < tabsLeft) - || (mouseX > tabsRight) - || (mouseY < tabsTop) - || (mouseY > tabsBottom) - ) - {//I eat input on myself that isn't a tab (a button click would mean I don't see the input ever.) - return MSG_HANDLED; - } - - Int distanceIn; - Int tabSize; - if( (tabData->tabEdge == TP_RIGHT_SIDE) || (tabData->tabEdge == TP_LEFT_SIDE) ) - {//scan down to find which button - distanceIn = mouseY - tabsTop; - tabSize = tabData->tabHeight; - } - else - {//scan right to find which button - distanceIn = mouseX - tabsLeft; - tabSize = tabData->tabWidth; - } - Int tabPressed = distanceIn / tabSize; - if( ! tabData->subPaneDisabled[tabPressed] && (tabPressed != tabData->activeTab) ) - GadgetTabControlShowSubPane( tabControl, tabPressed ); - } - - default: - { - return MSG_IGNORED; - } - } - - return MSG_HANDLED; - -} - -// GadgetTabControlSystem ==================================================== -/** Handle system messages for TabControl */ -//============================================================================= -WindowMsgHandledType GadgetTabControlSystem( GameWindow *tabControl, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - { - // free tab control user data - delete (TabControlData *)tabControl->winGetUserData(); - tabControl->winSetUserData( nullptr ); - - break; - - } - - case GGM_RESIZED: - {//On resize, we need to upkeep the pane sizes and tabs since they are bound to us - GadgetTabControlResizeSubPanes( tabControl ); - GadgetTabControlComputeTabRegion( tabControl ); - - break; - } - - case GBM_SELECTED: - {//Pass buttons messages up - GameWindow *parent = tabControl->winGetParent(); - - if( parent ) - return TheWindowManager->winSendSystemMsg( parent, msg, mData1, mData2 ); - - break; - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -void GadgetTabControlComputeTabRegion( GameWindow *tabControl )///< Recalc the tab positions based on userData -{ - Int winWidth, winHeight; - tabControl->winGetSize( &winWidth, &winHeight ); - - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - Int horzOffset = 0, vertOffset = 0; - if( (tabData->tabEdge == TP_TOP_SIDE) || (tabData->tabEdge == TP_BOTTOM_SIDE) ) - { - if( tabData->tabOrientation == TP_CENTER ) - { - horzOffset = winWidth - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabWidth ); - horzOffset /= 2; - } - else if( tabData->tabOrientation == TP_BOTTOMRIGHT ) - { - horzOffset = winWidth - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabWidth ); - } - else if( tabData->tabOrientation == TP_TOPLEFT ) - { - horzOffset = 0; - } - } - else - { - if( tabData->tabOrientation == TP_CENTER ) - { - vertOffset = winHeight - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabHeight ); - vertOffset /= 2; - } - else if( tabData->tabOrientation == TP_BOTTOMRIGHT ) - { - vertOffset = winHeight - ( 2 * tabData->paneBorder ) - ( tabData->tabCount * tabData->tabHeight ); - } - else if( tabData->tabOrientation == TP_TOPLEFT ) - { - vertOffset = 0; - } - } - - if( tabData->tabEdge == TP_TOP_SIDE ) - { - tabData->tabsTopLimit = tabData->paneBorder; - tabData->tabsBottomLimit = tabData->paneBorder + tabData->tabHeight; - tabData->tabsLeftLimit = tabData->paneBorder + horzOffset; - tabData->tabsRightLimit = tabData->paneBorder + horzOffset + ( tabData->tabWidth * tabData->tabCount ); - } - else if( tabData->tabEdge == TP_BOTTOM_SIDE ) - { - tabData->tabsTopLimit = winHeight - tabData->paneBorder - tabData->tabHeight; - tabData->tabsBottomLimit = winHeight - tabData->paneBorder; - tabData->tabsLeftLimit = tabData->paneBorder + horzOffset; - tabData->tabsRightLimit = tabData->paneBorder + horzOffset + ( tabData->tabWidth * tabData->tabCount ); - } - else if( tabData->tabEdge == TP_RIGHT_SIDE ) - { - tabData->tabsLeftLimit = winWidth - tabData->paneBorder - tabData->tabWidth; - tabData->tabsRightLimit = winWidth - tabData->paneBorder; - tabData->tabsTopLimit = tabData->paneBorder + vertOffset; - tabData->tabsBottomLimit = tabData->paneBorder + vertOffset + ( tabData->tabHeight * tabData->tabCount ); - } - else if( tabData->tabEdge == TP_LEFT_SIDE ) - { - tabData->tabsLeftLimit = tabData->paneBorder; - tabData->tabsRightLimit = tabData->paneBorder + tabData->tabWidth; - tabData->tabsTopLimit = tabData->paneBorder + vertOffset; - tabData->tabsBottomLimit = tabData->paneBorder + vertOffset + ( tabData->tabHeight * tabData->tabCount ); - } - -} - -void GadgetTabControlComputeSubPaneSize( GameWindow *tabControl, Int *width, Int *height, Int *x, Int *y ) -{ - Int winWidth, winHeight; - tabControl->winGetSize( &winWidth, &winHeight ); - - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - if( (tabData->tabEdge == TP_TOP_SIDE) || (tabData->tabEdge == TP_BOTTOM_SIDE) ) - *height = winHeight - (2 * tabData->paneBorder) - tabData->tabHeight; - else - *height = winHeight - (2 * tabData->paneBorder); - - if( (tabData->tabEdge == TP_LEFT_SIDE) || (tabData->tabEdge == TP_RIGHT_SIDE) ) - *width = winWidth - (2 * tabData->paneBorder) - tabData->tabWidth; - else - *width = winWidth - (2 * tabData->paneBorder); - - if( tabData->tabEdge == TP_LEFT_SIDE ) - *x = tabData->paneBorder + tabData->tabWidth; - else - *x = tabData->paneBorder; - - if( tabData->tabEdge == TP_TOP_SIDE ) - *y = tabData->paneBorder + tabData->tabHeight; - else - *y = tabData->paneBorder; -} - -void GadgetTabControlShowSubPane( GameWindow *tabControl, Int whichPane) -{ - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - - for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) - { - if( tabData->subPanes[paneIndex] != nullptr ) - tabData->subPanes[paneIndex]->winHide( true ); - } - if( tabData->subPanes[whichPane] ) - tabData->activeTab = whichPane; - else - tabData->activeTab = 0; - - tabData->activeTab = min( tabData->activeTab, tabData->tabCount - 1 ); - - tabData->subPanes[tabData->activeTab]->winHide( false ); -} - -void GadgetTabControlCreateSubPanes( GameWindow *tabControl )///< Create User Windows attached to userData as Panes -{//These two funcs are called after all the Editor set data is updated - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - Int width, height, x, y; - GadgetTabControlComputeSubPaneSize(tabControl, &width, &height, &x, &y); - - for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) - { - if( tabData->subPanes[paneIndex] == nullptr )//This one is blank - { - tabData->subPanes[paneIndex] = TheWindowManager->winCreate( tabControl, - WIN_STATUS_NONE, x, y, - width, height, - PassSelectedButtonsToParentSystem, - nullptr); - WinInstanceData *instData = tabData->subPanes[paneIndex]->winGetInstanceData(); - BitSet( instData->m_style, GWS_TAB_PANE ); - char buffer[20]; - sprintf( buffer, "Pane %d", paneIndex ); - instData->m_decoratedNameString = buffer; - //set enabled status to that of Parent - tabData->subPanes[paneIndex]->winEnable( BitIsSet(tabControl->winGetStatus(), WIN_STATUS_ENABLED) ); - } - else//this one exists, tabCount will control keeping extra panes perma-hidden - { - tabData->subPanes[paneIndex]->winSetSize( width, height ); - tabData->subPanes[paneIndex]->winSetPosition( x, y ); - } - } - - GadgetTabControlShowSubPane( tabControl, tabData->activeTab ); -} - -void GadgetTabControlResizeSubPanes( GameWindow *tabControl ) -{ - TabControlData *tabData = (TabControlData *)tabControl->winGetUserData(); - Int width, height, x, y; - GadgetTabControlComputeSubPaneSize(tabControl, &width, &height, &x, &y); - for( Int paneIndex = 0; paneIndex < NUM_TAB_PANES; paneIndex++ ) - { - if( tabData->subPanes[paneIndex] ) - { - tabData->subPanes[paneIndex]->winSetSize( width, height ); - tabData->subPanes[paneIndex]->winSetPosition( x, y ); - } - } -} - -///winGetUserData(); - GameWindow *child = tabControl->winGetChild(); - if( child ) - {//need to write down children, and they are reversed from our array - while( child->winGetNext() != nullptr ) - { - child = child->winGetNext(); - } - - while( child ) - { - tabData->subPanes[childIndex] = child; - childIndex++; - child = child->winGetPrev(); - } - } -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp deleted file mode 100644 index 68e53631086..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +++ /dev/null @@ -1,598 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: TextEntry.cpp //////////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: TextEntry.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Text entry GUI gadget -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/DisplayStringManager.h" -#include "GameClient/GameWindow.h" -#include "GameClient/Gadget.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/IMEManager.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -// PRIVATE DATA /////////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// -static Byte drawCnt = 0; -// static TbIME *ourIME = nullptr; ///< @todo need this for IME kanji support -static GameWindow *curWindow = nullptr; /**< so we can keep track of the input - window when using IME */ - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetTextEntryInput ======================================================= -/** Handle input for text entry field */ -//============================================================================= -WindowMsgHandledType GadgetTextEntryInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - if ( TheIMEManager && TheIMEManager->isAttachedTo( window) && TheIMEManager->isComposing()) - { - // ignore input while IME has focus - return MSG_HANDLED; - } - - switch( msg ) - { - // ------------------------------------------------------------------------ - case GWM_IME_CHAR: - { - WideChar ch = (WideChar) mData1; - - // -------------------------------------------------------------------- - if ( ch == VK_RETURN ) - { - // Done with this edit - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_EDIT_DONE, - (WindowMsgData)window, - 0 ); - return MSG_HANDLED; - }; - - if( ch ) - { - // Constrain keys based on rules for entry box. - if( e->numericalOnly ) - { - if( TheWindowManager->winIsDigit( ch ) == 0 ) - return MSG_HANDLED; - } - if( e->alphaNumericalOnly ) - { - if( TheWindowManager->winIsAlNum( ch ) == 0 ) - return MSG_HANDLED; - } - if ( e->aSCIIOnly ) - { - if ( TheWindowManager->winIsAscii( ch ) == 0 ) - { - return MSG_HANDLED; - } - } - - if( e->charPos < e->maxTextLen-1 ) - { - e->text->appendChar( ch ); - e->sText->appendChar( L'*' ); - e->charPos++; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - break; - } - // ------------------------------------------------------------------------ - case GWM_CHAR: - if ( BitIsSet( mData2, KEY_STATE_DOWN ) && BitIsSet( mData2, KEY_STATE_ALT | KEY_STATE_CONTROL ) ) - { - return MSG_IGNORED; // text extries shouldn't care about CTRL+* or ALT+* - } - - switch( mData1 ) - { - /* - // -------------------------------------------------------------------- - case KEY_KPENTER: - case KEY_ENTER: - // Done with this edit - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - if( e->receivedUnichar == FALSE ) - { - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_EDIT_DONE, - (WindowMsgData)window, - 0 ); - } - } - - break; - */ - // -------------------------------------------------------------------- - // Don't process these keys - case KEY_ESC: - case KEY_PGUP: - case KEY_PGDN: - case KEY_HOME: - case KEY_END: - case KEY_F1: - case KEY_F2: - case KEY_F3: - case KEY_F4: - case KEY_F5: - case KEY_F6: - case KEY_F7: - case KEY_F8: - case KEY_F9: - case KEY_F10: - case KEY_F11: - case KEY_F12: - case KEY_CAPS: - case KEY_DEL: - return MSG_IGNORED; - - // -------------------------------------------------------------------- - case KEY_DOWN: - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - GameWindow *parent; - parent = window->winGetParent(); - if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = nullptr; - if(parent) - TheWindowManager->winNextTab(parent); - else - TheWindowManager->winNextTab(window); - } - - break; - - // -------------------------------------------------------------------- - case KEY_UP: - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - GameWindow *parent; - parent = window->winGetParent(); - if(parent && !BitIsSet(parent->winGetStyle(), GWS_COMBO_BOX)) - parent = nullptr; - if(parent) - TheWindowManager->winPrevTab(parent); - else - TheWindowManager->winPrevTab(window); - } - break; - - // -------------------------------------------------------------------- - case KEY_BACKSPACE: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - // if conCharPos != 0 this will fall through to next case. - // it should be noted that conCharPos can only != 0 in Jap & Kor - if( e->conCharPos == 0 ) - { - if( e->charPos > 0 ) - { - - e->text->removeLastChar(); - e->sText->removeLastChar(); - e->charPos--; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GEM_UPDATE_TEXT, - (WindowMsgData)window, - 0 ); - } - } - } - break; - - } - - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSetFocus( window ); - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - - if (BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, 0 ); - //TheWindowManager->winSetFocus( window ); - } - - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, 0 ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, 0 ); - break; - - // ------------------------------------------------------------------------ - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetTextEntrySystem ====================================================== -/** Handle system messages for entry field */ -//============================================================================= -WindowMsgHandledType GadgetTextEntrySystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - EntryData *e = (EntryData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GEM_GET_TEXT: - *(UnicodeString*)mData2 = e->text->getText(); - break; - - // ------------------------------------------------------------------------ - case GEM_SET_TEXT: - { - - const UnicodeString* ustr = (const UnicodeString*)mData1; - e->text->setText( *ustr ); - e->charPos = ustr->getLength(); - e->constructText->setText( UnicodeString::TheEmptyString ); - e->conCharPos = 0; - - // set our secret text string to be filled with '*' the same length - e->sText->setText( UnicodeString::TheEmptyString ); - Int len = ustr->getLength(); - for( Int i = 0; i < len; i++ ) - e->sText->appendChar( L'*' ); - - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - - // delete the edit display string - TheDisplayStringManager->freeDisplayString( e->text ); - TheDisplayStringManager->freeDisplayString( e->sText ); - TheDisplayStringManager->freeDisplayString( e->constructText ); - - // delete construct list - if( e->constructList ) - TheWindowManager->winDestroy( e->constructList ); - - // free all edit data - delete( (EntryData *)window->winGetUserData() ); - window->winSetUserData(nullptr); - e = nullptr; - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - if( mData1 == FALSE ) - { - // If we're losing focus - /// @todo need to enable this for IME support - // ourIME->UnActivate(); - curWindow = nullptr; - BitClear( instData->m_state, WIN_STATE_SELECTED ); - BitClear( instData->m_state, WIN_STATE_HILITED ); - - if( e->constructList ) - e->constructList->winHide( TRUE ); - e->constructText->setText( UnicodeString::TheEmptyString ); - e->conCharPos = 0; - if(TheIMEManager && TheIMEManager->isAttachedTo(window)) - TheIMEManager->attach(nullptr); - //TheIMEManager->detach(); - } - else - { - curWindow = window; - /// @todo need to enable this for IME support - if (TheIMEManager) - TheIMEManager->attach( window ); - // ourIME->Activate( (void *)ApplicationHWnd ); - BitSet( instData->m_state, WIN_STATE_SELECTED ); - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -/** @todo we might want to do something like this if we use IME for language - * support in this product */ -/* -// used to create interface to IME -BoolCode InitializeEntryGadget() -{ - ourIME = NEW TbIME; - - ourIME->Composition_SetMaxLength( 11 ); - - return TRUE; -} - -// used to destroy interface to IME -BoolCode ShutdownEntryGadget() -{ - delete ourIME; - ourIME = nullptr; - - return TRUE; -} - -void InformEntry( WideChar c ) -{ - Int i, listCount = 0; - EntryData *e; - - if( ourIME == nullptr || curWindow == nullptr ) - return; - - e = (EntryData *)curWindow->winGetUserData(); - - if( ( (OurLanguage == LANGUAGE_ID_JAPANESE) || - (OurLanguage == LANGUAGE_ID_KOREAN) ) && - ( (e->aSCIIOnly == FALSE ) && - (e->alphaNumericalOnly == FALSE ) && - (e->numericalOnly == FALSE ) ) ) - { - e->receivedUnichar = TRUE; - - // we must eat the following keys - switch( c ) - { - case L'\a': - case L'\b': - case L'\f': - case L'\t': - case L'\v': - return; - - // we must completely ignore the return key - case L'\r': - case L'\n': - e->receivedUnichar = FALSE; - return; - } - - if( e->charPos < e->maxTextLen-1 ) - { - e->text[ e->charPos++ ] = c; - e->text[ e->charPos ] = 0; - } - - // always update the construction buffer after a key has come through here. - TheWindowManager->winStrcpy( e->constructText, (WideChar *)ourIME->Composition_Get() ); - e->conCharPos = NoxStrlen( e->constructText ); - - // we might need to update our listbox - listCount = ourIME->CandidateList_GetSize(); - - if( TRUE ) //listCount == 0) - { - // if no entries just hide it and leave - if( e->constructList ) - e->constructList->winHide( TRUE ); - } - else - { - Int maxWidth = 0; - ListboxData list = nullptr; - ICoord2D constructSize, sliderSize; - - WinHide( e->constructList, FALSE ); - list = (ListBoxData)e->constructList->winGetUserData(); - - e->constructList->winGetSize( &constructSize.x, &constructSize.y ); - list->slider->winGetSize( &sliderSize.x, &sliderSize.y ); - - TheWindowManager->winSendSystemMsg( e->constructList, GLM_DEL_ALL, 0, 0 ); - - for( i=0; iCandidateList_GetItem( i ); - - TheWindowManager->winGetTextSize( e->constructList->instData.font, - text, nullptr, &tempWidth, 0 ); - - if( tempWidth > maxWidth ) - maxWidth = tempWidth; - - UnicodeString tmp(text); - TheWindowManager->winSendSystemMsg( e->constructList, GLM_ADD_ENTRY, - (WindowMsgData)&tmp, -1 ); - } - - e->constructList->winSetSize( maxWidth + sliderSize.y, - constructSize.y ); - } - } -} -*/ - -// GadgetTextEntrySetFont ===================================================== -/** Set the font for a text entry control, we need to set the window - * text font, the tooltip font, and the edit text display strings for - * the text data itself and the secret text */ -//============================================================================= -void GadgetTextEntrySetFont( GameWindow *g, GameFont *font ) -{ - EntryData *entryData = (EntryData *)g->winGetUserData(); - DisplayString *dString; - - // set the font for the display strings all windows have - dString = g->winGetInstanceData()->getTextDisplayString(); - if( dString ) - dString->setFont( font ); - dString = g->winGetInstanceData()->getTooltipDisplayString(); - if( dString ) - dString->setFont( font ); - - // text entry specific - if( entryData ) - { - - dString = entryData->text; - if( dString ) - dString->setFont( font ); - dString = entryData->sText; - if( dString ) - dString->setFont( font ); - - } - -} - -// GadgetTextEntryGetText ======================================================= -/** Get the text for a Text entry */ -//============================================================================= -UnicodeString GadgetTextEntryGetText( GameWindow *textentry ) -{ - - // sanity - if( textentry == nullptr ) - return UnicodeString::TheEmptyString; - - // verify that this is a list box - if( BitIsSet( textentry->winGetStyle(), GWS_ENTRY_FIELD ) == FALSE ) - return UnicodeString::TheEmptyString; - - UnicodeString result; - TheWindowManager->winSendSystemMsg( textentry, GEM_GET_TEXT, 0, (WindowMsgData)&result ); - return result; - -} - -//============================================================================= -void GadgetTextEntrySetMaxLen( GameWindow *g, Short length ) -{ - if( g == nullptr ) - return; - - EntryData *data = static_cast( g->winGetUserData() ); - - if( length > ENTRY_TEXT_LEN ) - length = ENTRY_TEXT_LEN; - - data->maxTextLen = length; -} diff --git a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp b/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp deleted file mode 100644 index 0d622ad8900..00000000000 --- a/Generals/Code/GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +++ /dev/null @@ -1,470 +0,0 @@ -/* -** Command & Conquer Generals(tm) -** Copyright 2025 Electronic Arts Inc. -** -** This program is free software: you can redistribute it and/or modify -** it under the terms of the GNU General Public License as published by -** the Free Software Foundation, either version 3 of the License, or -** (at your option) any later version. -** -** This program is distributed in the hope that it will be useful, -** but WITHOUT ANY WARRANTY; without even the implied warranty of -** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -** GNU General Public License for more details. -** -** You should have received a copy of the GNU General Public License -** along with this program. If not, see . -*/ - -//////////////////////////////////////////////////////////////////////////////// -// // -// (c) 2001-2003 Electronic Arts Inc. // -// // -//////////////////////////////////////////////////////////////////////////////// - -// FILE: VerticalSlider.cpp /////////////////////////////////////////////////// -//----------------------------------------------------------------------------- -// -// Westwood Studios Pacific. -// -// Confidential Information -// Copyright (C) 2001 - All Rights Reserved -// -//----------------------------------------------------------------------------- -// -// Project: RTS3 -// -// File name: VerticalSlider.cpp -// -// Created: Colin Day, June 2001 -// -// Desc: Vertical slider gui control -// -//----------------------------------------------------------------------------- -/////////////////////////////////////////////////////////////////////////////// - -// SYSTEM INCLUDES //////////////////////////////////////////////////////////// -#include "PreRTS.h" // This must go first in EVERY cpp file in the GameEngine - -// USER INCLUDES ////////////////////////////////////////////////////////////// -#include "Common/Language.h" -#include "GameClient/GameWindowManager.h" -#include "GameClient/Gadget.h" - -// DEFINES //////////////////////////////////////////////////////////////////// - -// PRIVATE TYPES ////////////////////////////////////////////////////////////// - -// PRIVATE DATA /////////////////////////////////////////////////////////////// - -// PUBLIC DATA //////////////////////////////////////////////////////////////// - -// PRIVATE PROTOTYPES ///////////////////////////////////////////////////////// - -// PRIVATE FUNCTIONS ////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -// PUBLIC FUNCTIONS /////////////////////////////////////////////////////////// -/////////////////////////////////////////////////////////////////////////////// - -// GadgetVerticalSliderInput ================================================== -/** Handle input for vertical slider */ -//============================================================================= -WindowMsgHandledType GadgetVerticalSliderInput( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GWM_MOUSE_ENTERING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitSet( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_ENTERING, - (WindowMsgData)window, - 0 ); - //TheWindowManager->winSetFocus( window ); - - } - break; - - // ------------------------------------------------------------------------ - case GWM_MOUSE_LEAVING: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - { - - BitClear( instData->m_state, WIN_STATE_HILITED ); - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GBM_MOUSE_LEAVING, - (WindowMsgData)window, - 0 ); - } - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DRAG: - - if( BitIsSet( instData->getStyle(), GWS_MOUSE_TRACK ) ) - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_LEFT_DRAG, - (WindowMsgData)window, - mData1 ); - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_DOWN: - break; - - // ------------------------------------------------------------------------ - case GWM_LEFT_UP: - { - Int x, y; -// Int mousex = mData1 & 0xFFFF; - Int mousey = mData1 >> 16; - ICoord2D size, childSize, childCenter; - GameWindow *child = window->winGetChild(); - Int pageClickSize, clickPos; - - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetPosition( &childCenter.x, &childCenter.y ); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // when you click on the slider, but not the button, we will jump - // the slider position up/down by this much - // - pageClickSize = size.y / 5; - - clickPos = mousey - y; - if( clickPos >= childCenter.y ) - { - - clickPos = childCenter.y + pageClickSize; - if( clickPos > mousey - y ) - clickPos = mousey - y; - - } - else - { - - clickPos = childCenter.y - pageClickSize; - if( clickPos < mousey - y ) - clickPos = mousey - y; - - } - - // keep pos valid on window - if( clickPos > y + size.y - childSize.y / 2 ) - clickPos = y + size.y - childSize.y / 2; - if( clickPos < childSize.y / 2 ) - clickPos = childSize.y / 2; - - child->winSetPosition( 0, clickPos - childSize.y / 2 ); - TheWindowManager->winSendSystemMsg( window, GGM_LEFT_DRAG, 0, mData1 ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CHAR: - { - - switch (mData1) - { - - // -------------------------------------------------------------------- - case KEY_UP: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position < s->maxVal - 1) - { - GameWindow *child = window->winGetChild(); - - s->position += 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - // Translate to window coords - child->winSetPosition( 0, (Int)((s->maxVal - s->position) * s->numTicks) ); - - } - - } - - break; - - // -------------------------------------------------------------------- - case KEY_DOWN: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - { - - if( s->position > s->minVal + 1 ) - { - GameWindow *child = window->winGetChild(); - - s->position -= 2; - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - // Translate to window coords - child->winSetPosition( 0, (Int)((s->maxVal - s->position) * s->numTicks) ); - } - } - break; - - // -------------------------------------------------------------------- - case KEY_RIGHT: - case KEY_TAB: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winNextTab(); - break; - - // -------------------------------------------------------------------- - case KEY_LEFT: - - if( BitIsSet( mData2, KEY_STATE_DOWN ) ) - window->winPrevTab(); - break; - - default: - return MSG_IGNORED; - - } - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - -// GadgetVerticalSliderSystem ================================================= -/** Handle system messages for vertical slider */ -//============================================================================= -WindowMsgHandledType GadgetVerticalSliderSystem( GameWindow *window, UnsignedInt msg, - WindowMsgData mData1, WindowMsgData mData2 ) -{ - SliderData *s = (SliderData *)window->winGetUserData(); - WinInstanceData *instData = window->winGetInstanceData(); - - switch( msg ) - { - - // ------------------------------------------------------------------------ - case GBM_SELECTED: - { - // tell owner I've finished moving - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_DONE, - (WindowMsgData)window, - s->position ); - break; - - } - - // ------------------------------------------------------------------------ - case GGM_LEFT_DRAG: - { -// Int mousex = mData2 & 0xFFFF; - Int mousey = mData2 >> 16; - Int x, y, delta; - ICoord2D size, childSize, childCenter; - GameWindow *child = window->winGetChild(); - - window->winGetScreenPosition( &x, &y ); - window->winGetSize( &size.x, &size.y ); - child->winGetSize( &childSize.x, &childSize.y ); - child->winGetScreenPosition( &childCenter.x, &childCenter.y ); - childCenter.x += childSize.x / 2; - childCenter.y += childSize.y / 2; - - // - // ignore drag attempts when the mouse is below or above the slider totally - // and put the dragging thumb back at the slider pos - // - if( mousey > y + size.y ) - { - - //s->position = s->minVal; - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->minVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - else if( mousey < y ) - { - - //s->position = s->maxVal; - TheWindowManager->winSendSystemMsg( window, GSM_SET_SLIDER, - s->maxVal, 0 ); - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - - if( childCenter.y <= y + childSize.y / 2 ) - { - child->winSetPosition( 0, 0 ); - s->position = s->maxVal; - } - else if( childCenter.y >= y + size.y - childSize.y / 2 ) - { - child->winSetPosition( 0, size.y - childSize.y ); - s->position = s->minVal; - } - else - { - delta = childCenter.y - y - childSize.y/2; - - // Calc slider position - s->position = (Int)(delta / s->numTicks) ; - - /* - s->position += s->minVal; - */ - - if( s->position > s->maxVal ) - s->position = s->maxVal; - - // Invert slider position so that maxval is at the top - s->position = s->maxVal - s->position; - - } - - // tell owner i moved - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GSM_SLIDER_TRACK, - (WindowMsgData)window, - s->position ); - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_SLIDER: - { - Int newPos = (Int)mData1; - GameWindow *child = window->winGetChild(); - - // TheSuperHackers @fix No longer reject out of bounds positions to prevent - // reset of custom option.ini settings to 0. - - s->position = newPos; - - // Translate to window coords - newPos = (Int)((s->maxVal - newPos) * s->numTicks); - newPos = clamp(0, newPos, (Int)((s->maxVal - s->minVal) * s->numTicks)); - - child->winSetPosition( 0, newPos ); - - break; - - } - - // ------------------------------------------------------------------------ - case GSM_SET_MIN_MAX: - { - Int newPos; - ICoord2D size; - GameWindow *child = window->winGetChild(); - - window->winGetSize( &size.x, &size.y ); - - s->minVal = (Int)mData1; - s->maxVal = (Int)mData2; - s->numTicks = (Real)( size.y-GADGET_SIZE)/(Real)(s->maxVal - s->minVal); - s->position = s->minVal; - - // Translate to window coords - newPos = (Int)((s->maxVal - s->minVal) * s->numTicks); - - child->winSetPosition( 0, newPos ); - break; - - } - - // ------------------------------------------------------------------------ - case GWM_CREATE: - break; - - // ------------------------------------------------------------------------ - case GWM_DESTROY: - delete( (SliderData *)window->winGetUserData() ); - window->winSetUserData(nullptr); - s = nullptr; - break; - - // ------------------------------------------------------------------------ - case GWM_INPUT_FOCUS: - - // If we're losing focus - if( mData1 == FALSE ) - { - BitClear( instData->m_state, WIN_STATE_HILITED ); - } else { - BitSet( instData->m_state, WIN_STATE_HILITED ); - } - - TheWindowManager->winSendSystemMsg( window->winGetOwner(), - GGM_FOCUS_CHANGE, - mData1, - window->winGetWindowId() ); - - *(Bool*)mData2 = TRUE; - break; - - // ------------------------------------------------------------------------ - case GGM_RESIZED: - { - Int width = (Int)mData1; -// Int height = (Int)mData2; - GameWindow *thumb = window->winGetChild(); - - if( thumb ) - thumb->winSetSize( width, GADGET_SIZE ); - - break; - - } - - default: - return MSG_IGNORED; - - } - - return MSG_HANDLED; - -} - diff --git a/GeneralsMD/Code/GameEngine/CMakeLists.txt b/GeneralsMD/Code/GameEngine/CMakeLists.txt index 6d123aeb7a5..ea06a773ca0 100644 --- a/GeneralsMD/Code/GameEngine/CMakeLists.txt +++ b/GeneralsMD/Code/GameEngine/CMakeLists.txt @@ -166,11 +166,11 @@ set(GAMEENGINE_SRC # Include/GameClient/GadgetListBox.h # Include/GameClient/GadgetProgressBar.h # Include/GameClient/GadgetPushButton.h - Include/GameClient/GadgetRadioButton.h - Include/GameClient/GadgetSlider.h - Include/GameClient/GadgetStaticText.h - Include/GameClient/GadgetTabControl.h - Include/GameClient/GadgetTextEntry.h +# Include/GameClient/GadgetRadioButton.h +# Include/GameClient/GadgetSlider.h +# Include/GameClient/GadgetStaticText.h +# Include/GameClient/GadgetTabControl.h +# Include/GameClient/GadgetTextEntry.h Include/GameClient/GameClient.h # Include/GameClient/GameFont.h Include/GameClient/GameInfoWindow.h @@ -712,15 +712,15 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/EstablishConnectionsMenu/EstablishConnectionsMenu.cpp # Source/GameClient/GUI/Gadget/GadgetCheckBox.cpp # Source/GameClient/GUI/Gadget/GadgetComboBox.cpp - Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp # Source/GameClient/GUI/Gadget/GadgetListBox.cpp # Source/GameClient/GUI/Gadget/GadgetProgressBar.cpp Source/GameClient/GUI/Gadget/GadgetPushButton.cpp - Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp - Source/GameClient/GUI/Gadget/GadgetStaticText.cpp - Source/GameClient/GUI/Gadget/GadgetTabControl.cpp - Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp - Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp +# Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp +# Source/GameClient/GUI/Gadget/GadgetStaticText.cpp +# Source/GameClient/GUI/Gadget/GadgetTabControl.cpp +# Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp +# Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp # Source/GameClient/GUI/GameFont.cpp # Source/GameClient/GUI/GameWindow.cpp # Source/GameClient/GUI/GameWindowGlobal.cpp @@ -734,8 +734,8 @@ set(GAMEENGINE_SRC # Source/GameClient/GUI/GUICallbacks/ExtendedMessageBox.cpp Source/GameClient/GUI/GUICallbacks/GeneralsExpPoints.cpp Source/GameClient/GUI/GUICallbacks/IMECandidate.cpp - Source/GameClient/GUI/GUICallbacks/InGameChat.cpp - Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp +# Source/GameClient/GUI/GUICallbacks/InGameChat.cpp +# Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp Source/GameClient/GUI/GUICallbacks/Menus/ChallengeMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/CreditsMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/DifficultySelect.cpp @@ -751,9 +751,9 @@ set(GAMEENGINE_SRC Source/GameClient/GUI/GUICallbacks/Menus/MapSelectMenu.cpp Source/GameClient/GUI/GUICallbacks/Menus/NetworkDirectConnect.cpp Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupHostGame.cpp - Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp +# Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupLadderSelect.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupPlayerInfo.cpp Source/GameClient/GUI/GUICallbacks/Menus/PopupReplay.cpp diff --git a/scripts/cpp/unify_move_files.py b/scripts/cpp/unify_move_files.py index f7aa3c15ad4..1a5bdffb3db 100644 --- a/scripts/cpp/unify_move_files.py +++ b/scripts/cpp/unify_move_files.py @@ -521,6 +521,22 @@ def main(): #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetProgressBar.h", Game.CORE, "GameEngine/Include/GameClient/GadgetProgressBar.h") #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetPushButton.h", Game.CORE, "GameEngine/Include/GameClient/GadgetPushButton.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetRadioButton.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetRadioButton.h", Game.CORE, "GameEngine/Include/GameClient/GadgetRadioButton.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetStaticText.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetStaticText.h", Game.CORE, "GameEngine/Include/GameClient/GadgetStaticText.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetTabControl.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetTabControl.h", Game.CORE, "GameEngine/Include/GameClient/GadgetTabControl.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetTextEntry.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetTextEntry.h", Game.CORE, "GameEngine/Include/GameClient/GadgetTextEntry.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetHorizontalSlider.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/Gadget/GadgetVerticalSlider.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Include/GameClient/GadgetSlider.h", Game.CORE, "GameEngine/Include/GameClient/GadgetSlider.h") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GUICallbacks/InGameChat.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GUICallbacks/InGamePopupMessage.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupCommunicator.cpp") + #unify_file(Game.ZEROHOUR, "GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp", Game.CORE, "GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupJoinGame.cpp") + return