/users/dtb26/GITROOT/VetSim-Core/src/VetSim-UI/scrolledWindows.h

00001 #ifndef SCROLLEDWINDOWS_H
00002 #define SCROLLEDWINDOWS_H
00003 
00004 #include "mainApplicationWindow.h"
00005 
00006 
00007 class MyScrolledWindowBase : public wxScrolled<wxWindow>
00008 {
00009 public:
00010         MyScrolledWindowBase(wxWindow *parent)
00011                 : wxScrolled<wxWindow>(parent, wxID_ANY,
00012                                                                 wxDefaultPosition, wxDefaultSize,
00013                                                                 wxBORDER_SUNKEN)
00014         {
00015                 m_nLines = 50;
00016 
00017                 wxClientDC dc(this);
00018 
00019                 //used to set the height which is used to set the scroll rate in the following class
00020                 dc.GetTextExtent("Line 17", NULL, &m_hLine);
00021         }
00022 
00023         virtual void ScrollWindow(int dx, int dy, const wxRect *rect = NULL)
00024         {
00025                 wxScrolled<wxWindow>::ScrollWindow(dx, dy, rect);
00026 
00027         }
00028 
00029 protected:
00030         // the height of one line on screen
00031         int m_hLine;
00032 
00033         // the number of lines we draw
00034         size_t m_nLines;
00035 };
00036 
00037 // only redraws the lines which must be
00038 // redrawn and sets the scroll rate and virtual size to affect the
00039 // scrollbars.
00040 class MyScrolledWindowSmart : public MyScrolledWindowBase
00041 {
00042 public:
00043         MyScrolledWindowSmart(wxWindow *parent) : MyScrolledWindowBase(parent)
00044         {
00045                 // no horz scrolling
00046                 SetScrollRate( 0, m_hLine );
00047                 SetVirtualSize( wxDefaultCoord, ( m_nLines + 1 ) * m_hLine );
00048         }
00049 
00050 };
00051 
00052 #endif

Generated on Thu Sep 27 11:11:48 2012 for VetSim by  doxygen 1.4.7