|
|||||||||
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.oneline_text_display
Single line text displayer. This class displays a single line of text with selection point or area in a fashion suitable for a text edit interactor. Selection positions in strings refer to the spaces before the characters (numbered from 0). So for example a selection from 0 to 0 places the cursor before the first character (the character at index 0) while a selection from 1 to 2 selects the second character (the character at index 1).
Field Summary | |
protected color_pair |
_colors
The color pair currently being used to display the text and background of the object. |
protected int |
_end_of_selection
End of current selection. |
protected java.awt.Font |
_font
Font that interactor displays in |
protected int |
_h_spacing
Horizontal spacing |
protected java.awt.FontMetrics |
_metric
Cached font metrics object for the current font |
protected int |
_start_of_selection
Start of current selection. |
protected java.lang.String |
_text
String currently being displayed. |
protected int |
_v_spacing
Vertical spacing around the text (both top and bottom have this space) |
protected int |
_x_adjust
Adjustment factor to keep the current selection (or part of it) inside the bounds of the object. |
static int |
BOXED
Constant used to store boxed flag within interactor flags |
protected boolean |
have_focus
|
static int |
NO_SELECTION
Constant for a special selection position used to denote that there is no selection. |
static int |
SELECT_END
Constant used to denote that the selection as at the end of the text. |
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 | |
oneline_text_display(int xv,
int yv,
int wv,
java.lang.String init_str,
java.awt.Font fnt,
boolean boxed)
Full constructor with explicit width |
|
oneline_text_display(int xv,
int yv,
java.lang.String init_str)
Constructor with default font and boxed status but explicit position |
|
oneline_text_display(int xv,
int yv,
java.lang.String init_str,
java.awt.Font fnt,
boolean boxed)
Full constructor where width is determined by initial string |
|
oneline_text_display(java.lang.String init_str)
Constructor with all the defaults and a size which we assume you are going to control either control explicitly or via constraints. |
Method Summary | |
boolean |
boxed()
Does the interactor have a box drawn around it |
color_pair |
colors()
This function retreives the currently color_pair being used for displaying this objects foreground and background colors. |
protected void |
draw_self_local(drawable d)
Draw the display. |
int |
end_of_selection()
End of current selection. |
void |
ensure_inside(int pos)
Compute the adjustment needed to make sure the given selection position (a character position, not a pixel position) is inside the object's display. |
java.awt.Font |
font()
Font that interactor displays in... |
int |
h_spacing()
This retrieves the horizontal spacing of this interactor. |
int |
intrinsic_constraints()
Declare that our height is intrinsically constrained |
void |
set_boxed(boolean bxv)
Set the flag indicating whether interactor is drawn with a surrounding box. |
void |
set_colors(color_pair p)
You can call this function to set a pair of colors that are used to display the text background and the text of this object. |
void |
set_font(java.awt.Font fnt)
Set font that interactor displays in |
void |
set_h_spacing(int n)
Set the horizontal spacing of this interactor. |
void |
set_selection(int start_loc,
int end_loc)
Set the current selection. |
void |
set_text(java.lang.String txt)
Set string displayed. |
void |
set_v_spacing(int n)
Set the vertical spacing of this interactor. |
int |
start_of_selection()
Start of current selection. |
java.lang.String |
text()
String currently being displayed. |
int |
v_spacing()
This retrieves the vertical spacing of this interactor. |
int |
x_adjust()
Adjustment factor to keep the current selection (or part of it) inside the bounds of the object. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected boolean have_focus
protected int _v_spacing
protected int _h_spacing
protected java.awt.FontMetrics _metric
protected java.awt.Font _font
protected color_pair _colors
protected java.lang.String _text
protected int _x_adjust
public static final int NO_SELECTION
public static final int SELECT_END
protected int _start_of_selection
protected int _end_of_selection
public static final int BOXED
Constructor Detail |
public oneline_text_display(int xv, int yv, int wv, java.lang.String init_str, java.awt.Font fnt, boolean boxed)
int
- xv the x coordinate of this objectint
- yv the y coordinate of this objectint
- wv the width of this objectString
- init_str the initial string to displayFont
- fnt the font to useboolean
- boxed true if you want a box around the objectpublic oneline_text_display(int xv, int yv, java.lang.String init_str, java.awt.Font fnt, boolean boxed)
int
- xv the x coordinate of this objectint
- yv the y coordinate of this objectString
- init_str the initial string to displayFont
- fnt the font to useboolean
- boxed true if you want a box around the objectpublic oneline_text_display(int xv, int yv, java.lang.String init_str)
int
- xv the x coordinate value of this objectint
- yv the y coordinate value of this objectString
- init_str the initial string to displaypublic oneline_text_display(java.lang.String init_str)
the
- initial string to displayMethod Detail |
public int v_spacing()
public void set_v_spacing(int n)
int
- n new amount of vertical space.public int h_spacing()
public void set_h_spacing(int n)
int
- n new amount of horizontal space.public java.awt.Font font()
public void set_font(java.awt.Font fnt)
Font
- fnt the new font (use null for the system default font)public color_pair colors()
public void set_colors(color_pair p)
color_pair
- p the new color pair to use for this interactor (null
means to use the system defualt colors)public java.lang.String text()
public void set_text(java.lang.String txt)
String
- text the new stringpublic int x_adjust()
public void ensure_inside(int pos)
int
- pos selection position that should be inside the display.public int start_of_selection()
public int end_of_selection()
public void set_selection(int start_loc, int end_loc)
int
- start_loc the starting location of the selectionint
- end_loc the ending location of the selectionpublic boolean boxed()
public void set_boxed(boolean bxv)
boolean
- bxv true if you want a box around this object, false
otherwisepublic int intrinsic_constraints()
protected void draw_self_local(drawable d)
drawable
- d the surface to draw this object on
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |