home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2240.zip / wxWindows-2.4.0 / include / wx / statusbr.h < prev    next >
C/C++ Source or Header  |  2002-08-31  |  5KB  |  147 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        wx/statusbr.h
  3. // Purpose:     wxStatusBar class interface
  4. // Author:      Vadim Zeitlin
  5. // Modified by:
  6. // Created:     05.02.00
  7. // RCS-ID:      $Id: statusbr.h,v 1.13 2002/08/31 11:29:11 GD Exp $
  8. // Copyright:   (c) wxWindows team
  9. // Licence:     wxWindows license
  10. /////////////////////////////////////////////////////////////////////////////
  11.  
  12. #ifndef _WX_STATUSBR_H_BASE_
  13. #define _WX_STATUSBR_H_BASE_
  14.  
  15. #if defined(__GNUG__) && !defined(__APPLE__)
  16.     #pragma interface "statbar.h"
  17. #endif
  18.  
  19. #include "wx/window.h"
  20.  
  21. #if wxUSE_STATUSBAR
  22.  
  23. #include "wx/list.h"
  24.  
  25. WX_DECLARE_LIST(wxString, wxListString);
  26.  
  27. // ----------------------------------------------------------------------------
  28. // wxStatusBar: a window near the bottom of the frame used for status info
  29. // ----------------------------------------------------------------------------
  30.  
  31. class WXDLLEXPORT wxStatusBarBase : public wxWindow
  32. {
  33. public:
  34.     wxStatusBarBase();
  35.  
  36.     virtual ~wxStatusBarBase();
  37.  
  38.     // field count
  39.     // -----------
  40.  
  41.     // set the number of fields and call SetStatusWidths(widths) if widths are
  42.     // given
  43.     virtual void SetFieldsCount(int number = 1, const int *widths = NULL);
  44.     int GetFieldsCount() const { return m_nFields; }
  45.  
  46.     // field text
  47.     // ----------
  48.  
  49.     virtual void SetStatusText(const wxString& text, int number = 0) = 0;
  50.     virtual wxString GetStatusText(int number = 0) const = 0;
  51.  
  52.     void PushStatusText(const wxString& text, int number = 0);
  53.     void PopStatusText(int number = 0);
  54.  
  55.     // fields widths
  56.     // -------------
  57.  
  58.     // set status field widths as absolute numbers: positive widths mean that
  59.     // the field has the specified absolute width, negative widths are
  60.     // interpreted as the sizer options, i.e. the extra space (total space
  61.     // minus the sum of fixed width fields) is divided between the fields with
  62.     // negative width according to the abs value of the width (field with width
  63.     // -2 grows twice as much as one with width -1 &c)
  64.     virtual void SetStatusWidths(int n, const int widths[]);
  65.  
  66.     // geometry
  67.     // --------
  68.  
  69.     // Get the position and size of the field's internal bounding rectangle
  70.     virtual bool GetFieldRect(int i, wxRect& rect) const = 0;
  71.  
  72.     // sets the minimal vertical size of the status bar
  73.     virtual void SetMinHeight(int height) = 0;
  74.  
  75.     // get the dimensions of the horizontal and vertical borders
  76.     virtual int GetBorderX() const = 0;
  77.     virtual int GetBorderY() const = 0;
  78.  
  79.     // don't want status bars to accept the focus at all
  80.     virtual bool AcceptsFocus() const { return FALSE; }
  81.  
  82. protected:
  83.     // set the widths array to NULL
  84.     void InitWidths();
  85.  
  86.     // free the status widths arrays
  87.     void FreeWidths();
  88.  
  89.     // reset the widths
  90.     void ReinitWidths() { FreeWidths(); InitWidths(); }
  91.  
  92.     // same, for text stacks
  93.     void InitStacks();
  94.     void FreeStacks();
  95.     void ReinitStacks() { FreeStacks(); InitStacks(); }
  96.  
  97.     // calculate the real field widths for the given total available size
  98.     wxArrayInt CalculateAbsWidths(wxCoord widthTotal) const;
  99.  
  100.     // use these functions to access the stacks of field strings
  101.     wxListString *GetStatusStack(int i) const;
  102.     wxListString *GetOrCreateStatusStack(int i);
  103.  
  104.     // the current number of fields
  105.     int        m_nFields;
  106.  
  107.     // the widths of the fields in pixels if !NULL, all fields have the same
  108.     // width otherwise
  109.     int       *m_statusWidths;
  110.  
  111.     // stacks of previous values for PushStatusText/PopStatusText
  112.     // this is created on demand, use GetStatusStack/GetOrCreateStatusStack
  113.     wxListString **m_statusTextStacks;
  114. };
  115.  
  116. // ----------------------------------------------------------------------------
  117. // include the actual wxStatusBar class declaration
  118. // ----------------------------------------------------------------------------
  119.  
  120. #if defined(__WXUNIVERSAL__)
  121.     #define wxStatusBarUniv wxStatusBar
  122.     #define sm_classwxStatusBarUniv sm_classwxStatusBar
  123.  
  124.     #include "wx/univ/statusbr.h"
  125. #elif defined(__WIN32__) && wxUSE_NATIVE_STATUSBAR
  126.     #define wxStatusBar95 wxStatusBar
  127.     #define sm_classwxStatusBar95 sm_classwxStatusBar
  128.  
  129.     #include "wx/msw/statbr95.h"
  130. #elif defined(__WXMAC__)
  131.     #define wxStatusBarMac wxStatusBar
  132.     #define sm_classwxStatusBarMac sm_classwxStatusBar
  133.  
  134.     #include "wx/generic/statusbr.h"
  135.     #include "wx/mac/statusbr.h"
  136. #else
  137.     #define wxStatusBarGeneric wxStatusBar
  138.     #define sm_classwxStatusBarGeneric sm_classwxStatusBar
  139.  
  140.     #include "wx/generic/statusbr.h"
  141. #endif
  142.  
  143. #endif // wxUSE_STATUSBAR
  144.  
  145. #endif
  146.     // _WX_STATUSBR_H_BASE_
  147.