sub_arctic.output
Class style

java.lang.Object
  |
  +--sub_arctic.output.style
Direct Known Subclasses:
motif_style

public abstract class style
extends java.lang.Object

This is an abstract class for generating the styles for a particular look and giving the toolkit information about the feel.


Constructor Summary
style()
           
 
Method Summary
abstract  loaded_image[] button_make_images(int width, int height, int x_spacing, int y_spacing, boolean menu)
          Construct the images for a button which is blank (so the app can draw on it).
abstract  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.
abstract  int button_x_shift()
          Return the amount of shift in x required for an image to placed on this style of button.
abstract  int button_y_shift()
          Return the amount of shift in y required for an image to placed on this style of button.
abstract  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.
abstract  loaded_image[] checkbox_make_transitions()
          Return a pair of transition images for the transitions from (img[0]) off to on and (img[1])on to off.
abstract  void color_scheme_changed()
          This function gets called to inform the style that the default_color_scheme has changed.
abstract  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.
abstract  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.
abstract  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.
abstract  loaded_image[] h_scrollbar_images()
          Construct three images for a horizontal scrollbar.
abstract  int h_scrollbar_minimum_thumb_size()
          This is the minimum width of a scrollbar thumb.
abstract  int h_scrollbar_thumb_shift()
          This method should return how far from the top edge the scrollbar is placed in this style.
abstract  loaded_image h_scrollbar_thumb(int w)
          This method should return an image of a thumb of a given width.
abstract  loaded_image make_menubar_images(java.util.Vector left, java.util.Vector right, 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.
abstract  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).
abstract  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.
abstract  loaded_image menu_item_separator(int w)
          Return the image of a menu separator.
abstract  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.
abstract  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.
abstract  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.
abstract  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.
abstract  loaded_image scale_background(int w)
          This function returns the image of a scale's background at a given width in pixels.
abstract  int scale_height()
          This returns the height of the scale in pixels.
abstract  int scale_thumb_shift()
          This returns the number of pixels the thumb is shifted down from the top of the scale.
abstract  loaded_image scale_thumb()
          This returns the image of the thumb of a scale.
abstract  int scale_unusable_width()
          This returns the amount of space on both ends which is used by the system for its beveling/color scheme.
abstract  loaded_image[] v_scrollbar_images()
          Construct three images for a vertical scrollbar.
abstract  int v_scrollbar_minimum_thumb_size()
          This is the minimum height of a scrollbar thumb.
abstract  int v_scrollbar_thumb_shift()
          This method should return how far from the left edge the scrollbar is placed in this style.
abstract  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
 

Constructor Detail

style

public style()
Method Detail

v_scrollbar_images

public abstract 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). All three of these images must be of the same width. Image #0 is the up image, image #1 is the down image and #2 is the background image (which will get tiled along the length of the scrollbar).
Returns:
loaded_image[] an array of 3 images for displaying a scrollbar in your style.

v_scrollbar_thumb_shift

public abstract 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.

v_scrollbar_thumb

public abstract 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.

v_scrollbar_minimum_thumb_size

public abstract 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).

h_scrollbar_images

public abstract 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). All three of these images must be of the same height. Image #0 is the left image, image #1 is the right image and #2 is the background image (which will get tiled along the length of the scrollbar).
Returns:
loaded_image[] an array of 2 images for displaying a scrollbar in your style.

h_scrollbar_thumb_shift

public abstract 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 h_scrollbar thumb down.

h_scrollbar_thumb

public abstract 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.

h_scrollbar_minimum_thumb_size

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

button_make_images

public abstract 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[] the resulting pair of images.

button_make_images

public abstract loaded_image[] button_make_images(int width,
                                                  int height,
                                                  int x_spacing,
                                                  int y_spacing,
                                                  boolean menu)
Construct the images for a button which is blank (so the app can draw on it).
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.
Returns:
loaded_image[] the resulting pair of images.

button_x_shift

public abstract 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.

button_y_shift

public abstract 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.

radio_button_make_images

public abstract 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.

radio_button_make_transitions

public abstract 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.
Returns:
loaded_image[] the resulting pair of images.

checkbox_make_images

public abstract 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.

checkbox_make_transitions

public abstract loaded_image[] checkbox_make_transitions()
Return a pair of transition 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 pair of transition images or null if no special transition effect is needed.

scale_background

public abstract 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.

scale_height

public abstract 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.

scale_thumb

public abstract loaded_image scale_thumb()
This returns the image of the thumb of a scale.
Returns:
loaded_image the image of the thumb.

scale_thumb_shift

public abstract 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.

scale_unusable_width

public abstract 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.

color_scheme_changed

public abstract 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.

menu_pop_right

public abstract 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.

menu_item_natural_size

public abstract 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 (this is 1/2 the total horizontal spacing).
int - y_spacing the amount of vertical spacing desired (this is 1/2 the total vertical spacing).
Returns:
Dimension the natural size of this menu item.

menu_item_image

public abstract 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.

menu_item_separator

public abstract 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.

drawable_prepare_rect

public abstract 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.
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

drawable_horizontal_space

public abstract 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)

drawable_vertical_space

public abstract 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)

make_menubar_images

public abstract loaded_image make_menubar_images(java.util.Vector left,
                                                 java.util.Vector right,
                                                 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_items 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_items 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.

menubar_image_shift

public abstract 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.