Tesseract 3.01
com::google::scrollview::ui::SVWindow Class Reference

Inherits JFrame.

List of all members.

Public Member Functions

void brush (int red, int green, int blue)
void brush (int red, int green, int blue, int alpha)
void clear ()
void createImage (String internalName, int width, int height, int bitsPerPixel)
void createPolyline (int length)
void drawPolyline ()
 SVWindow (String name, int hash, int posX, int posY, int sizeX, int sizeY, int canvasSizeX, int canvasSizeY)
void addMessageBox ()
void setStrokeWidth (float width)
void drawEllipse (int x, int y, int width, int height)
void drawImage (String internalName, int x_pos, int y_pos)
void drawLine (int x1, int y1, int x2, int y2)
void drawRectangle (int x1, int y1, int x2, int y2)
void drawText (int x, int y, String text)
void pen (int red, int green, int blue)
void pen (int red, int green, int blue, int alpha)
void textAttributes (String font, int pixelSize, boolean bold, boolean italic, boolean underlined)
void zoomRectangle (int x1, int y1, int x2, int y2)
void update ()
void addMenuBarItem (String parent, String name, int id, boolean checked)
void addMenuBarItem (String parent, String name)
void addMenuBarItem (String parent, String name, int id)
void addMessage (String message)
void showInputDialog (String msg, String def, int id, SVEventType evtype)
void showInputDialog (String msg)
void showYesNoDialog (String msg)
void addPopupMenuItem (String parent, String name)
void addPopupMenuItem (String parent, String name, int cmdEvent, String value, String desc)
void destroy ()
void openImage (String filename)

Public Attributes

int hash
SVPopupMenu svPuMenu = null
PCanvas canvas

Static Public Attributes

static final double SCALING_FACTOR = 2
static int nrWindows = 0

Package Attributes

PLayer layer
Color currentPenColor
Color currentBrushColor
Font currentFont
BasicStroke stroke = new BasicStroke(0.5f)

Detailed Description

The SVWindow is the top-level ui class. It should get instantiated whenever the user intends to create a new window. It contains helper functions to draw on the canvas, add new menu items, show modal dialogs etc.

Author:
wanke@google.com

Constructor & Destructor Documentation

com::google::scrollview::ui::SVWindow::SVWindow ( String  name,
int  hash,
int  posX,
int  posY,
int  sizeX,
int  sizeY,
int  canvasSizeX,
int  canvasSizeY 
) [inline]

Construct a new SVWindow and set it visible.

Parameters:
nameTitle of the window.
hashUnique internal representation. This has to be the same as defined by the client, as they use this to refer to the windows.
posXX position of where to draw the window (upper left).
posYY position of where to draw the window (upper left).
sizeXThe width of the window.
sizeYThe height of the window.
canvasSizeXThe canvas width of the window.
canvasSizeYThe canvas height of the window.

Member Function Documentation

void com::google::scrollview::ui::SVWindow::addMenuBarItem ( String  parent,
String  name,
int  id,
boolean  checked 
) [inline]

Adds a checkbox entry to the menubar, c.f. SVMenubar.add(...)

void com::google::scrollview::ui::SVWindow::addMenuBarItem ( String  parent,
String  name 
) [inline]

Adds a submenu to the menubar, c.f. SVMenubar.add(...)

void com::google::scrollview::ui::SVWindow::addMenuBarItem ( String  parent,
String  name,
int  id 
) [inline]

Adds a new entry to the menubar, c.f. SVMenubar.add(...)

void com::google::scrollview::ui::SVWindow::addMessage ( String  message) [inline]

Add a message to the message box.

void com::google::scrollview::ui::SVWindow::addMessageBox ( ) [inline]

Convenience function to add a message box to the window which can be used to output debug information.

void com::google::scrollview::ui::SVWindow::addPopupMenuItem ( String  parent,
String  name 
) [inline]

Adds a submenu to the popup menu, c.f. SVPopupMenu.add(...)

void com::google::scrollview::ui::SVWindow::addPopupMenuItem ( String  parent,
String  name,
int  cmdEvent,
String  value,
String  desc 
) [inline]

Adds a new menu entry to the popup menu, c.f. SVPopupMenu.add(...)

void com::google::scrollview::ui::SVWindow::brush ( int  red,
int  green,
int  blue,
int  alpha 
) [inline]

Set the brush to an RGBA color

void com::google::scrollview::ui::SVWindow::brush ( int  red,
int  green,
int  blue 
) [inline]

Set the brush to an RGB color

void com::google::scrollview::ui::SVWindow::clear ( ) [inline]

Erase all content from the window, but do not destroy it.

void com::google::scrollview::ui::SVWindow::createImage ( String  internalName,
int  width,
int  height,
int  bitsPerPixel 
) [inline]

Start setting up a new image. The server will now expect image data until the image is complete.

Parameters:
internalNameThe unique name of the new image
widthImage width
heightImage height
bitsPerPixelThe bit depth (currently supported: 1 (binary) and 32 (ARGB))
void com::google::scrollview::ui::SVWindow::createPolyline ( int  length) [inline]

Start setting up a new polyline. The server will now expect polyline data until the polyline is complete.

Parameters:
lengthnumber of coordinate pairs
void com::google::scrollview::ui::SVWindow::destroy ( ) [inline]

Destroys a window.

void com::google::scrollview::ui::SVWindow::drawEllipse ( int  x,
int  y,
int  width,
int  height 
) [inline]

Draw an ellipse at (x,y) with given width and height, using the current stroke, the current brush color to fill it and the current pen color for the outline.

void com::google::scrollview::ui::SVWindow::drawImage ( String  internalName,
int  x_pos,
int  y_pos 
) [inline]

Draw the image with the given name at (x,y). Any image loaded stays in memory, so if you intend to redraw an image, you do not have to use createImage again.

void com::google::scrollview::ui::SVWindow::drawLine ( int  x1,
int  y1,
int  x2,
int  y2 
) [inline]

Draw a line from (x1,y1) to (x2,y2) using the current pen color and stroke.

void com::google::scrollview::ui::SVWindow::drawPolyline ( ) [inline]

Draw the now complete polyline.

void com::google::scrollview::ui::SVWindow::drawRectangle ( int  x1,
int  y1,
int  x2,
int  y2 
) [inline]

Draw a rectangle given the two points (x1,y1) and (x2,y2) using the current stroke, pen color for the border and the brush to fill the interior.

void com::google::scrollview::ui::SVWindow::drawText ( int  x,
int  y,
String  text 
) [inline]

Draw some text at (x,y) using the current pen color and text attributes. If the current font does NOT support at least one character, it tries to find a font which is capable of displaying it and use that to render the text. Note: If the font says it can render a glyph, but in reality it turns out to be crap, there is nothing we can do about it.

void com::google::scrollview::ui::SVWindow::openImage ( String  filename) [inline]

Open an image from a given file location and store it in memory. Pro: Faster than createImage. Con: Works only on the local file system.

Parameters:
filenameThe path to the image.
void com::google::scrollview::ui::SVWindow::pen ( int  red,
int  green,
int  blue 
) [inline]

Set the pen color to an RGB value

void com::google::scrollview::ui::SVWindow::pen ( int  red,
int  green,
int  blue,
int  alpha 
) [inline]

Set the pen color to an RGBA value

void com::google::scrollview::ui::SVWindow::setStrokeWidth ( float  width) [inline]

Allows you to specify the thickness with which to draw lines, recantgles and ellipses.

Parameters:
widthThe new thickness.
void com::google::scrollview::ui::SVWindow::showInputDialog ( String  msg,
String  def,
int  id,
SVEventType  evtype 
) [inline]

Show a modal input dialog. The answer by the dialog is then send to the client, together with the associated menu id, as SVET_POPUP

Parameters:
msgThe text that is displayed in the dialog.
defThe default value of the dialog.
idThe associated commandId
evtypeThe event this is associated with (usually SVET_MENU or SVET_POPUP)
void com::google::scrollview::ui::SVWindow::showInputDialog ( String  msg) [inline]

Shows a modal input dialog to the user. The return value is automatically sent to the client as SVET_INPUT event (with command id -1).

Parameters:
msgThe text of the dialog.
void com::google::scrollview::ui::SVWindow::showYesNoDialog ( String  msg) [inline]

Shows a dialog presenting "Yes" and "No" as answers and returns either a "y" or "n" to the client.

Parameters:
msgThe text that is displayed in the dialog.
void com::google::scrollview::ui::SVWindow::textAttributes ( String  font,
int  pixelSize,
boolean  bold,
boolean  italic,
boolean  underlined 
) [inline]

Define how to display text. Note: underlined is not currently not supported

void com::google::scrollview::ui::SVWindow::update ( ) [inline]

Flush buffers and update display.

Only actually reacts if there are no more messages in the stack, to prevent the canvas from flickering.

void com::google::scrollview::ui::SVWindow::zoomRectangle ( int  x1,
int  y1,
int  x2,
int  y2 
) [inline]

Zoom the window to the rectangle given the two points (x1,y1) and (x2,y2), which must be greater than (x1,y1).


Member Data Documentation

The current color of the brush. It is used to draw the interior of primitives.

The system name of the current font we are using (e.g. "Times New Roman").

The current color of the pen. It is used to draw edges, text, etc.

A unique representation for the window, also known by the client. It is used when sending messages from server to client to identify him.

The top level layer we add our PNodes to (root node).

The total number of created Windows. If this ever reaches 0 (apart from the beginning), quit the server.

Constant defining the "speed" at which to zoom in and out.

BasicStroke com::google::scrollview::ui::SVWindow::stroke = new BasicStroke(0.5f) [package]

The stroke width to be used.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines