|
|||||||||
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.base_parent_interactor | +--sub_arctic.lib.listbox_display | +--sub_arctic.lib.listbox
This class implements a style-nuetral listbox. This is the input behavior which is matched with the output behavior of listbox_display.
All callbacks pass the currently focused on object as their data to the callback. Summary of the callback behavior of this object:
Field Summary | |
protected boolean |
_allow_dragging
This boolean should be set to true if you want your object to be able to drag objects out of its list. |
protected callback_object |
_callback_obj
This is the callback object for this listbox. |
protected int |
_double_click_delay
This is how many milliseconds to wait for a double click. |
protected int |
_double_click_loc
This is what the user originally clicked on, thus where we want to check to see if they are if we get a fast second click. |
protected transition |
_double_click_trans
This storage is used by the interactor to know if a double click might be coming. |
protected int |
_focused
This value is the value of the currently focused on object. |
protected int |
_last_valid
This variable is used to allow the system to know where the last valid object was before the user's mouse went "out of bounds." |
protected int |
_prev
This is the index of the object we were over the last time we got any input during a drag sequence. |
protected boolean |
_single_selection
This variable holds whether or not we are allowed to have multiple selections. |
protected int |
_start
This object is the current "starting point" for a drag interactor. |
protected int |
_synch_mask
This mask holds what the current set of synchronization constants are. |
static int |
DOUBLE_CLICK
This constant holds the callback number for double click. |
static int |
DRAG
This constant holds the callback number for a drag. |
protected int |
DRAG_DISTANCE
This is the distance that the user must drag the focused object in either X or Y before the system will send a drag message. |
protected listbox |
next
This variable determines who the next listbox is in the circularly linked list of listboxes we are synchronizing together. |
static int |
SINGLE_CLICK_FINAL
This constant holds the callback number for a a single click. |
static int |
SINGLE_CLICK_PENDING
This constant holds the callback number for a tentative first click action. |
static int |
SYNCH_CONTENT
This use of this constant means that listboxes in this group will have their content synchronized. |
static int |
SYNCH_FOCUSED
This use of this constant means that listboxes in this group will have their focused objects synchronized. |
protected boolean |
synch_in_progress
This boolean is true when we are in the process of performing a synchronization activity. |
static int |
SYNCH_SELECTION
This use of this constant means that listboxes in this group will have their selections synchronized. |
static int |
SYNCH_X_COORD
This use of this constant means that listboxes in this group will have their displayed x coordinates synchronized. |
static int |
SYNCH_Y_COORD
This use of this constant means that listboxes in this group will have their displayed y coordinates synchronized. |
Fields inherited from class sub_arctic.lib.listbox_display |
_child_display,
_display_parent,
_external_h_scrollbar,
_external_v_scrollbar,
_horiz,
_horiz_status,
_vert,
_vert_status,
SCROLLBAR_ALWAYS,
SCROLLBAR_AS_NECESSARY,
SCROLLBAR_NEVER |
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 | |
listbox(int w,
int h,
boolean s,
callback_object co)
Construct a listbox of a given size. |
Method Summary | |
void |
add_to_group(listbox l)
Add this listbox to a group of listboxes which have (possibly) synchronized input and output. |
boolean |
allow_dragging()
Retreive the current state of draggability. |
callback_object |
callback_obj()
Retreive the callback object for this listbox. |
protected void |
double_click_hook(event evt,
java.lang.Object user_info)
This function is called by the listbox if it detects a second click in a short period of time on the object just released on. |
boolean |
drag_end_multiple(event evt,
java.lang.Object user_info)
End a drag for a listbox which is in multiple selection mode. |
boolean |
drag_end_one(event evt,
java.lang.Object user_info)
End a drag for a listbox which is in single selection mode. |
boolean |
drag_end(event evt,
java.lang.Object user_info)
End a drag. |
boolean |
drag_feedback_multiple(event evt,
java.lang.Object user_info)
Continue a drag for a listbox which is in multiple selection mode. |
boolean |
drag_feedback_one(event evt,
java.lang.Object user_info)
Continue a drag for a listbox which is in single selection mode. |
boolean |
drag_feedback(event evt,
java.lang.Object user_info)
Continue a drag. |
protected void |
drag_hook(event evt,
java.lang.Object user_info)
This function is called by the listbox code when it detects that the currently focused item has been pressed on. |
boolean |
drag_ready(int local_x,
int local_y)
This function is called to determine if a drag is now beginning. |
boolean |
drag_start_multiple(event evt,
java.lang.Object user_info)
Start a drag for a listbox which is in multiple selection mode. |
boolean |
drag_start_one(event evt,
java.lang.Object user_info)
Start a drag for a listbox which is in single selection mode. |
boolean |
drag_start(event evt,
java.lang.Object user_info)
Start a drag. |
protected listbox |
find_sibling_of(listbox target)
This is a utility function which finds the object in a linked list which points to some target listbox. |
int |
first_callback_num()
First valid callback code |
list_element |
focused_raw()
Return the currently focused on object as a list_element. |
java.lang.Object |
focused()
Return the currently focused on object. |
int |
index_for_event(event evt)
This function can derive an index position of a list_element from an event in this object's coordinate system. |
int |
last_callback_num()
Last valid callback code |
void |
pick(int pt_x,
int pt_y,
pick_collector pick_list)
We don't allow ourselves to ever be picked directly. |
boolean |
press(event evt,
java.lang.Object user_info)
Handle the mouse button being depressed on our area. |
boolean |
release(event evt,
java.lang.Object user_info)
Handle the mouse button being released on our area. |
void |
remove_from_group()
This function will cause a listbox to be removed from the group it is currently in and return to its own group (of one). |
void |
set_allow_dragging(boolean a)
Set the current state of dragging. |
void |
set_callback_obj(callback_object co)
Set the callback object for this listbox. |
void |
set_contents(java.util.Vector contents)
If the user is in the middle of a double click and the contents change we don't want the double click to happen. |
void |
set_focused(int indx)
This function sets the focused on object to a given object index. |
void |
set_scrolled_x(int x)
We override this function to allow synchronization of the listboxes. |
void |
set_scrolled_y(int y)
We override this function to allow synchronization of the listboxes. |
void |
set_selected_by_index(java.util.Vector selected)
We override this method to make sure that we keep the listbox selection state synchronized. |
void |
set_selected(java.util.Vector selected)
We override the set selected method so we can synchronize listboxes. |
void |
set_single_selection(boolean s)
This function changes the selection mode for this object. |
void |
set_synch_mask(int mask)
Set the synchronization mask to a new value. |
protected void |
single_click_final_hook(event evt)
This function is called when the listbox is sure that no further click is forthcoming and that the callback code for the SINGLE_CLICK_FINAL can be safely called. Most users shouldn't need to override this method, as they can put their code to handle the single click in the callback object. The object passed as the parameter to the callback function when this callback is run is the currently focused on object. |
protected void |
single_click_pending_hook(event evt)
This function is called when the user clicks the mouse button on an item. |
boolean |
single_selection()
Return whether or not we are only allowing single selections. |
int |
synch_mask()
Retreive the current mask of synchronization values. |
void |
time_expired(event evt)
This method gets called when the double click timer expires. |
java.lang.String |
toString()
Generate a little different string for the listbox. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static final int SYNCH_CONTENT
public static final int SYNCH_SELECTION
public static final int SYNCH_FOCUSED
public static final int SYNCH_X_COORD
public static final int SYNCH_Y_COORD
protected int _synch_mask
protected boolean _single_selection
public static final int DOUBLE_CLICK
public static final int DRAG
public static final int SINGLE_CLICK_PENDING
The object passed to the callback function is the currently focused on item.
public static final int SINGLE_CLICK_FINAL
The object passed as the parameter to the callback function when this callback is run is the currently focused on object. The event field of the callback may be an animation event when this callback is run because this callback can be run not response to a user event, but rather a timeout.
protected transition _double_click_trans
protected int _double_click_delay
protected int _double_click_loc
protected listbox next
protected int _focused
protected int DRAG_DISTANCE
protected callback_object _callback_obj
protected boolean _allow_dragging
protected int _last_valid
protected int _start
protected int _prev
protected boolean synch_in_progress
Constructor Detail |
public listbox(int w, int h, boolean s, callback_object co)
int
- w the width of the listbox in pixelsint
- h the height of the listbox in pixelsboolean
- s true if you want to allow only single selectionscallback_object
- co the callback object for this listboxMethod Detail |
public int first_callback_num()
public int last_callback_num()
public boolean single_selection()
public void set_single_selection(boolean s)
boolean
- s true if you want to allow only single selectionspublic callback_object callback_obj()
public void set_callback_obj(callback_object co)
callback_object
- co the new callback objectpublic boolean allow_dragging()
public void set_allow_dragging(boolean a)
Although we are allowing you to not really handle a drag from the list (based on some condition of your choosing), users may become confused when they attempt to change their selection in the listbox and nothing happens. This is because the state machine for doing selection is not "turned on" when the listbox is expecting you to respond to a DRAG callback.
boolean
- a the new state of draggingpublic java.lang.Object focused()
public list_element focused_raw()
public void set_focused(int indx)
int
- indx the index of the object that you wish to become the focuspublic int index_for_event(event evt)
event
- evt the event we are interested inpublic boolean drag_start(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_feedback(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_end(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_start_one(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_feedback_one(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_end_one(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_start_multiple(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_feedback_multiple(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean drag_end_multiple(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean press(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public boolean release(event evt, java.lang.Object user_info)
event
- evt the event in questionObject
- user_info (not used)public void pick(int pt_x, int pt_y, pick_collector pick_list)
int
- pt_x the x coordinate of the pointint
- pt_y the y coordinate of the pointpick_collector
- the object to put yourself in if you are pickedpublic java.lang.String toString()
public void add_to_group(listbox l)
listbox
- a listbox in the group you wish this listbox to be added toprotected listbox find_sibling_of(listbox target)
listbox
- target the listbox whose sibling you want to findpublic void remove_from_group()
public int synch_mask()
public void set_synch_mask(int mask)
int
- mask the new synchronization maskpublic void set_selected(java.util.Vector selected)
Vector
- selected the objects which are now to be selectedpublic void set_selected_by_index(java.util.Vector selected)
Vector
- selected a vector of Integer objectspublic void set_scrolled_y(int y)
int
- y the coordinate to displaypublic void set_scrolled_x(int x)
int
- x the x coordinate to displaypublic void time_expired(event evt)
event
- e the animation event which caused time to expireprotected void double_click_hook(event evt, java.lang.Object user_info)
The user should be aware that the default behavior of this code is to run a callback (DOUBLE_CLICK). If you override this method, you will not get the call to the callback unless you call super. Further, most users shouldn't need to override this as the can put their response in the callback object.
When you get a double click the parameter passed to the callback function is the element which was double clicked on. It is returned via the convert_to_object() part of the list_element interface.
event
- evt the event in questionObject
- user_info (not currently used)protected void drag_hook(event evt, java.lang.Object user_info)
The user should be aware that the default behavior of this code is to run a callback (DRAG). If you override this method, you will not get the call to the callback unless you call super. Further, most users shouldn't need to override this as the can put their response in the callback object.
When you get a drag callback the parameter passed to the callback function is the element which was dragged. It is returned via the convert_to_object() part of the list_element interface.
event
- evt the event in questionObject
- user_info (not currently used)public void set_contents(java.util.Vector contents)
Vector
- contents the new contents of this object (all the objects in this vector must be list_elements)protected void single_click_final_hook(event evt)
Most users shouldn't need to override this method, as they can put their code to handle the single click in the callback object.
The object passed as the parameter to the callback function when this callback is run is the currently focused on object. The event field of the callback may be animation event if this callback is run in response to a timeout rather than a user input.
event
- evt the event causing this hook to be runprotected void single_click_pending_hook(event evt)
The parameter passed to callback function is the currently focused on item.
public boolean drag_ready(int local_x, int local_y)
int
- local_x current x coordinateint
- local_y current y coordinate
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |