#include <scrollview.h>
Public Types | |
enum | Color { NONE, BLACK, WHITE, RED, YELLOW, GREEN, CYAN, BLUE, MAGENTA, AQUAMARINE, DARK_SLATE_BLUE, LIGHT_BLUE, MEDIUM_BLUE, MIDNIGHT_BLUE, NAVY_BLUE, SKY_BLUE, SLATE_BLUE, STEEL_BLUE, CORAL, BROWN, SANDY_BROWN, GOLD, GOLDENROD, DARK_GREEN, DARK_OLIVE_GREEN, FOREST_GREEN, LIME_GREEN, PALE_GREEN, YELLOW_GREEN, LIGHT_GREY, DARK_SLATE_GREY, DIM_GREY, GREY, KHAKI, MAROON, ORANGE, ORCHID, PINK, PLUM, INDIAN_RED, ORANGE_RED, VIOLET_RED, SALMON, TAN, TURQUOISE, DARK_TURQUOISE, VIOLET, WHEAT, GREEN_YELLOW } |
Public Member Functions | |
~ScrollView () | |
ScrollView (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size) | |
Calls Initialize with default argument for server_name_ & y_axis_reversed. More... | |
ScrollView (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size, bool y_axis_reversed) | |
Calls Initialize with default argument for server_name_. More... | |
ScrollView (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size, bool y_axis_reversed, const char *server_name) | |
Calls Initialize with all arguments given. More... | |
void | AddEventHandler (SVEventHandler *listener) |
Add an Event Listener to this ScrollView Window. More... | |
SVEvent * | AwaitEvent (SVEventType type) |
SVEvent * | AwaitEventAnyWindow () |
const char * | GetName () |
int | GetId () |
void | Image (struct Pix *image, int x_pos, int y_pos) |
void | UpdateWindow () |
void | Clear () |
void | Pen (Color color) |
void | Pen (int red, int green, int blue) |
void | Pen (int red, int green, int blue, int alpha) |
void | Brush (Color color) |
void | Brush (int red, int green, int blue) |
void | Brush (int red, int green, int blue, int alpha) |
void | TextAttributes (const char *font, int pixel_size, bool bold, bool italic, bool underlined) |
void | Line (int x1, int y1, int x2, int y2) |
void | Stroke (float width) |
void | Rectangle (int x1, int y1, int x2, int y2) |
void | Ellipse (int x, int y, int width, int height) |
void | Text (int x, int y, const char *mystring) |
void | Image (const char *image, int x_pos, int y_pos) |
void | SetCursor (int x, int y) |
void | DrawTo (int x, int y) |
void | SetVisible (bool visible) |
void | AlwaysOnTop (bool b) |
int | ShowYesNoDialog (const char *msg) |
char * | ShowInputDialog (const char *msg) |
void | AddMessageBox () |
void | AddMessage (const char *format,...) |
void | ZoomToRectangle (int x1, int y1, int x2, int y2) |
void | SendMsg (const char *msg,...) |
Send a message to the server, attaching the window id. More... | |
void | MenuItem (const char *parent, const char *name) |
void | MenuItem (const char *parent, const char *name, int cmdEvent) |
void | MenuItem (const char *parent, const char *name, int cmdEvent, bool flagged) |
void | PopupItem (const char *parent, const char *name) |
void | PopupItem (const char *parent, const char *name, int cmdEvent, const char *value, const char *desc) |
int | TranslateYCoordinate (int y) |
Static Public Member Functions | |
static void | Update () |
static void | Exit () |
static void | SendRawMessage (const char *msg) |
Private Member Functions | |
void | TransferBinaryImage (struct Pix *image) |
void | TransferGrayImage (struct Pix *image) |
void | Transfer32bppImage (struct Pix *image) |
void | Initialize (const char *name, int x_pos, int y_pos, int x_size, int y_size, int x_canvas_size, int y_canvas_size, bool y_axis_reversed, const char *server_name) |
Sets up a ScrollView window, depending on the constructor variables. More... | |
void | SendPolygon () |
void | SetEvent (SVEvent *svevent) |
void | Signal () |
char * | AddEscapeChars (const char *input) |
Static Private Member Functions | |
static void * | MessageReceiver (void *a) |
static SVNetwork * | GetStream () |
static void * | StartEventHandler (void *sv) |
Sits and waits for events on this window. More... | |
Private Attributes | |
SVEventHandler * | event_handler_ |
const char * | window_name_ |
int | window_id_ |
SVPolyLineBuffer * | points_ |
bool | y_axis_is_reversed_ |
bool | event_handler_ended_ |
int | y_size_ |
SVEvent * | event_table_ [SVET_COUNT] |
SVMutex * | mutex_ |
SVSemaphore * | semaphore_ |
Static Private Attributes | |
static int | nr_created_windows_ = 0 |
static int | image_index_ = 0 |
static SVNetwork * | stream_ = nullptr |
enum ScrollView::Color |
ScrollView::~ScrollView | ( | ) |
ScrollView::ScrollView | ( | const char * | name, |
int | x_pos, | ||
int | y_pos, | ||
int | x_size, | ||
int | y_size, | ||
int | x_canvas_size, | ||
int | y_canvas_size | ||
) |
Calls Initialize with default argument for server_name_ & y_axis_reversed.
ScrollView::ScrollView | ( | const char * | name, |
int | x_pos, | ||
int | y_pos, | ||
int | x_size, | ||
int | y_size, | ||
int | x_canvas_size, | ||
int | y_canvas_size, | ||
bool | y_axis_reversed | ||
) |
Calls Initialize with default argument for server_name_.
ScrollView::ScrollView | ( | const char * | name, |
int | x_pos, | ||
int | y_pos, | ||
int | x_size, | ||
int | y_size, | ||
int | x_canvas_size, | ||
int | y_canvas_size, | ||
bool | y_axis_reversed, | ||
const char * | server_name | ||
) |
Calls Initialize with all arguments given.
|
private |
void ScrollView::AddEventHandler | ( | SVEventHandler * | listener | ) |
Add an Event Listener to this ScrollView Window.
void ScrollView::AddMessage | ( | const char * | format, |
... | |||
) |
void ScrollView::AddMessageBox | ( | ) |
void ScrollView::AlwaysOnTop | ( | bool | b | ) |
SVEvent * ScrollView::AwaitEvent | ( | SVEventType | type | ) |
Block until an event of the given type is received. Note: The calling function is responsible for deleting the returned SVEvent afterwards!
SVEvent * ScrollView::AwaitEventAnyWindow | ( | ) |
void ScrollView::Brush | ( | Color | color | ) |
void ScrollView::Brush | ( | int | red, |
int | green, | ||
int | blue | ||
) |
void ScrollView::Brush | ( | int | red, |
int | green, | ||
int | blue, | ||
int | alpha | ||
) |
void ScrollView::Clear | ( | ) |
void ScrollView::DrawTo | ( | int | x, |
int | y | ||
) |
void ScrollView::Ellipse | ( | int | x, |
int | y, | ||
int | width, | ||
int | height | ||
) |
|
static |
|
inline |
|
inline |
|
inlinestaticprivate |
void ScrollView::Image | ( | struct Pix * | image, |
int | x_pos, | ||
int | y_pos | ||
) |
void ScrollView::Image | ( | const char * | image, |
int | x_pos, | ||
int | y_pos | ||
) |
|
private |
Sets up a ScrollView window, depending on the constructor variables.
void ScrollView::Line | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
void ScrollView::MenuItem | ( | const char * | parent, |
const char * | name | ||
) |
void ScrollView::MenuItem | ( | const char * | parent, |
const char * | name, | ||
int | cmdEvent | ||
) |
void ScrollView::MenuItem | ( | const char * | parent, |
const char * | name, | ||
int | cmdEvent, | ||
bool | flagged | ||
) |
|
staticprivate |
This is the main loop which handles the ScrollView-logic from the server to the client. It basically loops through messages, parses them to events and distributes it to the waiting handlers. It is run from a different thread and synchronizes via SVSync.
void ScrollView::Pen | ( | Color | color | ) |
void ScrollView::Pen | ( | int | red, |
int | green, | ||
int | blue | ||
) |
void ScrollView::Pen | ( | int | red, |
int | green, | ||
int | blue, | ||
int | alpha | ||
) |
void ScrollView::PopupItem | ( | const char * | parent, |
const char * | name | ||
) |
void ScrollView::PopupItem | ( | const char * | parent, |
const char * | name, | ||
int | cmdEvent, | ||
const char * | value, | ||
const char * | desc | ||
) |
void ScrollView::Rectangle | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
void ScrollView::SendMsg | ( | const char * | msg, |
... | |||
) |
Send a message to the server, attaching the window id.
|
private |
|
static |
Send a message to the server without a window id. Used for global events like exit().
void ScrollView::SetCursor | ( | int | x, |
int | y | ||
) |
|
private |
void ScrollView::SetVisible | ( | bool | visible | ) |
char * ScrollView::ShowInputDialog | ( | const char * | msg | ) |
int ScrollView::ShowYesNoDialog | ( | const char * | msg | ) |
|
private |
|
staticprivate |
Sits and waits for events on this window.
void ScrollView::Stroke | ( | float | width | ) |
void ScrollView::Text | ( | int | x, |
int | y, | ||
const char * | mystring | ||
) |
void ScrollView::TextAttributes | ( | const char * | font, |
int | pixel_size, | ||
bool | bold, | ||
bool | italic, | ||
bool | underlined | ||
) |
|
private |
|
private |
|
private |
int ScrollView::TranslateYCoordinate | ( | int | y | ) |
|
static |
void ScrollView::UpdateWindow | ( | ) |
void ScrollView::ZoomToRectangle | ( | int | x1, |
int | y1, | ||
int | x2, | ||
int | y2 | ||
) |
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |