sub_arctic.output
Class motif_style

java.lang.Object
  |
  +--sub_arctic.output.style
        |
        +--sub_arctic.output.motif_style

public class motif_style
extends style

This is an implementation for generating the styles for a motifish look and feel.


Field Summary
protected static loaded_image _check
           
protected static int bevel_start_angle
          This is the number of degrees of offset for this beveling of circles.
protected static int[] check_data
           
protected static int check_height
           
protected static int check_width
           
protected static int motif_radio_button_size
          We like motif images at 15 pixels x 15 pixels.
protected  int motif_scale_height
          This is how tall we want our scales to be.
protected  int motif_scale_thumb_shift
          This is how far to shift the thumb.
protected  int motif_scale_thumb_width
          This is how big we want our thumbs to be.
 
Method Summary
 void bevel_circle(loaded_image img, boolean up, color_scheme s)
          Bevel a circle for use with radio buttons.
static void bevel_menu_icon(loaded_image img, int x_offset, int y_offset, int w, int h, boolean up, color_scheme s)
          Bevel a down triangle for the menu icon.
 void bevel_pullright_triangle(drawable d, boolean up, int x, int y, color_scheme s)
          Bevel a triangle for the pullright menu icon.
static void bevel_rect(loaded_image img, boolean raised, boolean base, boolean one_pix, boolean left, boolean right, boolean top, boolean bottom, color_scheme colors)
           
static void bevel_triangle_down(loaded_image img, color_scheme s)
          Bevel a down triangle for the bottom of a scrollbar.
static void bevel_triangle_left(loaded_image img, color_scheme s)
          Bevel a left triangle for the left of a scrollbar.
static void bevel_triangle_right(loaded_image img, color_scheme s)
          Bevel a right triangle for the right of a scrollbar.
static void bevel_triangle_up(loaded_image img, color_scheme s)
          Bevel an up triangle for the top of a scrollbar.
 loaded_image[] button_make_images(int width, int height, int x_spacing, int y_spacing, boolean menu)
          Construct the images for a blank button.
 loaded_image[] button_make_images(java.lang.String label, java.awt.Font font, int x_spacing, int y_spacing, boolean menu)
          Construct the images for a button.
 int button_x_shift()
          Return the amount of shift in x required for an image to placed on this style of button.
 int button_y_shift()
          Return the amount of shift in y required for an image to placed on this style of button.
static void calculate_check()
           
static loaded_image check()
           
 loaded_image[] checkbox_make_images()
          Return a pair of images which give the off (img[0]) and the on (img[1]) appearance for a checkbox.
 loaded_image[] checkbox_make_transitions()
          Return a pair of transitions images for the transitions from (img[0]) off to on and (img[1])on to off.
 void color_scheme_changed()
          This function gets called to inform the style that the default_color_scheme has changed.
 int drawable_horizontal_space()
          This function is called to allow the caller to determine what area of the drawable has been prepared by the style.
 void drawable_prepare_rect(drawable d, int x, int y, int w, int h, boolean up, boolean fill)
          This function gets called to force the style to set up a rectangular area of a drawable.
 int drawable_vertical_space()
          This function is called to allow the caller to determine what area of the drawable has been prepared by the style.
 loaded_image[] h_scrollbar_images()
          Construct three images for a horizontal scrollbar.
 int h_scrollbar_minimum_thumb_size()
          This is the minimum thumb width of a scrollbar.
 int h_scrollbar_thumb_shift()
          This method should return how far from the top edge the scrollbar is placed in this style.
 loaded_image h_scrollbar_thumb(int w)
          This method should return an image of a thumb of a given width.
 loaded_image make_menubar_images(java.util.Vector left_items, java.util.Vector right_items, int width, java.awt.Font font, java.util.Vector left_hotspots, java.util.Vector right_hotspots)
          This is the most complex of the style functions, and the one that certainly leaves the most room for improvement.
 loaded_image[] menu_item_image(java.lang.String s, java.awt.Font f, int x_spacing, int y_spacing, int w, int h, boolean pullright)
          This function creates the two images of a menu up (unhighlighted) & down (highlighted).
 java.awt.Dimension menu_item_natural_size(java.lang.String s, java.awt.Font f, int x_spacing, int y_spacing)
          This function determines the "natural" size of menu item of text.
 loaded_image menu_item_separator(int w)
          Return the image of a menu separator.
 boolean menu_pop_right()
          This function determines if a menu pops to the right and down from an menu button interactor or if it pops directly down.
 int menubar_image_shift()
          This parameter controls how far down the images resulting from a menubar should be shifted down (in their hotspot) to compensate for potential style system beveling.
 loaded_image[] radio_button_make_images()
          Return a pair of images which give the off (img[0]) and the on (img[1]) appearance for a radio button.
 loaded_image[] radio_button_make_transitions()
          Return a pair of transitions images for the transitions from (img[0]) off to on and (img[1])on to off.
 loaded_image scale_background(int w)
          This function returns the image of a scale's background at a given width in pixels.
 int scale_height()
          This returns the height of the scale in pixels.
 int scale_thumb_shift()
          This returns the number of pixels the thumb is shifted down from the top of the scale.
 loaded_image scale_thumb()
          This returns the image of the thumb of a scale.
 int scale_unusable_width()
          This returns the amount of space on both ends which is used by the system for its beveling/color scheme.
 loaded_image[] v_scrollbar_images()
          Construct three images for a vertical scrollbar.
 int v_scrollbar_minimum_thumb_size()
          This is the minimum height of a scrollbar thumb.
 int v_scrollbar_thumb_shift()
          This method should return how far from the left edge the scrollbar is placed in this style.
 loaded_image v_scrollbar_thumb(int h)
          This method should return an image of a thumb of a given height.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

check_width

protected static int check_width

check_data

protected static int[] check_data

check_height

protected static int check_height

_check

protected static loaded_image _check

bevel_start_angle

protected static int bevel_start_angle
This is the number of degrees of offset for this beveling of circles.

motif_radio_button_size

protected static int motif_radio_button_size
We like motif images at 15 pixels x 15 pixels.

motif_scale_height

protected int motif_scale_height
This is how tall we want our scales to be.

motif_scale_thumb_width

protected int motif_scale_thumb_width
This is how big we want our thumbs to be.

motif_scale_thumb_shift

protected int motif_scale_thumb_shift
This is how far to shift the thumb.
Method Detail

check

public static loaded_image check()

calculate_check

public static void calculate_check()

bevel_rect

public static void bevel_rect(loaded_image img,
                              boolean raised,
                              boolean base,
                              boolean one_pix,
                              boolean left,
                              boolean right,
                              boolean top,
                              boolean bottom,
                              color_scheme colors)

bevel_triangle_up

public static void bevel_triangle_up(loaded_image img,
                                     color_scheme s)
Bevel an up triangle for the top of a scrollbar.
Parameters:
loaded_image - img the image you want to put the triangle in (any contents of this rectangle are erased).
color_scheme - s the color scheme to use for the drawing.

bevel_triangle_down

public static void bevel_triangle_down(loaded_image img,
                                       color_scheme s)
Bevel a down triangle for the bottom of a scrollbar.
Parameters:
loaded_image - img the image you want to put the triangle in (any contents of this rectangle are erased).
color_scheme - s the color scheme to use for the drawing.

bevel_menu_icon

public static void bevel_menu_icon(loaded_image img,
                                   int x_offset,
                                   int y_offset,
                                   int w,
                                   int h,
                                   boolean up,
                                   color_scheme s)
Bevel a down triangle for the menu icon.
Parameters:
loaded_image - img the image you want to put the triangle in
int - x_offset the offset you want the icon at in X
int - y_offset the offset you want the icon at in Y
int - w the width of the icon you want
int - h the height of the icon you want
boolean - up true if you want this icon to appear raised
color_scheme - s the color scheme to use for the drawing

bevel_pullright_triangle

public void bevel_pullright_triangle(drawable d,
                                     boolean up,
                                     int x,
                                     int y,
                                     color_scheme s)
Bevel a triangle for the pullright menu icon.
Parameters:
drawable - d the surface to bevel on.
boolean - up true if you want this object to appear raised.
int - x x offset on the drawable.
int - y y offset on the drawable.
color_scheme - s the color scheme to bevel in.

bevel_triangle_left

public static void bevel_triangle_left(loaded_image img,
                                       color_scheme s)
Bevel a left triangle for the left of a scrollbar.
Parameters:
loaded_image - img the image you want to put the triangle in (any contents of this rectangle are erased).
color_scheme - s the color scheme to use for the drawing.

bevel_triangle_right

public static void bevel_triangle_right(loaded_image img,
                                        color_scheme s)
Bevel a right triangle for the right of a scrollbar.
Parameters:
loaded_image - img the image you want to put the triangle in (any contents of this rectangle are erased).
color_scheme - s the color scheme to use for the drawing

bevel_circle

public void bevel_circle(loaded_image img,
                         boolean up,
                         color_scheme s)
Bevel a circle for use with radio buttons. This code also inserts
Parameters:
loaded_image - img the image to put the circle in.
boolean - up whether to bevel this image in the "up position" (true) or the "down position" (false).
color_scheme - s the color scheme we are using.

v_scrollbar_images

public loaded_image[] v_scrollbar_images()
Construct three images for a vertical scrollbar. Vertical scrollbars in sub_arctic are assumed to be of fixed width (although this is really not true for motif). Image #0 is the up image, image #1 is the down image, #2 is the background image (which will get tiled along the length of the scrollbar) and #3 is the thumb. #0, #1, and #2 must be the same width and #3 be no larger than the other three.
Returns:
loaded_image[] an array of 3 images for displaying a scrollbar in your style
Overrides:
v_scrollbar_images in class style

v_scrollbar_thumb_shift

public int v_scrollbar_thumb_shift()
This method should return how far from the left edge the scrollbar is placed in this style.
Returns:
int the "shift" of the v_scrollbar thumb to the right
Overrides:
v_scrollbar_thumb_shift in class style

v_scrollbar_thumb

public loaded_image v_scrollbar_thumb(int h)
This method should return an image of a thumb of a given height.
Parameters:
int - h the height of the thumb in pixels
Returns:
loaded_image the thumb image.
Overrides:
v_scrollbar_thumb in class style

v_scrollbar_minimum_thumb_size

public int v_scrollbar_minimum_thumb_size()
This is the minimum height of a scrollbar thumb.
Returns:
the minimum usable size of a scrollbar thumb (in pixels)
Overrides:
v_scrollbar_minimum_thumb_size in class style

h_scrollbar_images

public loaded_image[] h_scrollbar_images()
Construct three images for a horizontal scrollbar. Horizontal scrollbars in sub_arctic are assumed to be of fixed height (although this is really not true for motif). Image #0 is the left image, image #1 is the right image, #2 is the background image (which will get tiled along the length of the scrollbar) and #3 is the thumb. #0, #1, and #2 must be the same width and #3 be no larger than the other three.
Returns:
loaded_image[] an array of 3 images for displaying a scrollbar in your style
Overrides:
h_scrollbar_images in class style

h_scrollbar_thumb_shift

public int h_scrollbar_thumb_shift()
This method should return how far from the top edge the scrollbar is placed in this style.
Returns:
int the "shift" of the v_scrollbar thumb to the right
Overrides:
h_scrollbar_thumb_shift in class style

h_scrollbar_thumb

public loaded_image h_scrollbar_thumb(int w)
This method should return an image of a thumb of a given width.
Parameters:
int - w the width of the thumb in pixels.
Returns:
loaded_image the resulting thumb image.
Overrides:
h_scrollbar_thumb in class style

h_scrollbar_minimum_thumb_size

public int h_scrollbar_minimum_thumb_size()
This is the minimum thumb width of a scrollbar.
Returns:
the minimum usable size of a scrollbar thumb (in pixels)
Overrides:
h_scrollbar_minimum_thumb_size in class style

button_make_images

public loaded_image[] button_make_images(java.lang.String label,
                                         java.awt.Font font,
                                         int x_spacing,
                                         int y_spacing,
                                         boolean menu)
Construct the images for a button. In the returned array, img 0 is the up and img 1 is the depressed (unhappy) appearance.
Parameters:
String - label the string for the button.
Font - the font to draw the button with.
int - x_spacing the amount of x border (appears on left and right).
int - y_spacing the amount of y border (appears on top and bottom).
boolean - menu true if you want the appearance of a menu button.
Returns:
loaded_image[] resulting array of 2 images.
Overrides:
button_make_images in class style

button_make_images

public loaded_image[] button_make_images(int width,
                                         int height,
                                         int x_spacing,
                                         int y_spacing,
                                         boolean menu)
Construct the images for a blank button.
Parameters:
int - width this is the usable width you desire for this button.
int - height this is the usable height you desire for this button.
int - x_spacing the amount of x border (appears on left and right).
int - y_spacing the amount of y border (appears on top and bottom).
boolean - menu true if you want the appearance of a menu button
Overrides:
button_make_images in class style

button_x_shift

public int button_x_shift()
Return the amount of shift in x required for an image to placed on this style of button. This does NOT including the x spacing but rather only the pixels that the button code isn't normally allowed to use (the beveling).
Returns:
int the amount to shift the image on a button in x
Overrides:
button_x_shift in class style

button_y_shift

public int button_y_shift()
Return the amount of shift in y required for an image to placed on this style of button. This does NOT including the y spacing but rather only the pixels that the button code isn't normally allowed to use (the beveling).
Returns:
int the amount to shift the image on a button in y
Overrides:
button_y_shift in class style

radio_button_make_images

public loaded_image[] radio_button_make_images()
Return a pair of images which give the off (img[0]) and the on (img[1]) appearance for a radio button. Note: For some styles, this is the same appearance as a checkbox. These images should be the same size.
Returns:
loaded_image[] an array of 2 images for the off and on look of a radio button.
Overrides:
radio_button_make_images in class style

radio_button_make_transitions

public loaded_image[] radio_button_make_transitions()
Return a pair of transitions images for the transitions from (img[0]) off to on and (img[1])on to off. A style may return null here there will be no special transition used.
Overrides:
radio_button_make_transitions in class style

checkbox_make_images

public loaded_image[] checkbox_make_images()
Return a pair of images which give the off (img[0]) and the on (img[1]) appearance for a checkbox. Note: For some styles, this is the same appearance as a radiobutton. These images should be the same size.
Returns:
loaded_image[] an array of 2 images for the off and on look of a checkbox
Overrides:
checkbox_make_images in class style

checkbox_make_transitions

public loaded_image[] checkbox_make_transitions()
Return a pair of transitions images for the transitions from (img[0]) off to on and (img[1])on to off. A style may return null here there will be no special transition used.
Returns:
loaded_image[] resulting array of 2 images.
Overrides:
checkbox_make_transitions in class style

color_scheme_changed

public void color_scheme_changed()
This function gets called to inform the style that the default_color_scheme has changed. This is to allow the style to do any necessary recalculation of images based on the new color_scheme before interactors become notified that there is a new color_scheme.
Overrides:
color_scheme_changed in class style

drawable_prepare_rect

public void drawable_prepare_rect(drawable d,
                                  int x,
                                  int y,
                                  int w,
                                  int h,
                                  boolean up,
                                  boolean fill)
This function gets called to force the style to set up a rectangular area of a drawable. The caller is requesting that the drawable be prepared for further drawing by caller. This is useful interactors which do their drawing in draw_self_local() and/or people wishing to implement new interactors which can "fit in" with the style.
Parameters:
drawable - d the drawable to prepare. It assumed that the style will be called before the caller does his drawing, so the style can and should fill the background.
int - x the x coordinate of the top left corner of the area to prepare.
int - y the y coordinate of the top left corner of the area to prepare.
int - w the width of the area to prepare.
int - h the height of the area of prepare.
boolean - up if this is true the style may draw this area raised, if this is false the style may draw this area lowered. The style is under no obligation to follow this hint.
boolean - fill true if the style system should fill the background.
Overrides:
drawable_prepare_rect in class style

drawable_horizontal_space

public int drawable_horizontal_space()
This function is called to allow the caller to determine what area of the drawable has been prepared by the style.
Returns:
int the amount of horizontal space used by the style (XXX assumes left/right symmetry)
Overrides:
drawable_horizontal_space in class style

drawable_vertical_space

public int drawable_vertical_space()
This function is called to allow the caller to determine what area of the drawable has been prepared by the style.
Returns:
int the amount of vertical space used by the style (XXX assumes up/down symmetry)
Overrides:
drawable_vertical_space in class style

scale_background

public loaded_image scale_background(int w)
This function returns the image of a scale's background at a given width in pixels.
Parameters:
int - w the width of the scale in pixels.
Returns:
loaded_image the image of the scale's background.
Overrides:
scale_background in class style

scale_height

public int scale_height()
This returns the height of the scale in pixels. We assume that scales are not resizable in height.
Returns:
int the height of the scale
Overrides:
scale_height in class style

scale_thumb

public loaded_image scale_thumb()
This returns the image of the thumb of a scale.
Returns:
loaded_image the image of the thumb
Overrides:
scale_thumb in class style

scale_thumb_shift

public int scale_thumb_shift()
This returns the number of pixels the thumb is shifted down from the top of the scale.
Returns:
int the amount of the shift of the thumb in y
Overrides:
scale_thumb_shift in class style

scale_unusable_width

public int scale_unusable_width()
This returns the amount of space on both ends which is used by the system for its beveling/color scheme. If you are using a 1 pixel bevel return 1 here.
Returns:
int the number of pixels to shift the display of the thumb to the right when doing the display
Overrides:
scale_unusable_width in class style

menu_pop_right

public boolean menu_pop_right()
This function determines if a menu pops to the right and down from an menu button interactor or if it pops directly down. Return true for the (mac style) pop to the right type and false for the (motif style) pop string down type.
Returns:
boolean true for pop-right false for pop-down
Overrides:
menu_pop_right in class style

menu_item_natural_size

public java.awt.Dimension menu_item_natural_size(java.lang.String s,
                                                 java.awt.Font f,
                                                 int x_spacing,
                                                 int y_spacing)
This function determines the "natural" size of menu item of text. Menu items can be made any width, but this expresses the natural size of the object. The style object may include extra space for interactors that are placed on the menu item.
Parameters:
String - s the string to display.
Font - f the font to display the text in.
int - x_spacing the amount of horizontal spacing desired.
int - y_spacing the amount of vertical spacing desired.
Returns:
Dimension the natural size of this menu item.
Overrides:
menu_item_natural_size in class style

menu_item_image

public loaded_image[] menu_item_image(java.lang.String s,
                                      java.awt.Font f,
                                      int x_spacing,
                                      int y_spacing,
                                      int w,
                                      int h,
                                      boolean pullright)
This function creates the two images of a menu up (unhighlighted) & down (highlighted). You must supply the width and height of the images you wish to create; use menu_item_natural_size() to determine the natural size of menu items. The style object is expected to observe the x_spacing and y_spacing arguments, even if this forces clipping or overdrawing to occur.
Parameters:
String - s the string to display.
Font - f the font to display the text in.
int - x_spacing the amount of horizontal spacing desired.
int - y_spacing the amount of vertical spacing desired.
int - w width of the image.
int - h height of the image.
boolean - pullright true if you want a notation for a pullright image on this menu item.
Returns:
loaded_image[] resulting array of 2 images.
Overrides:
menu_item_image in class style

menu_item_separator

public loaded_image menu_item_separator(int w)
Return the image of a menu separator. The style may choose to return a zero height object for this separator if it does not allow menu separators.
Returns:
loaded_image the image of the separator.
Overrides:
menu_item_separator in class style

make_menubar_images

public loaded_image make_menubar_images(java.util.Vector left_items,
                                        java.util.Vector right_items,
                                        int width,
                                        java.awt.Font font,
                                        java.util.Vector left_hotspots,
                                        java.util.Vector right_hotspots)
This is the most complex of the style functions, and the one that certainly leaves the most room for improvement. The caller of this function is requesting several things. First, an image to display for a menu bar of a given width. Second, a set of rectangles that tell the menubar infrastructure what regions of the menu bar are "hot." Finally, the caller is asking for a set of images that corresponds to the "depressed" images of each hotspt.

The caller supplies the style system with two vectors. Each vector must contain only strings or loaded_images. (If the loaded images are taller than the height of the font supplied, they will be clipped.) The caller is responsible for making sure the types of the objects are correct. The style system will create it set of hot spots and images with the first vector occupying the "normal" or left positions and the the second vector occupying the "special" or right positions. These vectors may not be null, although they may be empty.

Parameters:
Vector - left this should be a non-null (but possibly empty) vector of strings and images. Items in this vector will be replaced with loaded_images representing that items "down" image. These items will appear on the left of the menu bar, in the order supplied.
Vector - right this should be a non-null (but possibly empty) vector of strings and images. Items in this vector will be replaced with loaded_images representing that items "down" image. These items will appear on the right of the menubar in the order supplied (last in the Vector being the rightmost).
int - width width of the menubar in pixels (items which don't fit on the menubar will be clipped)
Font - font the font to use for rendering strings. If you have a menubar which has only images on it, the menu bar is still the height of this font.
Vector - left_hotspots the caller should pass a non-null but empty vector which will be filled in which Rectangle objects indicating the positions of the objects in the left vector on the returned image.
Vector - right_hotspots the caller should pass a non-null but empty vector which will be filled in which Rectangle objects indicating the positions of the objects in the right vector on the returned image.
Returns:
loaded_image the image of the menu bar at the selected width
Overrides:
make_menubar_images in class style

menubar_image_shift

public int menubar_image_shift()
This parameter controls how far down the images resulting from a menubar should be shifted down (in their hotspot) to compensate for potential style system beveling.
Returns:
int the number of pixels the depressed images should be shifted down in their hotspot when the button is depressed.
Overrides:
menubar_image_shift in class style