sub_arctic.new_lib
Class v_slider_display

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

public class v_slider_display
extends base_interactor

This the class that knows how to the display-side work of displaying a vertical scrollbar. It handles outputting a scrollbar from a set of state variables.


Field Summary
protected  loaded_image _back_img
          Image for the background -- use null for a default solid color
protected  blank _background
          Blank used for background
protected  loaded_image _dn_img
          Image for the down button
protected  int _large_inc
          Large increment value
protected  int _max_val
          Maximum value of the slider
protected  int _min_val
          Minimum value of the slider
protected static boolean _registration_done
          Flag to arrange to execute register_resource_names() at most once.
protected  int _small_inc
          Small increment value
protected  loaded_image _thumb_img
          Image for the "thumb"
protected  int _thumb_shift
          This variable is how much to offset (in x and in pixels) the slider's thumb by when drawing it.
protected  loaded_image _up_img
          Image for the up button
protected  int _value
          Current value of the slider
 
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_slider_display(int xv, int yv, int hv, int minv, int maxv, int init_val, int sincv, int lincv)
          Construct a new v_slider_display with a look from the current style.
v_slider_display(int xv, int yv, int hv, int minv, int maxv, int init_val, int sincv, int lincv, loaded_image up_im, loaded_image dn_im, loaded_image th_im, blank back_blnk)
          Full constructor for the v_slider_display.
 
Method Summary
 loaded_image back_img()
          Image for the background (pattern).
 blank background()
          Blank used for background
protected  void conform()
          Make sure min <= max and min <= value <= max
 loaded_image dn_img()
          Image for the down button
protected  void draw_self_local(drawable d)
          Draw the current image on the drawable provided.
protected  void draw_thumb(drawable on_surf, int x, int y)
          Draw the thumb at the given location on the given drawable
protected  void init_look_resources(style from_style)
          Get initial resources for the object from a given style.
 int intrinsic_constraints()
          Indicate that we intrinsically constrain width.
 int large_inc()
          Return the large increment value (this is the amount the slider's value changes when you click in the thumb area but not on the thumb).
 int max_val()
          Maximum value of the slider
 int min_val()
          Minimum value of the slider
protected  void new_look_configure()
          Recompute the size and other properties of this interactor that may have been changed by a change in style resources.
 int part_a()
          Return the value of the part_a component of this object.
static void register_resource_names()
          Register the resource names associated with this class
protected  void restyle_look_resources(style new_style)
          "Restyle" current style-based resources used by this interactor to conform to the given style.
 void set_back_img(loaded_image img)
          Set the image for the background -- use null for a default solid color
 void set_background(blank new_blank)
          Set the blank used for the background.
 void set_dn_img(loaded_image img)
          Set the image for the down button
 void set_large_inc(int val)
          Set the large increment value (amount the value changes when you click on the thumb area but not on the thumb).
 void set_max_val(int val)
          Set the maximum value of the slider
 void set_min_val(int val)
          Set the minimum value of the slider
 void set_part_a(int v)
          Set the part_a component of this object.
protected  void set_raw_part_a(int v)
          Set part_a value directly bypassing the constraint system (but doing damage).
 void set_small_inc(int val)
          Set the small increment value (amount the value changes when you click on the end buttons.
 void set_thumb_shift(int v)
          Change the amount to shift the thumb by (in the x direction)
 void set_up_img(loaded_image img)
          Set the image for the up button
 void set_value(int val)
          Set the current value of the slider
 int small_inc()
          Return the small increment value (this is the amount the slider's value changes when you push the end buttons).
 int thumb_height()
          Current height of the thumb.
protected  loaded_image thumb_img()
          Image for the thumb
protected  int thumb_offset()
          Compute the offset to the thumb in pixels (returns -1 for no thumb)
 int thumb_shift()
          Return how much to shift the thumb by (in x, and in pixels).
 loaded_image up_img()
          Image for the up button
 int value()
          Current value of the slider
 
Methods inherited from class sub_arctic.lib.base_interactor
active_constraints, add_child, add_user_datum, attach_dependent, bound, callback_obj, child_index, child, clear_child_list, clear_constraint_flag_bit, clear_flag_bit, configure, 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, do_callback, do_callback, 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, first_callback_num, 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, last_callback_num, 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, next_sibling, num_actions, num_children, num_feature_points, ood_inform_all, parent, part_a_constraint, part_b_constraint, part_b, pick_within_children, pick, picked_by, pos, prev_sibling, remove_child, remove_child, remove_user_datum, restyle, set_callback_obj, 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_part_b, set_pos, set_pos, set_raw_enabled, set_raw_h, set_raw_part_b, 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

_thumb_shift

protected int _thumb_shift
This variable is how much to offset (in x and in pixels) the slider's thumb by when drawing it.

_up_img

protected loaded_image _up_img
Image for the up button

_dn_img

protected loaded_image _dn_img
Image for the down button

_thumb_img

protected loaded_image _thumb_img
Image for the "thumb"

_back_img

protected loaded_image _back_img
Image for the background -- use null for a default solid color

_background

protected blank _background
Blank used for background

_min_val

protected int _min_val
Minimum value of the slider

_max_val

protected int _max_val
Maximum value of the slider

_small_inc

protected int _small_inc
Small increment value

_large_inc

protected int _large_inc
Large increment value

_value

protected int _value
Current value of the slider

_registration_done

protected static boolean _registration_done
Flag to arrange to execute register_resource_names() at most once.
Constructor Detail

v_slider_display

public v_slider_display(int xv,
                        int yv,
                        int hv,
                        int minv,
                        int maxv,
                        int init_val,
                        int sincv,
                        int lincv,
                        loaded_image up_im,
                        loaded_image dn_im,
                        loaded_image th_im,
                        blank back_blnk)
Full constructor for the v_slider_display. If you do not supply an image for any of the image slots (i.e. you pass null) a default look will be applied for you.
Parameters:
int - xv x position of the slider.
int - yv y position of the slider.
int - hv height of the slider (in pixels).
int - minv minimum value of the slider.
int - maxv maximum value of the slider.
int - init_val initial value of the slider.
int - sincv small increment value.
int - lincv large increment value.
loaded_image - up_im image for the up button.
loaded_image - dn_im image for the down button.
loaded_image - th_im image for the thumb.
blank - back_blnk blank for the background.

v_slider_display

public v_slider_display(int xv,
                        int yv,
                        int hv,
                        int minv,
                        int maxv,
                        int init_val,
                        int sincv,
                        int lincv)
Construct a new v_slider_display with a look from the current style.
Parameters:
int - xv x position of the slider.
int - yv y position of the slider.
int - hv height of the slider (in pixels).
int - minv minimum value of the slider.
int - maxv maximum value of the slider.
int - init_val initial value of the slider.
int - sincv small increment value.
int - lincv large increment value.
Method Detail

thumb_shift

public int thumb_shift()
Return how much to shift the thumb by (in x, and in pixels).
Returns:
int how much to shift the thumb by (in x, and in pixels).

set_thumb_shift

public void set_thumb_shift(int v)
Change the amount to shift the thumb by (in the x direction)
Parameters:
int - v the amount to shift the thumb by in pixels

up_img

public loaded_image up_img()
Image for the up button
Returns:
the up image.

set_up_img

public void set_up_img(loaded_image img)
Set the image for the up button
Parameters:
loaded_image - img the image to use for the up button

dn_img

public loaded_image dn_img()
Image for the down button
Returns:
the down image.

set_dn_img

public void set_dn_img(loaded_image img)
Set the image for the down button
Parameters:
loaded_image - img the image to use for the down button

thumb_img

protected loaded_image thumb_img()
Image for the thumb
Returns:
loaded_image the thumb image.

thumb_height

public int thumb_height()
Current height of the thumb. Here this is typically fixed, but in subclasses, this may vary.
Returns:
int the current height of the thumb.

draw_thumb

protected void draw_thumb(drawable on_surf,
                          int x,
                          int y)
Draw the thumb at the given location on the given drawable
Parameters:
drawable - on_surf drawable we to draw on.
int - x coordinate of the left edge
int - y coordinate of the top edge

back_img

public loaded_image back_img()
Image for the background (pattern). You'll get null for a default solid color.
Returns:
the background image

set_back_img

public void set_back_img(loaded_image img)
Set the image for the background -- use null for a default solid color
Parameters:
loaded_image - img the image for the background of the slider

background

public blank background()
Blank used for background
Returns:
blank the blank that we use to create the bacground of the slider at the size we need.

set_background

public void set_background(blank new_blank)
Set the blank used for the background.
Parameters:
blank - new_blank the new background blank

min_val

public int min_val()
Minimum value of the slider
Returns:
int the minimum value of the slider

set_min_val

public void set_min_val(int val)
Set the minimum value of the slider
Parameters:
int - val the new minimum value of the slider.

max_val

public int max_val()
Maximum value of the slider
Returns:
the maximum value of the slider

set_max_val

public void set_max_val(int val)
Set the maximum value of the slider
Parameters:
int - val the new maximum value of the slider.

small_inc

public int small_inc()
Return the small increment value (this is the amount the slider's value changes when you push the end buttons).
Returns:
int the small increment value of the slider

set_small_inc

public void set_small_inc(int val)
Set the small increment value (amount the value changes when you click on the end buttons.
Parameters:
int - val the new small increment

large_inc

public int large_inc()
Return the large increment value (this is the amount the slider's value changes when you click in the thumb area but not on the thumb).
Returns:
int the large increment value of the slider

set_large_inc

public void set_large_inc(int val)
Set the large increment value (amount the value changes when you click on the thumb area but not on the thumb).
Parameters:
int - val the new small increment

part_a

public int part_a()
Return the value of the part_a component of this object. In our case this is stored in _value.
Returns:
int the value of part_a.
Overrides:
part_a in class base_interactor

set_raw_part_a

protected void set_raw_part_a(int v)
Set part_a value directly bypassing the constraint system (but doing damage). This should normally only be done by the constraint system or some other part of the system which takes care of marking things out-of-date, etc. itself. In this case part_a is stored in _value.
Parameters:
int - v the new value of part_a.
Overrides:
set_raw_part_a in class base_interactor

set_part_a

public void set_part_a(int v)
Set the part_a component of this object. In our case this is stored in _value.
Overrides:
set_part_a in class base_interactor

value

public int value()
Current value of the slider
Returns:
int the value of the slider.

set_value

public void set_value(int val)
Set the current value of the slider
Parameters:
int - val the new value of the slider

register_resource_names

public static void register_resource_names()
Register the resource names associated with this class

init_look_resources

protected void init_look_resources(style from_style)
Get initial resources for the object from a given style.
Parameters:
style - from_style the style we get our resource from

restyle_look_resources

protected void restyle_look_resources(style new_style)
"Restyle" current style-based resources used by this interactor to conform to the given style.
Parameters:
style - new_style the style to restyle resources under.
Overrides:
restyle_look_resources in class base_interactor

new_look_configure

protected void new_look_configure()
Recompute the size and other properties of this interactor that may have been changed by a change in style resources. This should be called whenever the interactor has been restyled (e.g., it is called automatically from restyle()) or resources affecting the size of the object or its visual appearance are changed in some other way. Here in the base class, this does nothing.
Overrides:
new_look_configure in class base_interactor

conform

protected void conform()
Make sure min <= max and min <= value <= max

intrinsic_constraints

public int intrinsic_constraints()
Indicate that we intrinsically constrain width. Thus, the width is not modifiable by either the programmer or user.
Returns:
int bitset indicating intrinsically constrained parts.
Overrides:
intrinsic_constraints in class base_interactor

thumb_offset

protected int thumb_offset()
Compute the offset to the thumb in pixels (returns -1 for no thumb)
Returns:
int the amount the thumb should be shifted down to account for the value of the slider.

draw_self_local

protected void draw_self_local(drawable d)
Draw the current image on the drawable provided.
Parameters:
drawable - d a drawable for the image or screen you want this object drawn on.
Overrides:
draw_self_local in class base_interactor