|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--sub_arctic.lib.min_interactor | +--sub_arctic.lib.base_interactor | +--sub_arctic.lib.multi_button
This class implements a multi-state button object. It can have any number of states and may have transitions between those states with individual looks.
Field Summary | |
protected callback_object |
_callback_obj
Object we make callbacks to |
protected int |
_cur_state
Index of current state. |
protected boolean |
_in_transition
Internal indicator of whether we are currently in transition from one state to the next. |
protected loaded_image[] |
_state_looks
Image set for "normal" appearance in each state. |
protected loaded_image[] |
_transition_looks
Image set for "transition" appearance from each state. |
static int |
BUTTON_ACTION_CALLBACK
Callback number constant for the button state transition callback. |
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 | |
multi_button(int x,
int y,
loaded_image[] st_looks,
loaded_image[] trans_looks,
callback_object call_obj)
Full constructor. |
Method Summary | |
protected void |
calc_size()
(Re)calculate size as max of images. |
callback_object |
callback_obj()
Object that this button makes callbacks to when pressed. |
int |
cur_state()
Index of current state. |
void |
do_action(int action_num,
event evt,
java.lang.Object parm)
Perform the (only) action associated with this interactor. |
void |
do_callback(event evt)
Invoke the callback object. |
protected void |
draw_self_local(drawable d)
Draw the button |
int |
first_callback_num()
First valid callback number |
loaded_image |
get_state_look(int indx)
Get the "normal" appearance image for a given state. |
loaded_image |
get_transition_look(int indx)
Get the "transition" appearance image from a given state. |
boolean |
inout_drag_end(event evt,
boolean ended_inside,
java.lang.Object user_info)
Handle input corresponding to the end of an inout drag. |
boolean |
inout_drag_enter(event evt,
java.lang.Object user_info)
Handle "drag" into the bounds of the object. |
boolean |
inout_drag_exit(event evt,
java.lang.Object user_info)
Handle "drag" out of the bounds of the object. |
boolean |
inout_drag_start(event evt,
boolean starts_inside,
java.lang.Object user_info)
Handle input corresponding to the start of an inout tracking drag. |
int |
intrinsic_constraints()
This interactor determines width and height internally, and does not intrinsically constrain part_a. |
int |
last_callback_num()
Last valid callback number |
int |
next_state()
Indicate what the next state will be. |
int |
part_a()
Return the value of the part_a component of this object. |
boolean |
press(event evt,
java.lang.Object user_info)
Handle mouse presses in our bounds. |
boolean |
release(event evt,
java.lang.Object user_info)
Companion for press() -- ignore here. |
void |
set_callback_obj(callback_object cb)
Set the callback object that this button makes callbacks to when pressed. |
void |
set_cur_state(int st)
Set index of current state. |
void |
set_looks(loaded_image[] st_looks,
loaded_image[] trans_looks)
Set both "normal" and "transition" image sets. |
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_state_look(int indx,
loaded_image img)
Set the "normal" appearance image for a given state. |
void |
set_transition_look(int indx,
loaded_image img)
Set the "transition" appearance image from a given state. |
loaded_image[] |
state_looks()
Image set for "normal" appearance in each state. |
loaded_image[] |
transition_looks()
Image set for "transition" appearance from each state. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected boolean _in_transition
protected int _cur_state
protected loaded_image[] _state_looks
protected loaded_image[] _transition_looks
protected callback_object _callback_obj
public static final int BUTTON_ACTION_CALLBACK
Constructor Detail |
public multi_button(int x, int y, loaded_image[] st_looks, loaded_image[] trans_looks, callback_object call_obj)
int
- x x position of this objectint
- y y position of this objectloaded_image[]
- st_looks the set of images for the looks of this
objectloaded_image[]
- trans_looks the set of images for the looks of
transitions of this object.callback_object
- call_obj the object to send the callbacks to.Method Detail |
public int intrinsic_constraints()
public int part_a()
protected void set_raw_part_a(int v)
int
- v the new value for part_a.public void set_part_a(int v)
int
- v the new value of part_a.public int cur_state()
public void set_cur_state(int st)
int
- the new current state.public int next_state()
public void do_action(int action_num, event evt, java.lang.Object parm)
int
- action_num which action type this is (the
interpretation of this value is subclass
dependent. 0 is always interpreted as
the primary or default action of this
interactor.event
- evt the event which "caused" the action.Object
- parm additional information to serve as a
parameter to the action (the exact type
of this information is determined by the
subclass).do_callback(sub_arctic.input.event)
public loaded_image[] state_looks()
public loaded_image get_state_look(int indx)
public void set_state_look(int indx, loaded_image img)
int
- index the state being modifiedint
- loaded_image img the new image to use for this statepublic loaded_image[] transition_looks()
public loaded_image get_transition_look(int indx)
int
- indx the state transition of interestpublic void set_transition_look(int indx, loaded_image img)
int
- indx the index of the transition to be modifiedloaded_image
- img the new image to use for that transitionpublic void set_looks(loaded_image[] st_looks, loaded_image[] trans_looks)
loaded_image[]
- st_looks the looks for the states.loaded_image[]
- trans_looks the looks for the transitions.public callback_object callback_obj()
public void set_callback_obj(callback_object cb)
callback_object
- the new receiver of callbacksprotected void calc_size()
public boolean press(event evt, java.lang.Object user_info)
event
- evt the event to be dispatched.Object
- user_info the object passed to the pick_collector at pick
time.public boolean release(event evt, java.lang.Object user_info)
event
- evt the event to be dispatched.Object
- user_info the object passed to the pick_collector at pick
time.public boolean inout_drag_start(event evt, boolean starts_inside, java.lang.Object user_info)
event
- evt the event to be dispatchedboolean
- starts_inside true if the drag starts inside the objectObject
- user_info the object passed to the inout_drag agent
when this object came into the focus set.public boolean inout_drag_enter(event evt, java.lang.Object user_info)
event
- evt the event to be dispatchedObject
- user_info the object passed to the inout_drag agent when
this object came into the focus set.public boolean inout_drag_exit(event evt, java.lang.Object user_info)
event
- evt the event to be dispatched.Object
- user_info the object passed to the inout_drag agent when
this object came into the focus set.public int first_callback_num()
public int last_callback_num()
public void do_callback(event evt)
event
- evt the event causing the callbackpublic boolean inout_drag_end(event evt, boolean ended_inside, java.lang.Object user_info)
event
- evt the event to be dispatched.boolean
- ended_inside true if the drag ended inside the object.Object
- user_info the object passed to the inout_drag agent
when this object came into the focus set.protected void draw_self_local(drawable d)
drawable
- d the surface to draw the object on
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |