Planeshift
pawsListBox Class Reference

A simple list box widget. More...

#include <pawslistbox.h>

Public Member Functions

void AddRow (pawsListBoxRow *row)
 
void AutoScrollUpdate (bool v)
 
void CalculateDrawPositions ()
 
void Clear ()
 
bool ConvertFromAutoID (int id, int &row, int &col)
 Convert from an automatic ID to col/row. More...
 
void CreateTitleRow ()
 Creates the title row. More...
 
pawsListBoxRowGetRow (size_t x)
 Get a particular row. More...
 
size_t GetRowCount ()
 Get number of rows in listboz. More...
 
pawsListBoxRowGetSelectedRow ()
 Get selected row. More...
 
int GetSelectedRowNum ()
 Returns number of selected row (-1 if none is selected) More...
 
const char * GetSelectedText (size_t columnId)
 Get text from specified column in the selected row. More...
 
int GetSelection ()
 Get the row that is currently selected. More...
 
int GetSortedColumn ()
 Gets and sets the column that the listbox is sorted by. More...
 
bool GetSortOrder ()
 
pawsTextBoxGetTextCell (int rowNum, int colNum)
 Returns listbox cell of type pawsTextBox or NULL (when the cell does not exist or it is another type). More...
 
csString GetTextCellValue (int rowNum, int colNum)
 Returns value of cell of type pawsTextBox. More...
 
int GetTotalColumns ()
 
bool IsAutoID ()
 Is this an autoID listbox. More...
 
bool IsSelectable ()
 
void MoveRow (int rownr, int dest)
 
void MoveSelectBar (bool direction)
 Moves the select bar up (direction=true) or down (direction=false). More...
 
pawsListBoxRowNewRow (size_t position=(size_t)-1)
 Creates a new row ( default at the end ) and returns a pointer to it. More...
 
pawsListBoxRowNewTextBoxRow (csList< csString > &rowEntry, size_t position=(size_t)-1)
 Creates a new row ( default at the end ) filled by values from rowEntry and returns a pointer to it. More...
 
bool OnKeyDown (utf32_char keyCode, utf32_char keyChar, int modifiers)
 When enter is pressed the highlighted row will be selected and the widget will be notified. More...
 
bool OnMouseDown (int button, int modifiers, int x, int y)
 Manage mouse down event to test for and apply window changes. More...
 
virtual bool OnScroll (int direction, pawsScrollBar *widget)
 Called whenever a window is scrolled. More...
 
 pawsListBox ()
 
 pawsListBox (const pawsListBox &origin)
 
bool PostSetup ()
 This is called after the widget and all of it's children have been created. More...
 
void Remove (int id)
 Remove based on widget id. Note this also deletes the row. More...
 
void Remove (pawsListBoxRow *rowToRemove)
 Remove based on row pointer. More...
 
pawsListBoxRowRemoveSelected ()
 Remove selected row. More...
 
void Resize ()
 Resize a widget based on it's parent's size. More...
 
bool Select (pawsListBoxRow *row, bool notify=true)
 Highlights the selected row. More...
 
bool SelectByIndex (int index, bool notify=true)
 Highlights the selected row (by index) More...
 
virtual bool SelfPopulate (iDocumentNode *node)
 Override the general self populate to handle creation of new rows. More...
 
void SendOnListAction (int status)
 Notifies (parent/notifyTarget) widget that a row has been selected. More...
 
void SetColumnDef (int col, int width, int height, const char *widgetDesc)
 Set how a column should be constructed. More...
 
void SetNotify (pawsWidget *target)
 Sets the widget that will be notified when a row is selected. More...
 
void SetScrollBarMaxValue ()
 
void SetSortedColumn (int colNum)
 
void SetSortingFunc (int colNum, listBoxSortingFunc sortFunc)
 Sets the function that compares listbox rows when sorting by given column. More...
 
void SetSortOrder (bool ascOrder)
 
void SetTextCellValue (int rowNum, int colNum, const csString &value)
 Sets value of cell of type pawsTextBox. More...
 
void SetTotalColumns (int numCols)
 Set how many columns this list box will have. More...
 
bool Setup (iDocumentNode *node)
 Setup this widget. More...
 
void SortRows ()
 Sort rows according to current sort column and sort order. More...
 
void UseTitleRow (bool yes)
 
virtual ~pawsListBox ()
 
- Public Member Functions inherited from pawsWidget
void AddChild (pawsWidget *widget)
 Add a child widget to this widget. More...
 
void AddChild (size_t Index, pawsWidget *widget)
 Add a child widget to this widget at a specified position. More...
 
virtual void BringToTop (pawsWidget *widget)
 Move this widget up the z order to the top. More...
 
virtual double CalcFunction (MathEnvironment *env, const char *functionName, const double *params)
 
virtual void CenterTo (int x, int y)
 Move this widget so that its center is at given location. More...
 
virtual void CenterToMouse ()
 Move this widget so that its center is at mouse pointer, but it is fully on screen. More...
 
void ChangeFontSize (float newSize)
 Change font to new size and reload font to make it take effect. More...
 
virtual bool CheckButtonPressed (int button, int modifiers, pawsWidget *pressedWidget)
 Test button for activity. More...
 
virtual bool CheckButtonReleased (int button, int modifiers, pawsWidget *pressedWidget)
 Test button for activity. More...
 
virtual bool CheckKeyHandled (int)
 Allow pawsButton to simulate button pushes based on keypresses. More...
 
void ClearBackgroundColor ()
 
void ClearMaskingImage ()
 Clears the masking image. More...
 
csRect ClipRect ()
 This returns the current clipping rectangle. More...
 
void ClipToParent (bool allowForBackgroundBorder)
 Determines clipping area to use. More...
 
virtual void Close ()
 Simply calls Hide() unless overidden. More...
 
virtual bool Contains (int x, int y)
 Determines if the coordinates are within this widget. More...
 
virtual void CreateWidgetConfigWindow ()
 Creates a popup window that the user can use to adjust the settings of this window. More...
 
virtual void DeleteChild (pawsWidget *widget)
 Removes the widget from list of children and destructs it. More...
 
void DeleteYourself ()
 Removes and destructs itself. More...
 
virtual void DestroyWidgetConfigWindow ()
 Called by ApplyAlphaOnChildren to remove the config window to prevent weird stuff. More...
 
virtual void Draw ()
 Draws the widget and all of it's children. More...
 
virtual void Draw3D (iGraphics3D *)
 
virtual void DrawBackground ()
 Draws the background with a color or an image. More...
 
virtual void DrawChildren ()
 Draws all children marked visible. More...
 
void DrawForeground ()
 Does the second part of the drawing drawing the background of the window. More...
 
virtual void DrawMask ()
 Draws the mask picture. More...
 
virtual void DrawToolTip (int x, int y)
 This draws the tool tip if a widget is visible and a tool tip is available. More...
 
void DrawWidgetText (const char *text, int x, int y, int style=-1)
 Draw text in the widget at specified location. More...
 
bool DrawWindow ()
 Does the first part of the drawing. More...
 
virtual void Dump (csString tab="")
 Prints the widget names for the widget and all it's children. More...
 
const char * FindDefaultWidgetStyle (const char *factoryName)
 
pawsWidgetFindWidget (const char *name, bool complain=true)
 Find a child widget of this widget. More...
 
pawsWidgetFindWidget (int id, bool complain=true)
 Find a child widget of this widget. More...
 
pawsWidgetFindWidgetXMLBinding (const char *xmlbinding)
 Find a child widget of this widget with the given XML binding. More...
 
void FormatToolTip (const char *fmt,...)
 Changes the format of a tool tip. More...
 
int GetActualHeight (int myValue=-1)
 Returns the actual Height assuming the passed value was in 800x600 resolution. More...
 
int GetActualWidth (int myValue=-1)
 Returns the actual width assuming the passed value was in 800x600 resolution. More...
 
csString GetBackground ()
 Retrieve the background image name. More...
 
virtual pawsBorderGetBorder ()
 This returns the border created by UseBorder(). More...
 
virtual int GetBorderColour (int which)
 Get the color for this widgets border. More...
 
virtual int GetBorderStyle ()
 This returns the BORDER_BUMP style. More...
 
pawsWidgetGetChild (size_t i)
 Used if you need to loop through the children of a widget. More...
 
size_t GetChildrenCount ()
 Used if you need to loop through the children of a widget. More...
 
const char * GetCloseName ()
 Returns the closeName of this widget. More...
 
virtual csRect GetDefaultFrame ()
 Returns the default csRect. More...
 
iWidgetDataGetExtraData ()
 Grabs extra data stored in the widget. More...
 
float GetFadeSpeed ()
 Gets the fading speed. More...
 
int GetFadeVal ()
 Gets the fade value of this widget. More...
 
const char * GetFilename ()
 Returns the filename. More...
 
virtual bool GetFocusOverridesControls () const
 Test if the widget should intercept all key presses. More...
 
iFont * GetFont (bool scaled=true)
 Gets the current font as an iFont. More...
 
virtual int GetFontColour ()
 Gets the current font color. More...
 
int GetFontShadowColour ()
 Gets the current shadow color. More...
 
float GetFontSize ()
 Gets the current font size. More...
 
int GetFontStyle ()
 Gets the current font style. More...
 
int GetID ()
 Gets the id of a widget. More...
 
int GetLogicalHeight (int myValue)
 
int GetLogicalWidth (int myValue)
 
int GetMaxAlpha ()
 Gets the maximum alpha value of this widget. More...
 
int GetMinAlpha ()
 Gets the minimim alpha value of this widget. More...
 
void GetMinSize (int &width, int &height)
 
const char * GetName ()
 Get the name of this widget. More...
 
pawsWidgetGetParent ()
 Get this widget's parent. More...
 
csString GetPathInWidgetTree ()
 Returns textual description of path to our widget through the widget tree. More...
 
virtual double GetProperty (MathEnvironment *env, const char *ptr)
 
virtual csRect GetScreenFrame ()
 Returns the csRect that defines widget area. More...
 
csString & GetToolTip ()
 Gets the text from a tool tip. More...
 
const char * GetType ()
 Gets the current factory type. More...
 
csRect GetWidgetTextRect (const char *text, int x, int y, int style=-1)
 Get the rectangle containing the text DrawWidgetText will produce. More...
 
virtual const csString & GetXMLBinding ()
 Get the xml nodes of this widget. More...
 
virtual bool HasFocus ()
 Test focus of the widget. More...
 
virtual void Hide ()
 Makes widget invisible and removes focus if widget has current focus. More...
 
virtual void Ignore (bool ig)
 
bool Includes (pawsWidget *widget)
 Returns true if widget equals this, or widget is a child of this. More...
 
bool IsAlwaysOnTop ()
 Tests value of this widgets alwaysOnTop flag. More...
 
bool IsChildOf (pawsWidget *someParent)
 Returns true, if this widget is the child of 'someParent'. More...
 
bool IsConfigurable ()
 Tests if widget settings (alpha, fade, etc) are configurable. More...
 
bool isFadeEnabled ()
 Gets the fade status of this widget. More...
 
bool IsIndirectChild (pawsWidget *widget)
 Returns true, if 'widget' is child of our widget, even if it is indirect. More...
 
bool IsResizable ()
 Test widget to see if it is resizable. More...
 
bool isScalingFont ()
 Returns whether or not font is being auto-scaled. More...
 
bool IsVisible ()
 Is the widget currently set visible? More...
 
virtual bool Load (iDocumentNode *node)
 Load a widget based on its <widget></widget> tag. More...
 
virtual bool LoadAttributes (iDocumentNode *node)
 Load standard widget attributes based on its <widget></widget> tag. More...
 
virtual bool LoadChildren (iDocumentNode *node)
 Load widget children based on subtags of its <widget></widget> tag. More...
 
virtual bool LoadEventScripts (iDocumentNode *node)
 Load event scripts for this widget. More...
 
bool LoadFromFile (const csString &fileName)
 Parses XML file 'fileName', finds first widget tag and Load()s itself from this tag. More...
 
virtual csRect LoadPositions ()
 Get the position of this widget that was stored in a cfg file. More...
 
virtual void LoadSettings ()
 Loads current widget settings from an XML file. More...
 
void MakeFullyVisible ()
 If some part of the widget is not within the rectangle of its parent, then the widget is moved inside (if it is small enough). More...
 
virtual void MouseOver (bool value)
 Sets hasMouseFocus. More...
 
virtual void MoveDelta (int dx, int dy)
 Move a widget by a delta amount. More...
 
virtual void MoveTo (int x, int y)
 Moves this widget and all of its children to a new screen location. More...
 
bool NeedsRender () const
 Whether we need to r2t. More...
 
virtual void NewSubscription (const char *dataname)
 
virtual bool OnButtonPressed (int button, int keyModifier, pawsWidget *widget)
 Called whenever a button is pressed. More...
 
virtual bool OnButtonReleased (int button, int keyModifier, pawsWidget *widget)
 Called whenever a button is released. More...
 
virtual bool OnChange (pawsWidget *widget)
 Called whenever a widget is selected. More...
 
virtual bool OnChildMouseEnter (pawsWidget *child)
 Called when mouse enters a child widget. More...
 
virtual bool OnChildMouseExit (pawsWidget *child)
 Called when a mouse exits a child widget. More...
 
virtual bool OnClipboard (const csString &content)
 Process Clipboard content, as a response to RequestClipboardContent. More...
 
virtual bool OnDoubleClick (int button, int modifiers, int x, int y)
 Manage mouse double click event. More...
 
virtual bool OnGainFocus (bool=true)
 Changes hasFocus to TRUE and reports status to parent. More...
 
virtual bool OnJoypadDown (int key, int modifiers)
 Process joypadDown messages. More...
 
virtual void OnListAction (pawsListBox *selected, int status)
 Called whenever an item in a child list box is selected. More...
 
virtual void OnLostFocus ()
 Sets hasFocus false and notifys parent. More...
 
virtual bool OnMenuAction (pawsWidget *widget, const pawsMenuAction &action)
 Called whenever a menu action occurs. More...
 
virtual bool OnMouseEnter ()
 Called whenever the mouse enters this widget. More...
 
virtual bool OnMouseExit ()
 Called whenever the mouse leaves this widget. More...
 
virtual bool OnMouseUp (int button, int modifiers, int x, int y)
 Manage mouse up event. More...
 
virtual void OnResize ()
 Sets the new position of the close button. More...
 
virtual bool OnSelected (pawsWidget *widget)
 Called whenever a widget is selected. More...
 
virtual void OnUpdateData (const char *, PAWSData &)
 
virtual bool ParentDraw () const
 Whether to draw via the parent-child draw tree. More...
 
 pawsWidget ()
 
 pawsWidget (const pawsWidget &origin)
 
virtual void PerformAction (const char *action)
 Does an action based on this string. More...
 
void RecalcScreenPositions ()
 This re-calculates a widget's on screen position to draw based on it's relative position and parent screen location. More...
 
void ReloadWidget ()
 Reloads widget from XML file. More...
 
void RemoveChild (pawsWidget *widget)
 Removes the widget from list of children but does NOT destruct it. More...
 
void RemoveTitle ()
 
virtual void ResetToDefaultFrame ()
 Resets the position, width and height to the default position. More...
 
virtual void Resize (int flags)
 Resize a widget based on the current mouse position. More...
 
virtual void Resize (int dx, int dy, int flags)
 Resize a widget by a delta amount. More...
 
void RunScriptEvent (PAWS_WIDGET_SCRIPT_EVENTS event)
 Executes any pawsScript associated with the given event. More...
 
virtual void SavePosition ()
 Saves the position of this widget to the config file. More...
 
virtual void SaveSettings ()
 Saves current widget settings to an XML file. More...
 
virtual bool SelfPopulateXML (const char *xmlstr)
 This function parses the xml string and calls SelfPopulate with the resulting DOM structure if valid. More...
 
virtual void SendToBottom (pawsWidget *widget)
 Move this widget down the z order to the bottom. More...
 
void SetAlwaysOnTop (bool value)
 Sets value of this widgets alwaysOnTop flag. More...
 
virtual void SetAttachFlags (int flags)
 Modify attachFlags to control widget construction. More...
 
virtual void SetBackground (const char *imageName)
 Sets the background image, logs error if NULL. More...
 
virtual void SetBackgroundAlpha (int alphaValue)
 Sets the alpha level of the background. More...
 
void SetBackgroundColor (int r, int g, int b)
 Sets the background color. More...
 
void SetColour (int newColour=-2)
 Set text color. More...
 
void SetContextMenu (const csString &fileName)
 Sets name of the PAWS xml-file that describes context menu of our widget. More...
 
void SetDefaultToolTip ()
 Sets the tool tip to the one defined in the XML. More...
 
void SetExtraData (iWidgetData *data)
 Stores extra data into this widget. More...
 
void SetFactory (const char *myfactory)
 Sets the type of factory. More...
 
void SetFade (bool value)
 Used to control the fading feature of the widget. More...
 
void SetFadeSpeed (float speed)
 Sets the fading speed. More...
 
void SetFilename (const char *name)
 Changes filename to the name provided. More...
 
void SetFont (const char *fontName, int Size=0)
 Set font to use programmatically. More...
 
void SetFontScaling (bool value)
 Used to control the font scaling of the widget. More...
 
void SetFontStyle (int style)
 Sets the current font style. More...
 
virtual void SetForceSize (int newWidth, int newHeight)
 Same as above, but does not resize children. More...
 
void SetID (int newID)
 Change the id of a widget. More...
 
void SetMaskingImage (const char *image)
 Sets a masking image which will be drawn after the normal stuff. More...
 
void SetMaxAlpha (int value)
 Sets the maximum alpha of this widget. More...
 
void SetMaxSize (int width, int height)
 Set the max size for height and width. More...
 
void SetMinAlpha (int value)
 Sets the minimim alpha of this widget. More...
 
void SetMinSize (int width, int height)
 Set the minimum height and width to protect the widget from negatives. More...
 
void SetModalState (bool isModal)
 Registers mode with the windowManager. More...
 
void SetMovable (bool value)
 Makes a widget movable. More...
 
void SetName (const char *newName)
 Set the name of this widget. More...
 
void SetNeedsRender (bool needs)
 Marks that we need to r2t. More...
 
void SetParent (pawsWidget *widget)
 Set the owner of this widget. More...
 
virtual void SetProperty (const char *ptr, double value)
 
virtual void SetRelativeFrame (int x, int y, int width, int height)
 Set the size of this widget and it's position relative to the parent. More...
 
virtual void SetRelativeFramePos (int x, int y)
 Set the position of this widget relative to the parent. More...
 
virtual void SetRelativeFrameSize (int width, int height)
 Sets defaultFrame and screenFrame size attributes. More...
 
void SetResizeShow (bool v)
 Sets the showResize flag, controlling if the resize widget should be drawn. More...
 
virtual void SetSize (int newWidth, int newHeight)
 Set the size of a particlar widget. More...
 
void SetTitle (const char *title)
 Sets the border title of this widget. More...
 
bool SetTitle (const char *text, const char *image, const char *align, const char *close_button, const bool shadowTitle=true)
 Sets up the title bar for the widget. More...
 
void SetToolTip (const char *text)
 Changes the text for a tool tip. More...
 
void SetVisibility (bool visible)
 Make the widget visible or hides it. More...
 
virtual void SetXMLBinding (csString &xmlbinding)
 Sets the xml nodes of this widget. More...
 
virtual void Show ()
 Makes widget visible and brings it to the front. More...
 
virtual void ShowBehind ()
 Makes widget visible and brings it to the front but behind widget with current focus. More...
 
virtual void StopResize ()
 Called once the mouse up is done after resizing a widget. More...
 
const char * ToString ()
 
virtual void UseBorder (const char *style=0)
 Creates a new border and links it to the widget. More...
 
virtual pawsWidgetWidgetAt (int x, int y)
 Locate a widget that is at these screen coordindates. More...
 
virtual ~pawsWidget ()
 
- Public Member Functions inherited from iPAWSSubscriber
virtual ~iPAWSSubscriber ()
 
- Public Member Functions inherited from iScriptableVar
virtual ~iScriptableVar ()
 

Protected Member Functions

void CheckSortingArrow (int colNum, bool ascOrder)
 
void CreateSortingArrow (int colNum)
 
void DeleteSortingArrow (int colNum)
 
pawsWidgetGetColumnTitle (int colNum)
 
int GetUnborderedHeight ()
 Gets height of widget after vertical borders are being excluded. More...
 
void SetSortingArrow (int colNum, bool ascOrder)
 
- Protected Member Functions inherited from pawsWidget
int CalcChildPosition (pawsWidget *child)
 Calculates the right position in array of children for a given child (depends on always-on-top state). More...
 
bool CreateContextMenu ()
 Creates context menu from file ('contextMenuFile' attribute) More...
 
int GetAttachFlag (const char *flag)
 Convert from string flag to int flag. More...
 
void LoadBorderColours (iDocumentNode *node)
 Loads custom border color preferences. More...
 
bool ReadDefaultWidgetStyles (iDocumentNode *node)
 
int ResizeFlags (int mouseX, int mouseY)
 This will check to see if the mouse is over the resize hot spot. More...
 
void SetCloseButtonPos ()
 Gets button from widget and sets it's location. More...
 

Static Protected Member Functions

static int sort_cmp (const void *rowA, const void *rowB)
 This is static function that is used as argument to qsort() and a few variables that influence how this function works. More...
 

Protected Attributes

csString arrowDown
 
int arrowSize
 
csString arrowUp
 
bool ascOrder
 
bool autoID
 
bool autoResize
 
bool autoUpdateScroll
 
ColumnDefcolumnDef
 
int columnHeight
 
unsigned int highlightAlpha
 
csString highlightImage
 
pawsScrollBarhorzscrollBar
 
pawsWidgetnotifyTarget
 the widget that will be notified when a row is selected More...
 
csArray< pawsListBoxRow * > rows
 
int rowWidth
 
pawsScrollBarscrollBar
 
int scrollbarHeightMod
 
int scrollbarWidth
 
bool selectable
 
int selected
 
int sortColNum
 
pawsListBoxRowtitleRow
 
int topRow
 
int totalColumns
 
int totalRows
 
bool useBorder
 
bool usingTitleRow
 
csString xmlbinding_row
 
int xMod
 
- Protected Attributes inherited from pawsWidget
int alpha
 The original background alpha. More...
 
int alphaMin
 The minimum background alpha. More...
 
bool alwaysOnTop
 Is this windows painted on top of other windows. More...
 
int attachFlags
 The attachpoints for when a resize takes place. More...
 
int bgColour
 Stores the bgColour for this widget. More...
 
csRef< iPawsImagebgImage
 Background image. More...
 
pawsBorderborder
 border created by GetBorder(). More...
 
int borderColours [5]
 Custom border colors for this window. More...
 
bool borderTitleShadow
 whether the title in the border should be shadow font More...
 
csArray< pawsWidget * > children
 The child widgets. More...
 
csRect clipRect
 Current clipping rectangle. More...
 
pawsButtonclose_widget
 Used in SetTitle() for the new close button. More...
 
csString closeName
 Old name of the widget with "_close" appended by SetName(). More...
 
bool configurable
 Determines if the settings (alpha, fade, etc) of this widget are configurable. More...
 
pawsMenucontextMenu
 Existing context menu of the widget. More...
 
csString contextMenuFile
 Path to the file that describes context menu of our widget (invoked by mouse right-click). More...
 
int defaultFontColour
 Optional color to use when drawing text with this widget. More...
 
int defaultFontShadowColour
 Optional color to use when doing text dropshadows. More...
 
float defaultFontSize
 Default font size. More...
 
csRect defaultFrame
 The default frame for the widget. More...
 
csString defaultToolTip
 Default tool tip string for the widget. More...
 
csHash< csString, csString > defaultWidgetStyles
 
iWidgetDataextraData
 Holds any extra data the widget may need. More...
 
csString factory
 factory name More...
 
bool fade
 Set to false to disable fading. More...
 
float fadeSpeed
 The speed of the fading process. More...
 
float fadeVal
 The direction and percentage of current fade in progress. More...
 
csString filename
 filename to load from or save to. More...
 
csString fontName
 Name of currently selected font. More...
 
float fontSize
 Current font size. More...
 
int fontStyle
 Current font style. More...
 
csRef< iGraphics2D > graphics2D
 The 2D graphics interface. More...
 
bool hasBorderColours
 Flag to indicate using custom border colors. More...
 
bool hasFocus
 Flag for widget focus. More...
 
bool hasMouseFocus
 Flag for mouse over behavior. More...
 
int id
 The id of the widget. More...
 
bool ignore
 Flag determines if WidgetAT() ignores this widget. More...
 
bool isResizable
 Determines if this widget can be resized by user. More...
 
bool keepaspect
 Enforce keeping the default aspect ratio when resizing. More...
 
int margin
 Stores margin value. Used in LoadAttributes(). More...
 
csRef< iPawsImagemaskImage
 Masking image, used for nice-looking stuff. More...
 
int max_height
 Defines the maximum height that the widget can be. More...
 
int max_width
 Defines the maximum width that the widget can be. More...
 
int min_height
 Defines the minimum height that the widget can be. More...
 
int min_width
 Defines the minimum width that the widget can be. More...
 
bool movable
 Determines if this widget is movable. More...
 
csRef< iFont > myFont
 Optional font to use when drawing this widget. More...
 
csString name
 The name of this widget. More...
 
bool needsRender
 Whether we need to do a r2t update. More...
 
pawsWidgetonEnter
 Widget to call if enter is pressed. More...
 
bool overwrite_subscription
 Flag of whether OnUpdateData should overwrite the previous value or add to it. More...
 
pawsWidgetparent
 This widget's parent. More...
 
bool parentDraw
 Whether to draw this widget (different from visible, used to decide if Draw() is called via parent-child tree). More...
 
bool resizeToScreen
 Determines if this widget should be auto resized with screen resolution. More...
 
bool saveWidgetPositions
 Determines if this widget should write/load it's position from a config file. More...
 
bool scaleFont
 Determines whether or not to scale font when a widget it resized. More...
 
csRect screenFrame
 The screen area of the widget. More...
 
pawsScriptscriptEvents [PW_SCRIPT_EVENT_COUNT]
 
bool showOnMouseOver
 Stores status of showOnMouseOver. More...
 
csString showOnMouseOver_image
 Stores the bgimage name if showOnMouseOver is true. More...
 
bool showResize
 If the resize widget should be drawn. More...
 
csString subscribedVar
 The variable that this widget is subscribed to. More...
 
csString subscription_format
 
csArray< pawsWidget * > taborder
 Contains the children for tabbing. More...
 
pawsTitletitleBar
 reference to titleBar object, if any More...
 
csString toolTip
 Tooltip to be displayed. More...
 
bool visible
 Flag to determine visiblity. More...
 
csString xmlbinding
 Used in the SelfPopulate functions to map to xml nodes for each widget. More...
 

Static Protected Attributes

static const int BORDER_SIZE = 5
 Defines border size around child widgets. More...
 
static bool sort_ascOrder
 
static int sort_sortColNum
 
static listBoxSortingFunc sort_sortFunc
 

Additional Inherited Members

- Public Attributes inherited from pawsWidget
csArray< csString > publishList
 

Detailed Description

A simple list box widget.

A list box is made up a list of another type of widgets called pawsListBoxRows. Each row is then made up of several widgets that constitue a 'row'. So a row may be a textbox, image, button.

This is how a list box is defined in XML. You define the basic layout of it and how each column in the rows should be constructed. If you use the autoid="yes" every widget in the listbox will have an id=ListBoxID+ row*numberOfColumns+coloum:

<widget name="PetitionList" factory="pawsListBox" xmlbinding="petition_list" id="0" autoid="yes" sortBy="2" sortOrder="asc" > Size of entire list box <frame x="4" y="34" width="592" height="288" border="yes"/>

Each row in the list box will be 32 high <columns height="32" xmlbinding="p">

define a column that is 140 wide.  The first column of any row
will be a textbox widget as defined by the \<widget\>\</widget\> class
\<column width="140" xmlbinding="GM"\>
    \<widget name="GM" factory="pawsTextBox"\>\</widget\>
\</column\>

define other columns:
\<column width="150"  xmlbinding="stat"\>
    \<widget name="Status" factory="pawsWidget"\>
        \<bgimage resource="Funny" /\>
    \</widget\>
\</column\>

\<column width="302"  xmlbinding="pet"\>
    \<widget name="Petition" factory="pawsTextBox"\>\</widget\>
\</column\>

</columns> </widget>

Definition at line 202 of file pawslistbox.h.

Constructor & Destructor Documentation

pawsListBox::pawsListBox ( )
pawsListBox::pawsListBox ( const pawsListBox origin)
virtual pawsListBox::~pawsListBox ( )
virtual

Member Function Documentation

void pawsListBox::AddRow ( pawsListBoxRow row)
void pawsListBox::AutoScrollUpdate ( bool  v)
inline

Definition at line 383 of file pawslistbox.h.

void pawsListBox::CalculateDrawPositions ( )
void pawsListBox::CheckSortingArrow ( int  colNum,
bool  ascOrder 
)
protected
void pawsListBox::Clear ( )
bool pawsListBox::ConvertFromAutoID ( int  id,
int row,
int col 
)

Convert from an automatic ID to col/row.

void pawsListBox::CreateSortingArrow ( int  colNum)
protected
void pawsListBox::CreateTitleRow ( )

Creates the title row.

void pawsListBox::DeleteSortingArrow ( int  colNum)
protected
pawsWidget* pawsListBox::GetColumnTitle ( int  colNum)
protected
pawsListBoxRow* pawsListBox::GetRow ( size_t  x)

Get a particular row.

size_t pawsListBox::GetRowCount ( )

Get number of rows in listboz.

pawsListBoxRow* pawsListBox::GetSelectedRow ( )

Get selected row.

int pawsListBox::GetSelectedRowNum ( )

Returns number of selected row (-1 if none is selected)

const char* pawsListBox::GetSelectedText ( size_t  columnId)

Get text from specified column in the selected row.

int pawsListBox::GetSelection ( )
inline

Get the row that is currently selected.

Returns
A pointer to the selected row or NULL.

Definition at line 216 of file pawslistbox.h.

int pawsListBox::GetSortedColumn ( )

Gets and sets the column that the listbox is sorted by.

Number -1 means no sorting, in both cases.

bool pawsListBox::GetSortOrder ( )
pawsTextBox* pawsListBox::GetTextCell ( int  rowNum,
int  colNum 
)

Returns listbox cell of type pawsTextBox or NULL (when the cell does not exist or it is another type).

csString pawsListBox::GetTextCellValue ( int  rowNum,
int  colNum 
)

Returns value of cell of type pawsTextBox.

int pawsListBox::GetTotalColumns ( )
inline

Definition at line 270 of file pawslistbox.h.

int pawsListBox::GetUnborderedHeight ( )
protected

Gets height of widget after vertical borders are being excluded.

Returns
Height of widget after subtracting vertical borders height
bool pawsListBox::IsAutoID ( )
inline

Is this an autoID listbox.

Definition at line 310 of file pawslistbox.h.

bool pawsListBox::IsSelectable ( )
inline

Definition at line 302 of file pawslistbox.h.

void pawsListBox::MoveRow ( int  rownr,
int  dest 
)
void pawsListBox::MoveSelectBar ( bool  direction)

Moves the select bar up (direction=true) or down (direction=false).

pawsListBoxRow* pawsListBox::NewRow ( size_t  position = (size_t)-1)

Creates a new row ( default at the end ) and returns a pointer to it.

pawsListBoxRow* pawsListBox::NewTextBoxRow ( csList< csString > &  rowEntry,
size_t  position = (size_t)-1 
)

Creates a new row ( default at the end ) filled by values from rowEntry and returns a pointer to it.

bool pawsListBox::OnKeyDown ( utf32_char  keyCode,
utf32_char  keyChar,
int  modifiers 
)
virtual

When enter is pressed the highlighted row will be selected and the widget will be notified.

Reimplemented from pawsWidget.

bool pawsListBox::OnMouseDown ( int  button,
int  modifiers,
int  x,
int  y 
)
virtual

Manage mouse down event to test for and apply window changes.

Parameters
buttonType of button: 1 resizable or movable, 2 context menu or config window.
modifiersUsed with PAWS_CONSTRUCTION.
xUsed to test for resize.
yUsed to test for resize.
Returns
bool TRUE if movable or resizable.
Remarks
calls OnMouseDown on it's parent.

Reimplemented from pawsWidget.

virtual bool pawsListBox::OnScroll ( int  scrollDirection,
pawsScrollBar widget 
)
virtual

Called whenever a window is scrolled.

Parameters
scrollDirectionThe direction to move.
widgetThe scrollbar widget being manipulated.
Returns
bool Parent's result or FALSE if no parent.

Reimplemented from pawsWidget.

bool pawsListBox::PostSetup ( )
virtual

This is called after the widget and all of it's children have been created.

Remarks
This can be useful for widgets that want to get pointers to some of it's children for quick access.

Reimplemented from pawsWidget.

void pawsListBox::Remove ( int  id)

Remove based on widget id. Note this also deletes the row.

void pawsListBox::Remove ( pawsListBoxRow rowToRemove)

Remove based on row pointer.

pawsListBoxRow* pawsListBox::RemoveSelected ( )

Remove selected row.

void pawsListBox::Resize ( )
virtual

Resize a widget based on it's parent's size.

Reimplemented from pawsWidget.

bool pawsListBox::Select ( pawsListBoxRow row,
bool  notify = true 
)

Highlights the selected row.

bool pawsListBox::SelectByIndex ( int  index,
bool  notify = true 
)

Highlights the selected row (by index)

virtual bool pawsListBox::SelfPopulate ( iDocumentNode *  node)
virtual

Override the general self populate to handle creation of new rows.

Reimplemented from pawsWidget.

void pawsListBox::SendOnListAction ( int  status)

Notifies (parent/notifyTarget) widget that a row has been selected.

void pawsListBox::SetColumnDef ( int  col,
int  width,
int  height,
const char *  widgetDesc 
)

Set how a column should be constructed.

This is usuall used for code constructed list boxes.

Parameters
colThe column number
widthThe width of that column.
heightThe height of what rows should be.
widgetDescThis is an XML description of the widget. Much the same as you would find in the .xml files.
void pawsListBox::SetNotify ( pawsWidget target)
inline

Sets the widget that will be notified when a row is selected.

When nothing is set the OnListAction messages will be sent to the parent widget

Definition at line 340 of file pawslistbox.h.

void pawsListBox::SetScrollBarMaxValue ( )
void pawsListBox::SetSortedColumn ( int  colNum)
void pawsListBox::SetSortingArrow ( int  colNum,
bool  ascOrder 
)
protected
void pawsListBox::SetSortingFunc ( int  colNum,
listBoxSortingFunc  sortFunc 
)

Sets the function that compares listbox rows when sorting by given column.

This makes the column sortable.

void pawsListBox::SetSortOrder ( bool  ascOrder)
void pawsListBox::SetTextCellValue ( int  rowNum,
int  colNum,
const csString &  value 
)

Sets value of cell of type pawsTextBox.

void pawsListBox::SetTotalColumns ( int  numCols)

Set how many columns this list box will have.

This is usually for code constructed list boxes and creates a new set of column definitions.

bool pawsListBox::Setup ( iDocumentNode *  )
virtual

Setup this widget.

Reimplemented from pawsWidget.

static int pawsListBox::sort_cmp ( const void *  rowA,
const void *  rowB 
)
staticprotected

This is static function that is used as argument to qsort() and a few variables that influence how this function works.

void pawsListBox::SortRows ( )

Sort rows according to current sort column and sort order.

You can use this after you added new rows to listbox;

void pawsListBox::UseTitleRow ( bool  yes)

Member Data Documentation

csString pawsListBox::arrowDown
protected

Definition at line 461 of file pawslistbox.h.

int pawsListBox::arrowSize
protected

Definition at line 455 of file pawslistbox.h.

csString pawsListBox::arrowUp
protected

Definition at line 460 of file pawslistbox.h.

bool pawsListBox::ascOrder
protected

Definition at line 441 of file pawslistbox.h.

bool pawsListBox::autoID
protected

Definition at line 427 of file pawslistbox.h.

bool pawsListBox::autoResize
protected

Definition at line 428 of file pawslistbox.h.

bool pawsListBox::autoUpdateScroll
protected

Definition at line 429 of file pawslistbox.h.

const int pawsListBox::BORDER_SIZE = 5
staticprotected

Defines border size around child widgets.

If borders are used by this widget, it offsets position of each child widget and total space designed for child widgets is also increased (by twice size of border)

Definition at line 399 of file pawslistbox.h.

ColumnDef* pawsListBox::columnDef
protected

Definition at line 431 of file pawslistbox.h.

int pawsListBox::columnHeight
protected

Definition at line 422 of file pawslistbox.h.

unsigned int pawsListBox::highlightAlpha
protected

Definition at line 453 of file pawslistbox.h.

csString pawsListBox::highlightImage
protected

Definition at line 452 of file pawslistbox.h.

pawsScrollBar* pawsListBox::horzscrollBar
protected

Definition at line 418 of file pawslistbox.h.

pawsWidget* pawsListBox::notifyTarget
protected

the widget that will be notified when a row is selected

Definition at line 434 of file pawslistbox.h.

csArray<pawsListBoxRow*> pawsListBox::rows
protected

Definition at line 436 of file pawslistbox.h.

int pawsListBox::rowWidth
protected

Definition at line 423 of file pawslistbox.h.

pawsScrollBar* pawsListBox::scrollBar
protected

Definition at line 417 of file pawslistbox.h.

int pawsListBox::scrollbarHeightMod
protected

Definition at line 457 of file pawslistbox.h.

int pawsListBox::scrollbarWidth
protected

Definition at line 456 of file pawslistbox.h.

bool pawsListBox::selectable
protected

Definition at line 459 of file pawslistbox.h.

int pawsListBox::selected
protected

Definition at line 425 of file pawslistbox.h.

bool pawsListBox::sort_ascOrder
staticprotected

Definition at line 450 of file pawslistbox.h.

int pawsListBox::sort_sortColNum
staticprotected

Definition at line 449 of file pawslistbox.h.

listBoxSortingFunc pawsListBox::sort_sortFunc
staticprotected

Definition at line 448 of file pawslistbox.h.

int pawsListBox::sortColNum
protected

Definition at line 440 of file pawslistbox.h.

pawsListBoxRow* pawsListBox::titleRow
protected

Definition at line 437 of file pawslistbox.h.

int pawsListBox::topRow
protected

Definition at line 424 of file pawslistbox.h.

int pawsListBox::totalColumns
protected

Definition at line 420 of file pawslistbox.h.

int pawsListBox::totalRows
protected

Definition at line 421 of file pawslistbox.h.

bool pawsListBox::useBorder
protected

Definition at line 458 of file pawslistbox.h.

bool pawsListBox::usingTitleRow
protected

Definition at line 415 of file pawslistbox.h.

csString pawsListBox::xmlbinding_row
protected

Definition at line 438 of file pawslistbox.h.

int pawsListBox::xMod
protected

Definition at line 426 of file pawslistbox.h.


The documentation for this class was generated from the following file: