newspeoplefor developersdocumentationdownloads

nGuiDragBox Class Reference
[Graphical User Interface]

#include <nguidragbox.h>

Inheritance diagram for nGuiDragBox:

nGuiWidget nRoot nObject nNode nReferenced nSignalEmitter List of all members.

Detailed Description

Implements a drag box as 2d screen space rectangle.

While the dragbox widget is enabled, left-clicking and moving the mouse will open the drag box. The following events will be generated:

  • DragBoxStarted - a drag box operation has started
  • DragBoxFinished - a drag box operation has been successfully finished
  • DragBoxCancelled - drag box operation has been cancelled
  • DragBoxUpdated - the drag box has been updated

If the drag box is smaller then the size threshold, no drag box will be rendered.

(C) 2004 RadonLabs GmbH

Definition at line 26 of file nguidragbox.h.


Public Member Functions

 nGuiDragBox ()
 constructor
virtual ~nGuiDragBox ()
 destructor
void SetDragThreshold (float s)
 set the drag size threshold in screen space units
float GetDragThreshold () const
 get the drag size threshold in screen space units
virtual void OnShow ()
 called when widget is becoming visible
virtual void OnHide ()
 called when widget is becoming invisible
virtual bool OnButtonDown (const vector2 &mousePos)
 handle button down
virtual bool OnButtonUp (const vector2 &mousePos)
 handle button up
virtual bool OnRButtonDown (const vector2 &mousePos)
 handle right button down
virtual bool OnMouseMoved (const vector2 &mousePos)
 handle mouse move
virtual bool Render ()
 rendering
bool IsDragging () const
 return true if currently dragging
bool IsDragBoxValid () const
 return true if the drag box data is valid
const rectangleGetDragBox2D () const
 return the current drag box in screen space
bool IsWorldCoordInDragBox (const vector3 &pos) const
 return true if world space position is inside current drag box
void CancelDragging ()
 manually cancel the current dragging operation

Constructor & Destructor Documentation

nGuiDragBox::nGuiDragBox  ) 
 

constructor

Definition at line 14 of file nguidragbox_main.cc.

nGuiDragBox::~nGuiDragBox  )  [virtual]
 

destructor

Definition at line 26 of file nguidragbox_main.cc.


Member Function Documentation

void nGuiDragBox::SetDragThreshold float  s  )  [inline]
 

set the drag size threshold in screen space units

Set the mouse-move distance from the start point until a drag operation is valid in screen space. To set the threshold in pixels, compute numPixels / displayResolution.

Definition at line 82 of file nguidragbox.h.

float nGuiDragBox::GetDragThreshold  )  const [inline]
 

get the drag size threshold in screen space units

Returns the drag threshold distance.

Definition at line 94 of file nguidragbox.h.

void nGuiDragBox::OnShow  )  [virtual]
 

called when widget is becoming visible

Registers the drag box as event listener.

Reimplemented from nGuiWidget.

Definition at line 36 of file nguidragbox_main.cc.

void nGuiDragBox::OnHide  )  [virtual]
 

called when widget is becoming invisible

Unregisters the drag box as event listener.

Reimplemented from nGuiWidget.

Definition at line 47 of file nguidragbox_main.cc.

bool nGuiDragBox::OnButtonDown const vector2 mousePos  )  [virtual]
 

handle button down

Called when left mouse button is pressed down. This initializes a new drag operation and emits a DragBoxStarted event

Reimplemented from nGuiWidget.

Definition at line 59 of file nguidragbox_main.cc.

bool nGuiDragBox::OnButtonUp const vector2 mousePos  )  [virtual]
 

handle button up

Called when left mouse button is released. If the drag box is valid (if the release pos is farther away from the start pos then the drag threshold), a DragBoxSelection event will be generated.

Reimplemented from nGuiWidget.

Definition at line 78 of file nguidragbox_main.cc.

bool nGuiDragBox::OnRButtonDown const vector2 mousePos  )  [virtual]
 

handle right button down

Called when right mouse button is pressed. If a drag operation is in progress, a DragBoxCancelled event will be generated.

Reimplemented from nGuiWidget.

Definition at line 99 of file nguidragbox_main.cc.

bool nGuiDragBox::OnMouseMoved const vector2 mousePos  )  [virtual]
 

handle mouse move

Called when mouse is moved. If a valid drag operation is in progress, a DragBoxUpdated event will be generated.

Reimplemented from nGuiWidget.

Definition at line 129 of file nguidragbox_main.cc.

bool nGuiDragBox::Render  )  [virtual]
 

rendering

Render the drag box. We assume that our widget rectangle has been updated by UpdateDragBox().

Reimplemented from nGuiWidget.

Definition at line 155 of file nguidragbox_main.cc.

bool nGuiDragBox::IsDragging  )  const [inline]
 

return true if currently dragging

Definition at line 104 of file nguidragbox.h.

bool nGuiDragBox::IsDragBoxValid  )  const [inline]
 

return true if the drag box data is valid

Definition at line 114 of file nguidragbox.h.

const rectangle & nGuiDragBox::GetDragBox2D  )  const [inline]
 

return the current drag box in screen space

Definition at line 124 of file nguidragbox.h.

bool nGuiDragBox::IsWorldCoordInDragBox const vector3 pos  )  const
 

return true if world space position is inside current drag box

Return true if a world space position is inside the current drag box.

Definition at line 213 of file nguidragbox_main.cc.

void nGuiDragBox::CancelDragging  ) 
 

manually cancel the current dragging operation

Manually cancel the drag box.

Definition at line 115 of file nguidragbox_main.cc.


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

Copyright © 1999-2005 by the contributing authors. Ideas, requests, problems: Send feedback.