GAUGE.H (4396B)
1 // 2 // Copyright 2020 Electronic Arts Inc. 3 // 4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 5 // software: you can redistribute it and/or modify it under the terms of 6 // the GNU General Public License as published by the Free Software Foundation, 7 // either version 3 of the License, or (at your option) any later version. 8 9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 10 // in the hope that it will be useful, but with permitted additional restrictions 11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 12 // distributed with this program. You should have received a copy of the 13 // GNU General Public License along with permitted additional restrictions 14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection 15 16 /* $Header: F:\projects\c&c\vcs\code\gauge.h_v 2.17 16 Oct 1995 16:45:24 JOE_BOSTIC $ */ 17 /*********************************************************************************************** 18 *** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S *** 19 *********************************************************************************************** 20 * * 21 * Project Name : Command & Conquer * 22 * * 23 * File Name : GAUGE.H * 24 * * 25 * Programmer : Joe L. Bostic, Maria del Mar McCready Legg * 26 * * 27 * Start Date : 01/15/95 * 28 * * 29 * Last Update : January 15, 1995 [JLB] * 30 * * 31 *---------------------------------------------------------------------------------------------* 32 * Functions: * 33 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ 34 35 #ifndef GAUGE_H 36 #define GAUGE_H 37 38 class GaugeClass : public ControlClass 39 { 40 public: 41 42 GaugeClass(unsigned id, int x, int y, int w, int h); 43 // static GaugeClass * Create_One_Of(unsigned id, int x, int y, int w, int h); 44 45 virtual int Draw_Me(int forced=false); 46 virtual int Set_Maximum(int value); 47 virtual int Set_Value(int value); 48 virtual int Get_Value(void) const {return (CurValue);}; 49 virtual void Use_Thumb(int value) { HasThumb = value ? true : false; }; 50 51 virtual int Thumb_Pixels(void) { return (8);} 52 53 /* 54 ** If this gauge has a color to the left of the current setting, then this 55 ** flag will be true. 56 */ 57 unsigned IsColorized:1; 58 59 protected: 60 61 /* 62 ** If a thumb is desired, set to true. 63 */ 64 unsigned HasThumb:1; 65 66 /* 67 ** Is this a horizontal slider? 68 */ 69 unsigned IsHorizontal:1; 70 71 int MaxValue; // maximum value (in application units) 72 int CurValue; // index of 1st displayed string in box 73 // (in application units) 74 75 /* 76 ** This value records the difference between where the user clicked 77 ** and the edge of the thumb, so that the thumb follows the mouse 78 ** with the proper offset. 79 */ 80 int ClickDiff; 81 82 protected: 83 virtual void Draw_Thumb(void); 84 virtual int Action(unsigned flags, KeyNumType &key); 85 virtual int Pixel_To_Value(int pixel); 86 virtual int Value_To_Pixel(int value); 87 }; 88 89 90 91 class TriColorGaugeClass : public GaugeClass 92 { 93 public: 94 TriColorGaugeClass(unsigned id, int x, int y, int w, int h); 95 // static TriColorGaugeClass * Create_One_Of(unsigned id, int x, int y, int w, int h); 96 virtual int Draw_Me(int forced); 97 virtual int Set_Red_Limit(int value); 98 virtual int Set_Yellow_Limit(int value); 99 100 protected: 101 int RedLimit; // maximum value for red 102 int YellowLimit; // maximum value for yellow 103 }; 104 105 106 107 108 #endif