home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 10 / ioProg_10.iso / soft / optima / hpp.z / WSIZE.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-03-22  |  3.8 KB  |  132 lines

  1. /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2.    %     Copyright (C) 1994, by WATCOM International Inc.  All rights    %
  3.    %     reserved.  No part of this software may be reproduced or        %
  4.    %     used in any form or by any means - graphic, electronic or       %
  5.    %     mechanical, including photocopying, recording, taping or        %
  6.    %     information storage and retrieval systems - except with the     %
  7.    %     written permission of WATCOM International Inc.                 %
  8.    %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  9. */
  10.  
  11. /*************************************************************************
  12.  *
  13.  * WSize --
  14.  *
  15.  *************************************************************************/
  16.  
  17. #ifndef _WSIZE_HPP_INCLUDED
  18. #define _WSIZE_HPP_INCLUDED
  19.  
  20. #ifndef _WNO_PRAGMA_PUSH
  21. #pragma pack(push,4);
  22. #pragma enum int;
  23. #endif
  24.  
  25. #ifndef _WDEF_HPP_INCLUDED
  26. #  include "wdef.hpp"
  27. #endif
  28.  
  29. #ifndef _WINDEF_
  30. typedef struct tagSIZE {
  31.     WLong cx;
  32.     WLong cy;
  33. } SIZE, *PSIZE, *LPSIZE;
  34.  
  35. typedef SIZE SIZEL;
  36. typedef SIZE *PSIZEL, *LPSIZEL;
  37. #endif
  38.  
  39. class WCMCLASS WSize {
  40.  
  41.         /**********************************************************
  42.          * Data members
  43.          *********************************************************/
  44.  
  45.     public:
  46.     
  47.         WLong w;
  48.         WLong h;
  49.  
  50.     public:
  51.  
  52.         /**********************************************************
  53.          * Constructors and Destructors
  54.          *********************************************************/
  55.  
  56.         WSize() { w = h = 0; }
  57.         WSize( WLong nw, WLong nh ) { w = nw; h = nh; }
  58.         WSize( const WSize & o ) { w = o.w; h = o.h; }
  59.         WSize( const SIZE & o ); // WCMINLINE
  60.  
  61.         // Note: no destructor is defined and none will be generated
  62.         // because the class has simple types as data and no virtual
  63.         // functions and does not inherit from anyone.
  64.  
  65.         /**********************************************************
  66.          * Properties
  67.          *********************************************************/
  68.  
  69.         // SIZE 
  70.  
  71.         SIZE  GetSIZE() const; // WCMINLINE
  72.         void  SetSIZE( const SIZE & s ); // WCMINLINE
  73.  
  74.         /**********************************************************
  75.          * Methods
  76.          *********************************************************/
  77.  
  78.         // Create
  79.  
  80.         void Create() { w = h = 0; }
  81.         void Create( WLong nw, WLong nh ) { w = nw; h = nh; }
  82.         void Create( const WSize & o ) { w = o.w; h = o.h; }
  83.         void Create( const SIZE & o ); // WCMINLINE
  84.  
  85.         // Offset
  86.  
  87.         void Offset( WLong nw, WLong nh ); // WCMINLINE
  88.         void Offset( const WSize & sz ); // WCMINLINE
  89.  
  90.         /**********************************************************
  91.          * Operators
  92.          *********************************************************/
  93.  
  94.         // == operator
  95.  
  96.         int operator==( const WSize & o ) const; // WCMINLINE
  97.  
  98.         // != operator
  99.  
  100.         int operator!=( const WSize & o ) const; // WCMINLINE
  101.     
  102.         // = operator
  103.  
  104.         WSize & operator=( const WSize & o )
  105.             { w = o.w; h = o.h; return *this; }
  106.         WSize & operator=( const SIZE & o ); // WCMINLINE
  107.  
  108.         // +, - operator
  109.  
  110.         WSize operator+( const WSize & o ); // WCMINLINE
  111.         WSize operator-( const WSize & o ); // WCMINLINE
  112.  
  113.         // +=, -= operator
  114.  
  115.         WSize & operator+=( const WSize & o ); // WCMINLINE
  116.         WSize & operator-=( const WSize & o ); // WCMINLINE
  117. };
  118.  
  119. #ifdef WCM_ENABLE_INLINES
  120.   #ifndef WCM_NO_WSIZE_INLINES
  121.     #define WCMINLINE inline
  122.     #include "wsize.inl"
  123.   #endif
  124. #endif
  125.  
  126. #ifndef _WNO_PRAGMA_PUSH
  127. #pragma enum pop;
  128. #pragma pack(pop);
  129. #endif
  130.  
  131. #endif // _WSIZE_HPP_INCLUDED
  132.