sub_arctic.lib
Class v_scrollbar

java.lang.Object
  |
  +--sub_arctic.lib.min_interactor
        |
        +--sub_arctic.lib.base_interactor
              |
              +--sub_arctic.lib.v_slider_display
                    |
                    +--sub_arctic.lib.v_slider
                          |
                          +--sub_arctic.lib.v_scrollbar
Direct Known Subclasses:
listbox_v_scrollbar

public class v_scrollbar
extends v_slider

This is a "style-free" vertical scrollbar interactor. It works with the style_manager and a style object.


Field Summary
protected  int _cur_thumb_size
          Size of current thumb (so we know if we need to replace it)
protected  double _thumb_percentage
          This is the amount as a percentage (0..1) of size the thumb takes up.
protected  double _thumb_scale
          The amount we scale thumb_percentage (which is in the range 0..1) by when return it (or accept it) as an integer through the part_b interface.
protected  int _usable_area
          This holds the usable area of the scrollbar.
 
Fields inherited from class sub_arctic.lib.v_slider
_callback_obj, DYNAMIC_CALLBACK, STATIC_CALLBACK
 
Fields inherited from class sub_arctic.lib.v_slider_display
_back_img, _boxed, _dn_img, _large_inc, _max_val, _min_val, _small_inc, _thumb_img, _thumb_shift, _up_img, _value
 
Fields inherited from class sub_arctic.lib.base_interactor
_child_index, _child_list, _clip_bounds, _constraint_flags, _enabled_constraint, _flags, _h, _h_constraint, _parent, _part_a_constraint, _part_b_constraint, _user_data, _visible_constraint, _w, _w_constraint, _x, _x_constraint, _y, _y_constraint, default_child_hint
 
Constructor Summary
v_scrollbar(callback_object co)
          Minimal constructor for a vertical scrollbar.
v_scrollbar(int x, int y, int w, callback_object co)
          Create a vertical scrollbar with some reasonable defaults.
v_scrollbar(int x, int y, int h, int min, int max, int init, double percent, int small, int large, callback_object co)
          Create a vertical scrollbar at a given location on the screen with a given height.
 
Method Summary
 void calculate_thumb_image()
          This does the work of actually drawing the thumb image.
protected  void compute_usable_area()
          This computes the usable area of the scrollbar.
 void configure()
          We override configure so we can automatically update the size of the scrollbar thumb.
protected  void init()
          Internal function for initializing the scrollbar.
 int intrinsic_constraints()
          Indicate which values (coordinates/sizes) of this object are intrinsically constrained by the internals of the object.
 int part_b()
          Return the value of the part_b component of this object.
 void set_part_b(int v)
          Set the part_b component of this object.
protected  void set_raw_part_b(int v)
          Set part_b value directly bypassing the constraint system (but doing damage).
 void set_thumb_percentage(double d)
          Set the percentage of the whole size the thumb is now occupying.
 void set_thumb_scale(double v)
          The amount we scale thumb_percentage (which is in the range 0..1) by when return it (or accept it) as an integer through the part_b interface.
 void style_changed()
          This function gets called when the system's style resources change or we are getting initialized.
protected  int thumb_offset()
          Compute the offset to the thumb in pixels.
 double thumb_percentage()
          Retrieve the amount of space covered by the thumb.
 double thumb_scale()
          The amount we scale thumb_percentage (which is in the range 0..1) by when return it (or accept it) as an integer through the part_b interface.
 
Methods inherited from class sub_arctic.lib.v_slider
callback_obj, do_callback, do_callback, drag_end, drag_feedback, drag_start, dynamic_callback, first_callback_num, handle_down_button, handle_up_button, last_callback_num, press, release, set_callback_obj, static_callback
 
Methods inherited from class sub_arctic.lib.v_slider_display
back_img, boxed, conform, dn_img, draw_self_local, large_inc, max_val, min_val, part_a, set_back_img, set_boxed, set_dn_img, set_large_inc, set_max_val, set_min_val, set_part_a, set_raw_part_a, set_small_inc, set_thumb_img, set_thumb_shift, set_up_img, set_value, small_inc, thumb_img, thumb_shift, up_img, value
 
Methods inherited from class sub_arctic.lib.base_interactor
active_constraints, add_child, add_user_datum, attach_dependent, bound, child_index, child, clear_child_list, clear_constraint_flag_bit, clear_flag_bit, constraint_flag_is_set, constraint_flag_string, constraint_on, custom_fun1, custom_fun2, damage_fixed, damage_from_child, damage_self, damage_self, damage_self, damage_self, damage_self, detach_dependent, do_action, do_action, drag_feature_point, draw_children, draw_self, enabled_constraint, enabled, enter_local_coordinates, eval_enabled, eval_h, eval_part_a, eval_part_b, eval_visible, eval_w, eval_x, eval_y, eval, exit_local_coords, feature_point_enabled, feature_point, filter_pt, find_child, fixed_children, flag_is_set, flag_string, focus_set_enter, focus_set_exit, get_awt_component, get_external_constraint, get_part, get_top_level, get_value, global_to_local, global_to_local, h_constraint, h, handle_cycle, inform_ood, insert_child, inside_bounds, into_local, into_local, into_parent, into_parent, is_constrained, local_to_global, local_to_global, mark_all_ood, mark_enabled_ood, mark_h_ood, mark_ood, mark_part_a_ood, mark_part_b_ood, mark_reparented_ood, mark_visible_ood, mark_w_ood, mark_x_ood, mark_y_ood, marked_ood, move_child_downward, move_child_downward, move_child_to_bottom, move_child_to_bottom, move_child_to_top, move_child_to_top, move_child_upward, move_child_upward, move_downward, move_to_bottom, move_to_top, move_upward, new_look_configure, next_sibling, num_actions, num_children, num_feature_points, ood_inform_all, parent, part_a_constraint, part_b_constraint, pick_within_children, pick, picked_by, pos, prev_sibling, register_resource_names, remove_child, remove_child, remove_user_datum, restyle_look_resources, restyle, set_child_index, set_child, set_constraint_flag_bit, set_constraint_flag_bit, set_constraint, set_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled_constraint, set_enabled, set_flag_bit, set_flag_bit, set_h_constraint, set_h_constraint, set_h_constraint, set_h, set_intrinsic_h, set_intrinsic_size, set_intrinsic_w, set_parent, set_part_a_constraint, set_part_a_constraint, set_part_a_constraint, set_part_b_constraint, set_part_b_constraint, set_part_b_constraint, set_pos, set_pos, set_raw_enabled, set_raw_h, set_raw_visible, set_raw_w, set_raw_x, set_raw_y, set_size, set_style_lock, set_user_info, set_visible_constraint, set_visible_constraint, set_visible_constraint, set_visible, set_w_constraint, set_w_constraint, set_w_constraint, set_w, set_x_constraint, set_x_constraint, set_x_constraint, set_x, set_y_constraint, set_y_constraint, set_y_constraint, set_y, setup_for_children, setup_for_children, setup_for_fixed_children, size, style_change_local, style_change, supports_children, tag_str, toString, traverse_and_collect_children, traverse_and_collect_parent, traverse_and_collect, trivial_reject, trivial_reject, user_data, user_info, value_ood, visible_constraint, visible, w_constraint, w, x_constraint, x_into_local, x_into_parent, x, y_constraint, y_into_local, y_into_parent, y
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_usable_area

protected int _usable_area
This holds the usable area of the scrollbar.

_thumb_scale

protected double _thumb_scale
The amount we scale thumb_percentage (which is in the range 0..1) by when return it (or accept it) as an integer through the part_b interface. This defaults to 100.0 which corresponds to integer values being one percent each (i.e., 0..100 is the legal range).

_thumb_percentage

protected double _thumb_percentage
This is the amount as a percentage (0..1) of size the thumb takes up.

_cur_thumb_size

protected int _cur_thumb_size
Size of current thumb (so we know if we need to replace it)
Constructor Detail

v_scrollbar

public v_scrollbar(int x,
                   int y,
                   int h,
                   int min,
                   int max,
                   int init,
                   double percent,
                   int small,
                   int large,
                   callback_object co)
Create a vertical scrollbar at a given location on the screen with a given height.
Parameters:
int - x the x position of this object.
int - y the y position of this object.
int - h the height of this object.
int - min the min value of this object.
int - max the max value of this object.
int - init the initial value of this object.
double - percent the size of the scrollbar (larger than zero, less than or equal to one).
int - small the small increment value (which occurs when you press a end button).
int - large the large increment value (which occurs when you click in the thumb area).
callback_object - co the object to send callbacks to (#0 is the mouse has been released and the thumb is stopped moving and #1 is the thumb is being dragged).

v_scrollbar

public v_scrollbar(int x,
                   int y,
                   int w,
                   callback_object co)
Create a vertical scrollbar with some reasonable defaults. This makes the range of the scrollbar 0-99 and sets the initial value at 0. It makes the small increment 5 and the large increment 25. It sets the thumb to be 25% of the size of the scrollbar
Parameters:
int - x the x position of the interactor.
int - y the x position of the interactor.
int - w the width of the interactor.
callback_object - co the object to send callbacks to.

v_scrollbar

public v_scrollbar(callback_object co)
Minimal constructor for a vertical scrollbar. It assumes you are going to size it and position it with constraints or do so directly.

This makes the range of the slider 0-99 and sets the initial value at 0. It makes the small increment 5 and the large increment 25. It sets the thumb to be 25% of the size of the scrollbar

Parameters:
callback_object - co the object to send callbacks to
Method Detail

intrinsic_constraints

public int intrinsic_constraints()
Indicate which values (coordinates/sizes) of this object are intrinsically constrained by the internals of the object. In this case we need to remove PART_B from the set provided by the superclass.
Returns:
int bitset indicating which parts are intrinsically constrained.
Overrides:
intrinsic_constraints in class v_slider_display

thumb_offset

protected int thumb_offset()
Compute the offset to the thumb in pixels. We override here so we never return -1 for the doesn't fit condition (which was for use by sliders that have a fixed size thumb), and just return 0 instead.
Returns:
int the amount the thumb should be shifted down to account for the value of the slider.
Overrides:
thumb_offset in class v_slider_display

compute_usable_area

protected void compute_usable_area()
This computes the usable area of the scrollbar.

part_b

public int part_b()
Return the value of the part_b component of this object. In our case this is tied to _thumb_percentage. In particular its thumb_percentage*thumb_scale where thumb_percentage is in the range 0..1.
Returns:
int the value of part_b (AKA thumb_percentage).
Overrides:
part_b in class base_interactor

set_raw_part_b

protected void set_raw_part_b(int v)
Set part_b value directly bypassing the constraint system (but doing damage). In this case part_b is tied to _thumb_percentage.
Parameters:
int - v the new value.
Overrides:
set_raw_part_b in class base_interactor

set_part_b

public void set_part_b(int v)
Set the part_b component of this object. In our case this is tied to thumb_percentage.
Parameters:
int - v the new value
Overrides:
set_part_b in class base_interactor

thumb_scale

public double thumb_scale()
The amount we scale thumb_percentage (which is in the range 0..1) by when return it (or accept it) as an integer through the part_b interface. This defaults to 100.0 which corresponds to integer values being one percent each (i.e., 0..100 is the legal range).
Returns:
double the thumb scale value.

set_thumb_scale

public void set_thumb_scale(double v)
The amount we scale thumb_percentage (which is in the range 0..1) by when return it (or accept it) as an integer through the part_b interface. This defaults to 100.0 which corresponds to integer values being one percent each (i.e., 0..100 is the legal range). If you want more resolution than this, set the scale to a larger number. Values <= 0 will restore the scale value to the default (100.0).
Parameters:
double - v the new thumb scale value.

thumb_percentage

public double thumb_percentage()
Retrieve the amount of space covered by the thumb. This value is tied to part_b of this object (which is accessible as a scaled integer via the constraint system).
Returns:
double the size of the scrollbar as a percent (0..1) of the area.

calculate_thumb_image

public void calculate_thumb_image()
This does the work of actually drawing the thumb image.

set_thumb_percentage

public void set_thumb_percentage(double d)
Set the percentage of the whole size the thumb is now occupying.
Parameters:
double - the percentage of the size of the scrollbar the thumb is occupying (0.0 < this number <= 1.0)

init

protected void init()
Internal function for initializing the scrollbar.

style_changed

public void style_changed()
This function gets called when the system's style resources change or we are getting initialized.

configure

public void configure()
We override configure so we can automatically update the size of the scrollbar thumb.
Overrides:
configure in class base_interactor