1 /////////////////////////////////////////////////////////////////////////////
 
   3 // Purpose:     SWIG interface for wxPanel and wxScrolledWindow
 
   7 // Created:     24-June-1997
 
   9 // Copyright:   (c) 2003 by Total Control Software
 
  10 // Licence:     wxWindows license
 
  11 /////////////////////////////////////////////////////////////////////////////
 
  16 //---------------------------------------------------------------------------
 
  21 //---------------------------------------------------------------------------
 
  27 class wxPanel : public wxWindow
 
  30     %pythonAppend wxPanel         "self._setOORInfo(self)"
 
  31     %pythonAppend wxPanel()       ""
 
  32     %typemap(out) wxPanel*;    // turn off this typemap
 
  34     wxPanel(wxWindow* parent,
 
  35             const wxWindowID id=-1,
 
  36             const wxPoint& pos = wxDefaultPosition,
 
  37             const wxSize& size = wxDefaultSize,
 
  38             long style = wxTAB_TRAVERSAL | wxNO_BORDER,
 
  39             const wxString& name = wxPyPanelNameStr);
 
  40     %name(PrePanel)wxPanel();
 
  42     // Turn it back on again
 
  43     %typemap(out) wxPanel* { $result = wxPyMake_wxObject($1, $owner); }
 
  45     bool Create(wxWindow* parent,
 
  46                 const wxWindowID id=-1,
 
  47                 const wxPoint& pos = wxDefaultPosition,
 
  48                 const wxSize& size = wxDefaultSize,
 
  49                 long style = wxTAB_TRAVERSAL | wxNO_BORDER,
 
  50                 const wxString& name = wxPyPanelNameStr);
 
  54     static wxVisualAttributes
 
  55     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
  58 //---------------------------------------------------------------------------
 
  62 // TODO: Add wrappers for the wxScrollHelper class, make wxScrolledWindow
 
  63 //       derive from it and wxPanel.  But what to do about wxGTK where this
 
  66 MustHaveApp(wxScrolledWindow);
 
  68 class wxScrolledWindow : public wxPanel
 
  71     %pythonAppend wxScrolledWindow         "self._setOORInfo(self)"
 
  72     %pythonAppend wxScrolledWindow()       ""
 
  73     %typemap(out) wxScrolledWindow*;    // turn off this typemap
 
  75     wxScrolledWindow(wxWindow* parent,
 
  76                      const wxWindowID id = -1,
 
  77                      const wxPoint& pos = wxDefaultPosition,
 
  78                      const wxSize& size = wxDefaultSize,
 
  79                      long style = wxHSCROLL | wxVSCROLL,
 
  80                      const wxString& name = wxPyPanelNameStr);
 
  81     %name(PreScrolledWindow)wxScrolledWindow();
 
  83     // Turn it back on again
 
  84     %typemap(out) wxScrolledWindow* { $result = wxPyMake_wxObject($1, $owner); }
 
  86     bool Create(wxWindow* parent,
 
  87                 const wxWindowID id = -1,
 
  88                 const wxPoint& pos = wxDefaultPosition,
 
  89                 const wxSize& size = wxDefaultSize,
 
  90                 long style = wxHSCROLL | wxVSCROLL,
 
  91                 const wxString& name = wxPyPanelNameStr);
 
  94     // configure the scrolling
 
  95     virtual void SetScrollbars(int pixelsPerUnitX, int pixelsPerUnitY,
 
  96                                int noUnitsX, int noUnitsY,
 
  97                                int xPos = 0, int yPos = 0,
 
  98                                bool noRefresh = false );
 
 100     // scroll to the given (in logical coords) position
 
 101     virtual void Scroll(int x, int y);
 
 103     // get/set the page size for this orientation (wxVERTICAL/wxHORIZONTAL)
 
 104     int GetScrollPageSize(int orient) const;
 
 105     void SetScrollPageSize(int orient, int pageSize);
 
 107     // Set the x, y scrolling increments.
 
 108     void SetScrollRate( int xstep, int ystep );
 
 111         virtual void, GetScrollPixelsPerUnit(int *OUTPUT, int *OUTPUT) const,
 
 112         "GetScrollPixelsPerUnit() -> (xUnit, yUnit)",
 
 113         "Get the size of one logical unit in physical units.", "");
 
 115     // Enable/disable Windows scrolling in either direction. If True, wxWindows
 
 116     // scrolls the canvas and only a bit of the canvas is invalidated; no
 
 117     // Clear() is necessary. If False, the whole canvas is invalidated and a
 
 118     // Clear() is necessary. Disable for when the scroll increment is used to
 
 119     // actually scroll a non-constant distance
 
 120     virtual void EnableScrolling(bool x_scrolling, bool y_scrolling);
 
 124         virtual void, GetViewStart(int *OUTPUT, int *OUTPUT) const,
 
 125         "GetViewStart() -> (x,y)",
 
 126         "Get the view start", "");
 
 128     // Set the scale factor, used in PrepareDC
 
 129     void SetScale(double xs, double ys);
 
 130     double GetScaleX() const;
 
 131     double GetScaleY() const;
 
 134     %nokwargs CalcScrolledPosition;
 
 135     %nokwargs CalcUnscrolledPosition;
 
 137     DocStr(CalcScrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
 
 138     wxPoint CalcScrolledPosition(const wxPoint& pt) const;
 
 140         void, CalcScrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
 
 141         "CalcScrolledPosition(int x, int y) -> (sx, sy)");
 
 144     DocStr(CalcUnscrolledPosition, "Translate between scrolled and unscrolled coordinates.", "");
 
 145     wxPoint CalcUnscrolledPosition(const wxPoint& pt) const;
 
 147         void, CalcUnscrolledPosition(int x, int y, int *OUTPUT, int *OUTPUT) const,
 
 148         "CalcUnscrolledPosition(int x, int y) -> (ux, uy)");
 
 152 // TODO: use directors?
 
 153 //     virtual void DoCalcScrolledPosition(int x, int y, int *xx, int *yy) const;
 
 154 //     virtual void DoCalcUnscrolledPosition(int x, int y, int *xx, int *yy) const;
 
 156     // Adjust the scrollbars
 
 157     virtual void AdjustScrollbars();
 
 159     // Calculate scroll increment
 
 160     virtual int CalcScrollInc(wxScrollWinEvent& event);
 
 162     // Normally the wxScrolledWindow will scroll itself, but in some rare
 
 163     // occasions you might want it to scroll [part of] another window (e.g. a
 
 164     // child of it in order to scroll only a portion the area between the
 
 165     // scrollbars (spreadsheet: only cell area will move).
 
 166     virtual void SetTargetWindow(wxWindow *target);
 
 167     virtual wxWindow *GetTargetWindow() const;
 
 170     void SetTargetRect(const wxRect& rect);
 
 171     wxRect GetTargetRect() const;
 
 174     // TODO: directorize this?
 
 176         virtual void , DoPrepareDC( wxDC & dc ),
 
 177         "Normally what is called by `PrepareDC`.", "");
 
 180     static wxVisualAttributes
 
 181     GetClassDefaultAttributes(wxWindowVariant variant = wxWINDOW_VARIANT_NORMAL);
 
 185 //---------------------------------------------------------------------------