|
|||||||||
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.new_lib.multi_button | +--sub_arctic.new_lib.button
This class implements a button in the current style. By default, buttons are not resizable, they have an intrinsic size. You can use the method set_autosize(false) if you desire the button to be resizable to any size.
Field Summary | |
protected boolean |
_autosize
This is the storage for the autosize variable. |
protected int |
_natural_height
The natural height of a button. |
protected int |
_natural_width
The natural width of a button. |
protected loaded_image |
_picture
Icon associated with this button (or null if this is not an iconic button). |
protected static boolean |
_registration_done
Flag to arrange to execute register_resource_names() at most once. |
protected java.lang.String |
_text
The text associated with the label of this button (or null if this is not a labelled button). |
Fields inherited from class sub_arctic.new_lib.multi_button |
_callback_obj,
_cur_state,
_in_transition,
_state_looks,
_transition_looks,
BUTTON_ACTION_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 | |
button(int x,
int y,
loaded_image[] look,
callback_object call_obj)
Full constructor based on non-style supplied images. |
|
button(int x,
int y,
loaded_image img,
callback_object call_obj)
Constructor based on a loaded_image for use as an icon within a button. |
|
button(int x,
int y,
java.lang.String label,
callback_object call_obj)
Constructor based on a textual label. |
|
button(loaded_image[] look,
callback_object call_obj)
Constructor based on non-style supplied images and a default position (presumably the object will be positioned with constraints). |
|
button(loaded_image img,
callback_object call_obj)
Constructor based on a loaded_image for use as an icon within a button and assuming a default position (presumably this object will be positioned with constraints). |
|
button(java.lang.String label,
callback_object call_obj)
Constructor based on a textual label and default position (presumably the object will be positioned with constraints). |
Method Summary | |
boolean |
autosize()
Retrieve the current state of autosize. |
void |
do_action(int action_num,
event evt,
java.lang.Object parm)
Perform the (only) action associated with this interactor. |
protected void |
init_iconic_resources(loaded_image pic)
Create new stylized images based on an icon and autosized status. |
protected void |
init_label_resources(java.lang.String label)
Create new stylized images based on a label and autosized status. |
boolean |
inout_drag_end(event evt,
boolean ended_inside,
java.lang.Object user_info)
We need to override the end behavior of the multi-button to make sure we always end up in the right state. |
int |
intrinsic_constraints()
We override the intrinsic constraint function because sometimes we have intrinsic constraints (when autosize is on) and sometimes we don't. |
java.awt.Dimension |
natural_size()
Return the natural size of a button. |
loaded_image |
picture()
Icon associated with this button (or null if this is not an iconic button). |
static void |
register_resource_names()
Register the resource names associated with this class |
void |
set_autosize(boolean a)
Set the current state of the autosize variable. |
void |
set_intrinsic_size(int wv,
int hv)
We have to override how set_intrinsic_size works here, because sometimes we have an intrinsic size and sometimes we don't. |
void |
set_picture(loaded_image p)
Set the icon image that this button is built from. |
void |
set_raw_h(int h)
Trap calls to set_raw_h() which will change the height. |
void |
set_raw_w(int w)
Trap calls to set_raw_w() which will change the width. |
void |
set_text(java.lang.String l)
Set the text associated with the label of this button. |
java.lang.String |
text()
The text associated with the label of this button (or null if this is not a labelled button). |
Methods inherited from class sub_arctic.new_lib.multi_button |
calc_size,
callback_obj,
cur_state,
do_callback,
draw_self_local,
find_current_style,
first_callback_num,
get_state_look,
get_transition_look,
inout_drag_enter,
inout_drag_exit,
inout_drag_start,
last_callback_num,
new_look_configure,
next_state,
part_a,
press,
release,
restyle_look_resources,
set_callback_obj,
set_cur_state,
set_looks,
set_part_a,
set_raw_part_a,
set_state_look,
set_transition_look,
state_looks,
transition_looks |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected static boolean _registration_done
protected java.lang.String _text
protected loaded_image _picture
protected boolean _autosize
protected int _natural_width
protected int _natural_height
Constructor Detail |
public button(loaded_image[] look, callback_object call_obj)
loaded_image[]
- look the two images to display for this button.callback_object
- call_obj the object to run the callbacks on.public button(int x, int y, loaded_image[] look, callback_object call_obj)
int
- x the x position of the interactor.int
- y the y position of the interactor.loaded_image[]
- look the two images to display for this button.callback_object
- call_obj the object to run the callbacks on.public button(java.lang.String label, callback_object call_obj)
String
- label the text to draw on the button.callback_object
- call_obj the callback object.public button(int x, int y, java.lang.String label, callback_object call_obj)
int
- x the x position of the interactor.int
- y the y position of the interactor.String
- label the text to draw on the button.callback_object
- call_obj the callback object.public button(loaded_image img, callback_object call_obj)
loaded_image
- img the image to draw on the buttoncallback_object
- call_obj the callback object.public button(int x, int y, loaded_image img, callback_object call_obj)
int
- x the x position of the interactor.int
- y the y position of the interactor.loaded_image
- img the image to draw on the buttoncallback_object
- call_obj the callback object.Method Detail |
public static void register_resource_names()
protected void init_label_resources(java.lang.String label)
String
- label label string to create button images from.protected void init_iconic_resources(loaded_image pic)
loaded_image
- pic user supplied icon to create button images frompublic 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).multi_button.do_callback(sub_arctic.input.event)
public java.lang.String text()
public void set_text(java.lang.String l)
String
- l the new labelpublic loaded_image picture()
public void set_picture(loaded_image p)
loaded_image
- p the new picture to put on this button.public 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.public boolean autosize()
public void set_autosize(boolean a)
public int intrinsic_constraints()
public java.awt.Dimension natural_size()
public void set_intrinsic_size(int wv, int hv)
int
- wv the intrinsic width valueint
- hv the intrinsic height valuepublic void set_raw_w(int w)
int
- w the new width valuepublic void set_raw_h(int h)
int
- h the new height value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |