SUWorkspace Class Reference

Wrapper for a ShapeUp workspace. More...

#include <ShapeUpAPI.h>

Inheritance diagram for SUWorkspace:

SUObject List of all members.

Public Member Functions

 SUWorkspace ()
 SUWorkspace (SUHANDLE hWorkspace)
SUMap GetMapWindow ()
size_t GetThemeCount () const
SUTheme GetTheme (size_t index)
SUTheme GetSelectedTheme ()
SURecordset GetSelectedThemes ()
size_t GetSelectionCount ()
SUTheme CreateNewTheme (ShapeType type, const char *name)
SUTheme CreateNewThemeFromSelection (SUTheme source, const char *name)
bool BrowseTheme (const char *title, SUTheme &theme)
void GetBounds (SURectf &r)
void Log (const char *line)
bool IsActive ()
void Refresh ()
SUJavaScript LoadJavaScript (const char *file)
std::string GetComment ()
void SetComment (const char *comment)
bool RemoveTheme (SUTheme theme)
void SetSerialData (size_t byteCount, const void *bytes)
SUHANDLE AddDataPage (const char *name)
void ClearSelection ()

Detailed Description

A ShapeUp workspace manages a number of themes. These themes can contain point, line or polygon vector data, or raster images. Although the most common scenario is to have one workspace opened at a time, ShapeUp supports having multiple workspaces opened. Also keep in mind, there might not be a workspace at all.

Most hook functions supply a handle to the active workspace, or the workspace where the action takes place. These workspaces are not necessarily the same!

You may always query ShapeUp for workspaces using the ShapeUp_GetWorkspaceCount(), ShapeUp_GetWorkspace() and ShapeUp_GetActiveWorkspace() API functions.

Examples:

example_loadergpi.cpp, example_sudatapage.cpp, and example_sutoolbar.cpp.


Constructor & Destructor Documentation

SUWorkspace::SUWorkspace (  )  [inline]

Default constructor.

SUWorkspace::SUWorkspace ( SUHANDLE  hWorkspace  )  [inline]

Constructor.

Parameters:
hWorkspace is a handle to a ShapeUp workspace.
See also:
ShapeUp_GetWorkspace(), ShapeUp_GetWorkspaceCount(), ShapeUp_GetActiveWorkspace()


Member Function Documentation

SUMap SUWorkspace::GetMapWindow (  )  [inline]

Queries the workspace for its map window.

Returns:
A handle to a ShapeUp map window.
See also:
SUMap, Workspace_GetMapWindow()

size_t SUWorkspace::GetThemeCount (  )  const [inline]

Retrieves the number of themes currently in this workspace.

Returns:
The theme count.
See also:
SUTheme, Workspace_GetThemeCount()

SUTheme SUWorkspace::GetTheme ( size_t  index  )  [inline]

Retrieves a theme in this workspace.

Parameters:
index is the zero-based index of the theme to retrieve, where 0 is the topmost layer.
Returns:
A handle to a ShapeUp theme.
See also:
SUTheme, Workspace_GetTheme()

SUTheme SUWorkspace::GetSelectedTheme (  )  [inline]

Queries ShapeUp for a single selected theme in this workspace.

Returns:
A selected theme, or a null-theme if no themes were selected or if more than one theme was selected.
See also:
Workspace_GetSelectedTheme()

SURecordset SUWorkspace::GetSelectedThemes (  )  [inline]

Queries ShapeUp for the selected themes in this workspace.

Returns:
A recordset containing themes.
See also:
SURecordset, Workspace_GetSelectedThemes()

size_t SUWorkspace::GetSelectionCount (  )  [inline]

Returns the number of selected themes in this workspace.

Returns:
The number of selected themes.
See also:
Workspace_GetSelectionCount()

SUTheme SUWorkspace::CreateNewTheme ( ShapeType  type,
const char *  name 
) [inline]

Creates a new theme of specified sort in this workspace.

Parameters:
type is the type of objects this theme should contain.
name is a null-terminated string used as the themes initial name. This parameter might be NULL to get default naming.
Returns:
An SUTheme object representing the newly created theme.
See also:
SUTheme, Workspace_CreateNewTheme()

SUTheme SUWorkspace::CreateNewThemeFromSelection ( SUTheme  source,
const char *  name 
) [inline]

Creates a new theme based on the selection in a source theme in this workspace.

Parameters:
source is the theme containing selected shapes to be copied.
name is a null-terminated string used as the themes initial name. This parameter might be NULL to get default naming.
Returns:
An SUTheme object representing the newly created theme.
See also:
SUTheme, Workspace_CreateNewThemeFromSelection()

bool SUWorkspace::BrowseTheme ( const char *  title,
SUTheme theme 
) [inline]

Opens the Browse Theme dialog, and lets the user select a theme.

Parameters:
title is the title of this dialog. If NULL, the title will default to "Select Theme"
theme [out] is an SUTheme that will receive the selected theme.
Returns:
True if a theme was selected, and false if the user pressed the cancel button.
See also:
SUTheme, Workspace_BrowseTheme()

void SUWorkspace::GetBounds ( SURectf r  )  [inline]

Gets the workspace's bounding box.

Parameters:
r [out] is a rectangle that will receive the aggregated bounds of all themes.
See also:
SUTheme::GetBounds(), Workspace_GetBounds()

void SUWorkspace::Log ( const char *  line  )  [inline]

Writes a line of text to the console window of this workspace.

Parameters:
line is the text to be written.
See also:
Workspace_Log()

bool SUWorkspace::IsActive (  )  [inline]

Retrieves the active state of this workspace.

Returns:
True if this workspace is active, adn false otherrwise.
See also:
Workspace_IsActive()

void SUWorkspace::Refresh (  )  [inline]

Forces the workspace to repaint all components.

See also:
Workspace_Refresh()

SUJavaScript SUWorkspace::LoadJavaScript ( const char *  file  )  [inline]

Loads a JavaScript from file.

Parameters:
file is the name of the JavaScript file to load. If no absolute path is given, the script will be searched for relative the ShapeUp Scripts sub-directory.
Returns:
A handle to a loaded SUJavaScript.
See also:
SUJavaScript, ShapeUp_HasJavaScriptSupport(), Workspace_LoadJavaScript()

std::string SUWorkspace::GetComment (  )  [inline]

Gets the workspace comment found in the workspace properties dialog.

Returns:
The workspace comment.
See also:
Workspace_GetComment()

void SUWorkspace::SetComment ( const char *  comment  )  [inline]

Sets the workspace comment found in the workspace properties dialog.

Parameters:
comment is the new workspace comment.
See also:
Workspace_SetComment()

bool SUWorkspace::RemoveTheme ( SUTheme  theme  )  [inline]

Removes a theme from a workspace.

Parameters:
theme is the SUHANDLE to the theme to remove.
Returns:
true if the theme could be removed, adn false otherwise.
See also:
Workspace_RemoveTheme()

void SUWorkspace::SetSerialData ( size_t  byteCount,
const void *  bytes 
) [inline]

Sets data to be serialized with a workspace. This function can be called at any time setting new data. However, when this function is called, any old data is discarded and fully replaced with the new.
This data can later be restored from a ShapeUp workspace file when it is loaded, if the plug-in has set up a deserialize hook using the ShapeUp_AddDeserializeHook call.

Parameters:
byteCount is the size of the bytes array.
bytes is a pointer to a byte sequence containing the data to be serialized.
See also:
Workspace_SetSerialData()

SUHANDLE SUWorkspace::AddDataPage ( const char *  name  )  [inline]

Adds a new custom data page to the workspace.

Parameters:
name is the name for the new data page.
Returns:
This function returns the SUHANDLE to the created data page on success.
See also:
Workspace_AddDataPage()

void SUWorkspace::ClearSelection (  )  [inline]

Deselects all themes in the workspace.

Returns:
true if the theme could be removed, adn false otherwise.
See also:
Workspace_RemoveTheme()


The documentation for this class was generated from the following file:
Generated on Thu Apr 15 10:55:35 2010 for ShapeUp API by  doxygen 1.5.2