home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2240.zip / wxWindows-2.4.0 / include / wx / statline.h < prev    next >
C/C++ Source or Header  |  2001-06-26  |  3KB  |  99 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        wx/statline.h
  3. // Purpose:     wxStaticLine class interface
  4. // Author:      Vadim Zeitlin
  5. // Created:     28.06.99
  6. // Version:     $Id: statline.h,v 1.5 2001/06/26 20:59:07 VZ Exp $
  7. // Copyright:   (c) 1999 Vadim Zeitlin
  8. // Licence:     wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. #ifndef _WX_STATLINE_H_BASE_
  12. #define _WX_STATLINE_H_BASE_
  13.  
  14. // ----------------------------------------------------------------------------
  15. // headers
  16. // ----------------------------------------------------------------------------
  17.  
  18. // this defines wxUSE_STATLINE
  19. #include "wx/defs.h"
  20.  
  21. #if wxUSE_STATLINE
  22.  
  23. // the base class declaration
  24. #include "wx/control.h"
  25.  
  26. // ----------------------------------------------------------------------------
  27. // global variables
  28. // ----------------------------------------------------------------------------
  29.  
  30. // the default name for objects of class wxStaticLine
  31. WXDLLEXPORT_DATA(extern const wxChar*) wxStaticTextNameStr;
  32.  
  33. // ----------------------------------------------------------------------------
  34. // wxStaticLine - a line in a dialog
  35. // ----------------------------------------------------------------------------
  36.  
  37. class WXDLLEXPORT wxStaticLineBase : public wxControl
  38. {
  39. public:
  40.     // constructor
  41.     wxStaticLineBase() { }
  42.  
  43.     // is the line vertical?
  44.     bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; }
  45.  
  46.     // get the default size for the "lesser" dimension of the static line
  47.     static int GetDefaultSize() { return 2; }
  48.  
  49.     // overriden base class virtuals
  50.     virtual bool AcceptsFocus() const { return FALSE; }
  51.  
  52. protected:
  53.     // set the right size for the right dimension
  54.     wxSize AdjustSize(const wxSize& size) const
  55.     {
  56.         wxSize sizeReal(size);
  57.         if ( IsVertical() )
  58.         {
  59.             if ( size.x == -1 )
  60.                 sizeReal.x = GetDefaultSize();
  61.         }
  62.         else
  63.         {
  64.             if ( size.y == -1 )
  65.                 sizeReal.y = GetDefaultSize();
  66.         }
  67.  
  68.         return sizeReal;
  69.     }
  70.  
  71.     virtual wxSize DoGetBestSize() const
  72.     {
  73.         return AdjustSize(wxDefaultSize);
  74.     }
  75. };
  76.  
  77. // ----------------------------------------------------------------------------
  78. // now include the actual class declaration
  79. // ----------------------------------------------------------------------------
  80.  
  81. #if defined(__WXUNIVERSAL__)
  82.     #include "wx/univ/statline.h"
  83. #elif defined(__WXMSW__)
  84.     #include "wx/msw/statline.h"
  85. #elif defined(__WXGTK__)
  86.     #include "wx/gtk/statline.h"
  87. #elif defined(__WXPM__)
  88.     #include "wx/os2/statline.h"
  89. #elif defined(__WXMAC__)
  90.     #include "wx/mac/statline.h"
  91. #else // use generic implementation for all other platforms
  92.     #include "wx/generic/statline.h"
  93. #endif
  94.  
  95. #endif // wxUSE_STATLINE
  96.  
  97. #endif
  98.     // _WX_STATLINE_H_BASE_
  99.