home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-04 | 3.8 KB | 115 lines | [TEXT/MPS ] |
- //----------------------------------------------------------------------------------------
- // UThermView.cp
- // Copyright ©1994 Access Informatics.
- //
- /*
- History:
- 2/8/93 PBM Started history
-
- */
- //----------------------------------------------------------------------------------------
-
- #ifndef __UTHERMVIEW__
- #include "UThermView.h"
- #endif
-
- #ifndef __UMACAPPUTILITIES__
- #include "UMacAppUtilities.h"
- #endif
-
- #ifndef __UMENUMGR__
- #include "UMenuMgr.h"
- #endif
-
- #ifndef __FONTS__
- #include "Fonts.h"
- #endif
-
- //----------------------------------------------------------------------------------------
- // Constants:
-
-
- //========================================================================================
- // Global Initialization Procedure
- //========================================================================================
- #pragma segment MAOpen
- MA_DEFINE_CLASS_M1(TThermView, TView);
-
- //----------------------------------------------------------------------------------------
- // InitUViewTherm:
- //----------------------------------------------------------------------------------------
- #pragma segment DlgInit
-
- void InitUThermView()
- {
- // So the linker doesn't dead strip class info
- macroDontDeadStrip(TThermView);
- } // InitUViewTherm
-
-
- //========================================================================================
- // CLASS TThermView
- //========================================================================================
-
-
- //----------------------------------------------------------------------------------------
- // TThermView::Initialize:
- //----------------------------------------------------------------------------------------
- #pragma segment AOpen
-
- TThermView::TThermView() // Override
- {
- fMaximumValue = 100; // just a nominal value
- fCurrentValue = 0;
- }
-
-
- //----------------------------------------------------------------------------------------
- // Draw:
- //----------------------------------------------------------------------------------------
- // There are two rectangles, the bar itself and the remainder area
- // they are drawn in the grey and light blue that the finder uses.
- #pragma segment ARes
-
- void TThermView::Draw(const VRect& /* area */) // Override
- {
- CRect aQDRect; // the view
- CRect barQDRect; // the bar
- CRect remainderQDRect; // the remainder of the bar area
-
- this->GetQDExtent(aQDRect);
- barQDRect = remainderQDRect = aQDRect;
-
- if(fMaximumValue <= 0)
- return;
-
- PenNormal();
-
- long width = aQDRect.right - aQDRect.left; // full width of bar
-
- width = (width * fCurrentValue) / fMaximumValue;
- barQDRect.right = barQDRect.left + width;
- remainderQDRect.left = remainderQDRect.right - width;
-
- SetIfColor(fBackColor); // gRGB
- PaintRect(aQDRect); // paint the backround
-
- SetIfColor(fBarColor); // draw the bar
- PaintRect(barQDRect);
-
- SetIfColor(gRGBBlack);
- FrameRect(aQDRect);
- } // TThermView::Draw
-
- void TThermView::SetMaximum(long value)
- {
- fMaximumValue = value;
- }
-
- void TThermView::SetCurrent(long value)
- {
- fCurrentValue = value;
- this->DrawContents();
- }
-
- Boolean TThermView::HasColour