source: golgotha/src/i4/gui/scroll_bar.hh @ 80

Last change on this file since 80 was 80, checked in by Sam Hocevar, 12 years ago
  • Adding the Golgotha source code. Not sure what's going to be interesting in there, but since it's all public domain, there's certainly stuff to pick up.
File size: 2.2 KB
Line 
1/********************************************************************** <BR>
2  This file is part of Crack dot Com's free source code release of
3  Golgotha. <a href="http://www.crack.com/golgotha_release"> <BR> for
4  information about compiling & licensing issues visit this URL</a>
5  <PRE> If that doesn't help, contact Jonathan Clark at
6  golgotha_source@usa.net (Subject should have "GOLG" in it)
7***********************************************************************/
8
9#ifndef SCROLL_BAR_HH
10#define SCROLL_BAR_HH
11
12#include "device/event.hh"
13#include "window/window.hh"
14
15class i4_button_class;
16class i4_graphical_style_class;
17
18class i4_scroll_message : public i4_user_message_event_class
19{
20public:
21  sw32 amount;
22  sw32 scroll_total;
23
24  i4_scroll_message(sw32 amount, sw32 scroll_total, w32 id)
25    : amount(amount), scroll_total(scroll_total),
26      i4_user_message_event_class(id)
27
28  {}
29
30  virtual i4_event *copy() { return new i4_scroll_message(amount, scroll_total, sub_type); }
31};
32
33
34
35class i4_scroll_button;
36
37class i4_scroll_bar : public i4_parent_window_class        // up-down scroll bar
38{
39  friend class i4_scroll_button;
40  i4_graphical_style_class *style;
41  w32 total_scroll_objects, total_visible_objects;
42  i4_button_class *up_but, *down_but, *left_but, *right_but;
43  i4_scroll_button *scroll_but;
44  i4_parent_window_class *scroll_area;
45  w32 id,pos;
46  i4_event_handler_class *send_to;
47  i4_bool vertical;
48
49  i4_button_class *create_button(i4_button_class *&b, i4_image_class *im);
50public:
51  void send_position();
52  void set_bar_pos(sw32 pos);
53  void calc_pos();
54  void set_new_total(int total);              // if total items under control changes
55  i4_scroll_bar(i4_bool vertical,
56                int max_dimention_size,      // width/height depending on vertical
57                int total_visible_objects,   // used to determine scroll bar dragger size
58                int total_scroll_objects,    // total number of objects that will be scrolled
59                w32 message_id,
60                i4_event_handler_class *send_to,
61                i4_graphical_style_class *style);
62
63  virtual void receive_event(i4_event *ev);
64
65  char *name() { return "vscroll_bar"; }
66};
67
68
69#endif
70
71
Note: See TracBrowser for help on using the repository browser.