statline.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name: wx/statline.h
  3. // Purpose: wxStaticLine class interface
  4. // Author: Vadim Zeitlin
  5. // Created: 28.06.99
  6. // Copyright: (c) 1999 Vadim Zeitlin
  7. // Licence: wxWindows licence
  8. /////////////////////////////////////////////////////////////////////////////
  9. #ifndef _WX_STATLINE_H_BASE_
  10. #define _WX_STATLINE_H_BASE_
  11. // ----------------------------------------------------------------------------
  12. // headers
  13. // ----------------------------------------------------------------------------
  14. // this defines wxUSE_STATLINE
  15. #include "wx/defs.h"
  16. #if wxUSE_STATLINE
  17. // the base class declaration
  18. #include "wx/control.h"
  19. // ----------------------------------------------------------------------------
  20. // global variables
  21. // ----------------------------------------------------------------------------
  22. // the default name for objects of class wxStaticLine
  23. extern WXDLLIMPEXP_DATA_CORE(const char) wxStaticLineNameStr[];
  24. // ----------------------------------------------------------------------------
  25. // wxStaticLine - a line in a dialog
  26. // ----------------------------------------------------------------------------
  27. class WXDLLIMPEXP_CORE wxStaticLineBase : public wxControl
  28. {
  29. public:
  30. // constructor
  31. wxStaticLineBase() { }
  32. // is the line vertical?
  33. bool IsVertical() const { return (GetWindowStyle() & wxLI_VERTICAL) != 0; }
  34. // get the default size for the "lesser" dimension of the static line
  35. static int GetDefaultSize() { return 2; }
  36. // overridden base class virtuals
  37. virtual bool AcceptsFocus() const { return false; }
  38. protected:
  39. // choose the default border for this window
  40. virtual wxBorder GetDefaultBorder() const { return wxBORDER_NONE; }
  41. // set the right size for the right dimension
  42. wxSize AdjustSize(const wxSize& size) const
  43. {
  44. wxSize sizeReal(size);
  45. if ( IsVertical() )
  46. {
  47. if ( size.x == wxDefaultCoord )
  48. sizeReal.x = GetDefaultSize();
  49. }
  50. else
  51. {
  52. if ( size.y == wxDefaultCoord )
  53. sizeReal.y = GetDefaultSize();
  54. }
  55. return sizeReal;
  56. }
  57. virtual wxSize DoGetBestSize() const
  58. {
  59. return AdjustSize(wxDefaultSize);
  60. }
  61. wxDECLARE_NO_COPY_CLASS(wxStaticLineBase);
  62. };
  63. // ----------------------------------------------------------------------------
  64. // now include the actual class declaration
  65. // ----------------------------------------------------------------------------
  66. #if defined(__WXUNIVERSAL__)
  67. #include "wx/univ/statline.h"
  68. #elif defined(__WXMSW__)
  69. #include "wx/msw/statline.h"
  70. #elif defined(__WXGTK20__)
  71. #include "wx/gtk/statline.h"
  72. #elif defined(__WXGTK__)
  73. #include "wx/gtk1/statline.h"
  74. #elif defined(__WXPM__)
  75. #include "wx/os2/statline.h"
  76. #elif defined(__WXMAC__)
  77. #include "wx/osx/statline.h"
  78. #elif defined(__WXCOCOA__)
  79. #include "wx/cocoa/statline.h"
  80. #else // use generic implementation for all other platforms
  81. #include "wx/generic/statline.h"
  82. #endif
  83. #endif // wxUSE_STATLINE
  84. #endif // _WX_STATLINE_H_BASE_