|
|||||||||
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 | +--sub_arctic.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 java.awt.Font |
_font
Keep a hold the font for textual gables used by this object. |
protected loaded_image |
_picture
Store the picture (if any) we want on this button. |
protected java.lang.String |
_text
This variable holds the text we are about to render onto this button. |
protected int |
_x_border
Border around text horizontally |
protected int |
_y_border
Border around text vertically |
Fields inherited from class sub_arctic.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. |
|
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 where we expect you to position the object with constraints. |
|
button(loaded_image img,
callback_object call_obj)
Constructor based on a loaded_image and we assume you will use constraints to position it. |
|
button(java.lang.String label,
callback_object call_obj)
Constructor based on a textual label and we assume you will use constraints to position it. |
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. |
void |
draw_label(loaded_image[] img)
Draw either the text or the image of the object on the button. |
java.awt.Font |
font()
Retrieve this object's font. |
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()
This function computes the natural size of a button. |
loaded_image |
picture()
Return the picture we are using for this button. |
void |
set_autosize(boolean a)
Set the current state of the autosize variable. |
void |
set_font(java.awt.Font f)
Set the font for this object. |
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 current image to display on this button. |
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 this button to display a string. |
void |
set_x_border(int x)
Set the horizontal border. |
void |
set_y_border(int y)
Set the vertical border. |
void |
style_changed()
This function gets called to generate the images for this button based on the current style parameters. |
java.lang.String |
text()
Get the text of this button. |
int |
x_border()
Retrieve the horizontal border |
int |
y_border()
Retrieve the vertical border |
Methods inherited from class sub_arctic.lib.multi_button |
calc_size,
callback_obj,
cur_state,
do_callback,
draw_self_local,
first_callback_num,
get_state_look,
get_transition_look,
inout_drag_enter,
inout_drag_exit,
inout_drag_start,
last_callback_num,
next_state,
part_a,
press,
release,
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 int _x_border
protected int _y_border
protected java.awt.Font _font
protected java.lang.String _text
protected loaded_image _picture
protected boolean _autosize
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(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(java.lang.String label, callback_object call_obj)
String
- label the text to draw on the buttoncallback_object
- call_obj the callback object.Method Detail |
public int x_border()
public void set_x_border(int x)
int
- x new amount of horizontal border.public int y_border()
public void set_y_border(int y)
int
- y new amount of vertical border.public java.awt.Font font()
public void set_font(java.awt.Font f)
Font
- f the new font to use on this objectpublic 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 void style_changed()
public void draw_label(loaded_image[] img)
loaded_image[]
- img the base images to draw onpublic 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 |