24 #ifndef PAWS_MANAGER_HEADER 25 #define PAWS_MANAGER_HEADER 27 #include <csutil/ref.h> 28 #include <csutil/parray.h> 29 #include <csutil/hash.h> 30 #include <csutil/csstring.h> 31 #include <csgeom/vector3.h> 33 #include <iutil/vfs.h> 34 #include <iutil/document.h> 43 struct iObjectRegistry;
69 #if defined(CS_PLATFORM_UNIX) && defined(INCLUDE_CLIPBOARD) 72 #define csevSelectionNotify(reg) (csEventNameRegistry::GetID((reg), "crystalspace.xwindow.clipboard.selection.notify")) 76 #define CONFIG_TOOLTIPS_FILE_NAME "/planeshift/userdata/options/tooltips.xml" 77 #define CONFIG_TOOLTIPS_FILE_NAME_DEF "/planeshift/data/options/tooltips_def.xml" 195 bool LoadChildWidgets(
const char* widgetFile, csArray<pawsWidget*> &loadedWidgets);
313 bool RemoveWidget(
const char* widgetName,
bool complain);
328 csString
Translate(
const csString &orig);
375 bool ApplyStyle(
const char* name, iDocumentNode* target);
395 ToolTipEnable = state;
405 ToolTipEnableBgColor = state;
410 return TooltipsColors[element];
415 TooltipsColors[element] = param;
440 void Publish(
const csString &dataname,
const char* datavalue);
443 void Publish(
const csString &dataname,
bool datavalue);
446 void Publish(
const csString &dataname,
int datavalue);
449 void Publish(
const csString &dataname,
unsigned int datavalue);
452 void Publish(
const csString &dataname,
float datavalue);
455 void Publish(
const csString &dataname,
const char* datavalue,
int color);
458 void Publish(
const csString &dataname);
473 #if defined(CS_PLATFORM_UNIX) && defined(INCLUDE_CLIPBOARD) 478 void RequestClipboardContent();
583 #if defined(CS_PLATFORM_UNIX) && defined(INCLUDE_CLIPBOARD) 593 bool HandleSelectionNotify(iEvent &event);
636 csRef<iDocumentSystem>
xml;
695 #if defined(CS_PLATFORM_UNIX) && defined(INCLUDE_CLIPBOARD) 696 csRef<iXWindow> xwin;
699 csEventID SelectionNotifyEvent;
749 const char* GetStr();
752 unsigned int GetUInt();
759 virtual void OnUpdateData(
const char* name,
PAWSData &data) = 0;
760 virtual void NewSubscription(
const char* name) = 0;
iSoundManager * GetSoundManager()
Gets the soundManager.
void Publish(const csString &dataname, PAWSData &data)
Announce a change in a named element to all subscribers.
pawsMainWidget * GetMainWidget()
Returns the main widget.
pawsWidget * resizingWidget
Holds the widget that is being resized.
iObjectRegistry * objectReg
The object registry.
int resizingFlags
The resize flags.
csEventID KeyboardUp
Shortcut for event key up.
iObjectRegistry * GetObjectRegistry()
Returns the object registry.
pawsMouse * mouse
The mouse pointer.
pawsWidget * GetCurrentFocusedWidget()
Returns the widget that is focused.
pawsMainWidget * mainWidget
The main handler widget.
pawsWidget * GetModalWidget()
Returns modal widget.
csRef< iTextureHandle > guiTexture
Render texture for gui rendering.
csRef< iPawsImage > resizeImg
Resized image.
bool GetFocusOverridesControls()
Returns true if the current focused widget needs to override all controls.
void CreateWarningBox(const char *message, pawsWidget *notify=NULL, bool modal=true)
Creates a warning box with the supplied text.
void RemoveObjectView(pawsWidget *widget)
Removes an object view from the array.
A specific MathEnvironment to be used in a MathScript.
PAWSSubscriptionsHash subscriptions
Table of subscriptions.
bool LoadSkinDefinition(const char *zip)
Loads a skin and loades unregistered resources.
bool HandleEvent(iEvent &event)
Process mouse and keyboard events.
pawsWidget * FindWidget(const char *name, bool complain=true)
Locate a widget by name.
csRef< iEventNameRegistry > nameRegistry
For event parsing.
pawsPrefManager * GetPrefs()
Returns the prefrence manager.
Main PlaneShift Window manager.
iPAWSSubscriber * subscriber
pawsMouse * GetMouse()
Returns the mouse.
void MovingWidget(pawsWidget *moving)
Let the window manager know that a widget is being moved.
virtual ~iPAWSSubscriber()
PAWSDATATYPE
Data types for pub/sub.
void SetDragDropWidget(pawsWidget *dragDropWidget)
Sets the widget that is being drag'n'dropped over screen with the mouse.
pawsWidget * currentFocusedWidget
The last widget that the mouse clicked on. ( Hence the focused one ).
csRef< iVFS > vfs
Pointer to the Crystal Space iVFS file system.
csEventID MouseUp
Shortcut for event mouse up.
pawsWidget * GetDragDropWidget()
Gets the widget that is being drag'n'dropped over screen with the mouse.
float GetFontFactor()
Gets the factor the font should be adjusted by for proper fontsize based on resolution.
pawsStyles * styles
PAWS style definitions.
bool HandleDoubleClick(csMouseEventData &data)
Process mouse double click events.
static csString temp_buffer
void ResizingWidget(pawsWidget *widget, int flags)
Let the manager know that a widget is being resized.
int TooltipsColors[3]
Array of tooltip colors.
int getTooltipsColors(int element)
returns one element of the TooltipsColors-array
csTicks timeOver
The time mouse has been over the last widget.
Class pawsStyles keeps definitions of PAWS styles - a PAWS style is collection of XML attributes and ...
bool LoadWidget(const char *widgetFile)
Loads a widget definition file.
pawsTextureManager * textureManager
The texture manager.
void CreateYesNoBox(const char *message, pawsWidget *notify=NULL, bool modal=true, bool translate=true)
Creates a YesNo box with the supplied text.
bool HandleKeyDown(iEvent &event)
Process key down events.
pawsWidget * LoadWidgetFromString(const char *widgetDefinition)
Loads a widget definition from a string.
bool hadKeyDown
Flag for key down function.
bool ToolTipEnable
Sets if the tooltip should be enable.
csString Translate(const csString &orig)
A shortcut - translation without need to call GetLocalization().
csArray< iPAWSSubscriber * > ListSubscribers(const char *dataname)
Return a list of all subscribers.
bool ToolTipEnableBgColor
Sets if the tooltip should have a bgcolor.
bool focusOverridesControls
Does the currentFocusedWidget take focus from the control system?
iPawsImage * GetResizeImage()
Returns the resize button image.
bool render2texture
Whether to use r2t for the gui.
void setToolTipEnableBgColor(bool state)
changes tooltips backround enabled/disabled
void SetCurrentFocusedWidget(pawsWidget *widget)
Give this widget focus.
csPDelArray< pawsWidgetFactory > factories
An array of pointers to available factories.
void OnWidgetDeleted(pawsWidget *widget)
pawsWidget destructor calls this so PawsManager can NULLify all its links to the widget.
csRef< iGraphics3D > graphics3D
Pointer to the Crystal Space iGraphics3D renderer used to display 3D graphics.
PAWSData & operator=(PAWSData &other)
void setToolTipEnable(bool state)
changes tooltips enabled/disabled
pawsPrefManager * prefs
The preference/default manager.
float fontFactor
The font resizing factor for all widgets.
psLocalization * GetLocalization()
Returns the psLocalization object:
csString & getVFSPathToSkin()
csHash< PAWSSubscription *, csString > PAWSSubscriptionsHash
pawsWidget * modalWidget
Current modal widget.
pawsWidget * mouseoverWidget
The last widget that the mouse moved over. ( For alpha fade effects ).
psLocalization * localization
Localized file object registry.
bool ApplyStyle(const char *name, iDocumentNode *target)
Applies PAWS style to XML node.
The main or desktop widget.
pawsTextureManager * GetTextureManager()
Returns the texture manager.
pawsWidget * lastfadeWidget
The actual widget that was last faded.
csPtr< iDocumentNode > ParseWidgetFile(const char *widgetFile)
Parses given file and returns the <widget_description> tag of it.
Localization class for languages.
csEventID MouseDoubleClick
Shortcut for event mouse double click.
bool HandleMouseDown(csMouseEventData &data)
Process mouse down events.
csRef< iGraphics2D > graphics2D
Pointer to the Crystal Space iGraphics2D renderer used to display 2D graphics.
psPoint MouseLocation(iEvent &ev)
MathEnvironment & ExtraScriptVars()
void SetMainWidget(pawsMainWidget *widg)
Establish main widget.
bool RemoveWidget(const char *widgetName, bool complain)
Remove the named widget from the mainwidget.
iGraphics2D * GetGraphics2D()
Returns the 2D renderer.
iGraphics3D * GetGraphics3D()
Returns the 3D renderer.
pawsWidget * movingWidget
Current widget that is being moved.
void AddObjectView(pawsWidget *widget)
Adds an object view to the array.
csEventID KeyboardDown
Shortcut for event key down.
csEventID MouseDown
Shortcut for event mouse down.
bool LoadTooltips(const char *fileName)
Loads the Tooltips config-file.
Holds/Loads the prefs from a pref file.
void Draw()
Draw the main widget and the mouse last.
pawsWidget * dragDropWidget
The widget that is drag'n'dropped across the screen by the mouse.
void Draw3D()
Draw 3D parts of the widgets.
void UnSubscribe(iPAWSSubscriber *listener)
Unsubscribe the given subscriber.
MathEnvironment extraScriptVars
void OnWidgetHidden(pawsWidget *widget)
Remove focus and mouseover effect from widget if widget is hidden.
void setTooltipsColors(int element, int param)
transfers a value to the TooltipsColors-array
void RegisterFactories()
Helper function to load standard factories.
bool HandleMouseMove(csMouseEventData &data)
Process mouse movement events.
csString getToolTipSkinPath()
returns the full path to the tooltips.xml in skin.zip
pawsWidget * CreateWidget(const char *factoryName)
Create a new widget.
csString vfsPathToSkin
VFS Mount directory mapping to the specified skin zip file.
bool LoadChildWidgets(const char *widgetFile, csArray< pawsWidget * > &loadedWidgets)
Loads widgets from a definition file without assigning a parent.
void SetModalWidget(pawsWidget *widget)
Make this widget modal.
csRef< iDocumentSystem > xml
Pointer to the Crystal Space iDocumentSystem.
bool HandleMouseUp(csMouseEventData &data)
Process mouse up events.
csRef< iSoundManager > soundManager
planeshift's sound manager
csArray< pawsWidget * > objectViews
Array of paws object view widgets;.
int tipDelay
The time mouse has been over a widget before showing the tooltip.
bool getToolTipEnable()
returns tooltips enabled/disabled
void Subscribe(const char *dataname, iPAWSSubscriber *listener)
Subscribe to a named piece of data, so updates are received automatically.
void RegisterWidgetFactory(pawsWidgetFactory *factory)
Add a new factory to the list that the manager knows about.
csEventID MouseMove
Shortcut for event mouse move.
bool getToolTipEnableBgColor()
returns tooltips brackground color
PawsManager(iObjectRegistry *objectReg, const char *skin, const char *skinBase=NULL)
iEventNameRegistry * GetEventNameRegistry()
Get the event name registry.