home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / NETSCAP.50 / WIN1998.ZIP / ns / cmd / macfe / gui / CSizeBox.cp < prev    next >
Encoding:
Text File  |  1998-04-08  |  3.6 KB  |  116 lines

  1. /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18.  
  19.  
  20. /*====================================================================================*/
  21.     #pragma mark INCLUDE FILES
  22. /*====================================================================================*/
  23.  
  24. #include "CSizeBox.h"
  25.  
  26.  
  27. /*====================================================================================*/
  28.     #pragma mark TYPEDEFS
  29. /*====================================================================================*/
  30.  
  31.  
  32. /*====================================================================================*/
  33.     #pragma mark CONSTANTS
  34. /*====================================================================================*/
  35.  
  36.  
  37. /*====================================================================================*/
  38.     #pragma mark INTERNAL CLASS DECLARATIONS
  39. /*====================================================================================*/
  40.  
  41.  
  42. /*====================================================================================*/
  43.     #pragma mark INTERNAL FUNCTION PROTOTYPES
  44. /*====================================================================================*/
  45.  
  46.  
  47. /*====================================================================================*/
  48.     #pragma mark CLASS IMPLEMENTATIONS
  49. /*====================================================================================*/
  50.  
  51. #pragma mark -
  52.  
  53. /*======================================================================================
  54.     Broadcast a message.
  55. ======================================================================================*/
  56.  
  57. void CSizeBox::ClickSelf(const SMouseDownEvent &inMouseDown) {
  58.  
  59.     // Find the window object
  60.     LWindow *theWindow = LWindow::FetchWindowObject(GetMacPort());
  61.     
  62.     // Click in its grow
  63.     theWindow->ClickInGrow(inMouseDown.macEvent);
  64. }
  65.  
  66.  
  67. /*======================================================================================
  68.     Redraw the control.
  69. ======================================================================================*/
  70.  
  71. void CSizeBox::ActivateSelf(void) {
  72.  
  73.     inherited::ActivateSelf();
  74.     
  75.     if ( FocusExposed() ) {
  76.         DrawSelf();
  77.     }
  78. }
  79.  
  80.  
  81. /*======================================================================================
  82.     Redraw the control.
  83. ======================================================================================*/
  84.  
  85. void CSizeBox::DeactivateSelf(void) {
  86.  
  87.     inherited::ActivateSelf();
  88.     
  89.     if ( FocusExposed() ) {
  90.         DrawSelf();
  91.     }
  92. }
  93.  
  94.  
  95. /*======================================================================================
  96.     Draw the control.
  97. ======================================================================================*/
  98.  
  99. void CSizeBox::DrawSelf(void) {
  100.  
  101.     Rect frame;
  102.     if ( !CalcLocalFrameRect(frame) ) return;
  103.     
  104.     ApplyForeAndBackColors();
  105.  
  106.     if ( IsActive() ) {
  107.         inherited::DrawSelf();
  108.     } else {
  109.         ::InsetRect(&frame, 1, 1);
  110.         ::EraseRect(&frame);
  111.         ::InsetRect(&frame, -1, -1);
  112.         ::FrameRect(&frame);
  113.     }
  114. }
  115.  
  116.