Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ScrollWindow.h
Go to the documentation of this file.
1 /* Project nGenEx
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: nGenEx.lib
6  FILE: ScrollWindow.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  ScrollWindow base class for List, Edit, and Rich Text controls
13 */
14 
15 #ifndef ScrollWindow_h
16 #define ScrollWindow_h
17 
18 #include "Types.h"
19 #include "ActiveWindow.h"
20 #include "List.h"
21 
22 // +--------------------------------------------------------------------+
23 
24 class ScrollWindow : public ActiveWindow
25 {
26 public:
30  };
31 
38  };
39 
40  enum MISC { BORDER_WIDTH = 2,
48  };
49 
50  ScrollWindow(ActiveWindow* p, int ax, int ay, int aw, int ah, DWORD aid, DWORD style=0, ActiveWindow* parent=0);
51  ScrollWindow(Screen* s, int ax, int ay, int aw, int ah, DWORD aid, DWORD style=0, ActiveWindow* parent=0);
52  virtual ~ScrollWindow();
53 
54  // Operations:
55  virtual void Paint();
56  virtual void Draw();
57  virtual void DrawTransparent();
58  virtual void DrawContent(const Rect& ctrl_rect);
59  virtual void DrawTransparentContent(const Rect& ctrl_rect);
60  virtual void DrawScrollBar();
61  virtual void MoveTo(const Rect& r);
62 
63  // Event Target Interface:
64  virtual int OnMouseMove(int x, int y);
65  virtual int OnLButtonDown(int x, int y);
66  virtual int OnLButtonUp(int x, int y);
67  virtual int OnMouseWheel(int wheel);
68  virtual int OnClick();
69 
70  virtual int OnKeyDown(int vk, int flags);
71 
72  // pseudo-events:
73  virtual int OnDragStart(int x, int y);
74  virtual int OnDragDrop(int x, int y, ActiveWindow* source);
75 
76  // Property accessors:
77  virtual int GetLineHeight();
78  virtual void SetLineHeight(int h);
79 
80  virtual int GetLeading();
81  virtual void SetLeading(int nNewValue);
82  virtual int GetScrollBarVisible();
83  virtual void SetScrollBarVisible(int nNewValue);
84  virtual int GetDragDrop();
85  virtual void SetDragDrop(int nNewValue);
86  virtual bool GetSmoothScroll();
87  virtual void SetSmoothScroll(bool s);
88 
89  virtual bool IsScrollVisible();
90  virtual bool CanScroll(int direction, int nlines=1);
91  virtual void EnsureVisible(int index);
92  virtual void Scroll(int direction, int nlines=1);
93  virtual void SmoothScroll(int direction, double nlines);
94  virtual void ScrollTo(int index);
95 
96  // read-only:
97  virtual int GetTopIndex();
98  virtual int GetLineCount();
99  virtual int GetPageCount();
100  virtual int GetPageSize();
101  virtual int GetScrollTrack();
102 
103  int IsDragging() const { return dragging; }
104  int IsSelecting() const { return selecting; }
105  int IsScrolling() const { return scrolling; }
106 
107 protected:
108  int captured;
109  int dragging;
113  int mouse_x;
114  int mouse_y;
117 
118  int leading;
120  int dragdrop;
126 
129 };
130 
131 #endif ScrollWindow_h
132