Crazy Eddie's GUI System 0.8.7
Loading...
Searching...
No Matches
widgets/ListHeaderSegment.h
1/***********************************************************************
2 created: 15/6/2004
3 author: Paul D Turner
4
5 purpose: Interface to list header segment class.
6*************************************************************************/
7/***************************************************************************
8 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * a copy of this software and associated documentation files (the
12 * "Software"), to deal in the Software without restriction, including
13 * without limitation the rights to use, copy, modify, merge, publish,
14 * distribute, sublicense, and/or sell copies of the Software, and to
15 * permit persons to whom the Software is furnished to do so, subject to
16 * the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
25 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
26 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
27 * OTHER DEALINGS IN THE SOFTWARE.
28 ***************************************************************************/
29#ifndef _CEGUIListHeaderSegment_h_
30#define _CEGUIListHeaderSegment_h_
31
32#include "../Base.h"
33#include "../Window.h"
34
35
36#if defined(_MSC_VER)
37# pragma warning(push)
38# pragma warning(disable : 4251)
39#endif
40
41
42// Start of CEGUI namespace section
43namespace CEGUI
44{
49class CEGUIEXPORT ListHeaderSegment : public Window
50{
51public:
52 static const String EventNamespace;
53 static const String WidgetTypeName;
54
55
56 /*************************************************************************
57 Constants
58 *************************************************************************/
59 // Event names
119
120 // Defaults
121 static const float DefaultSizingArea;
122 static const float SegmentMoveThreshold;
123
124
125 /*************************************************************************
126 Enumerated types
127 *************************************************************************/
133 {
136 Descending
137 };
138
139
140 /*************************************************************************
141 Accessor Methods
142 *************************************************************************/
150 bool isSizingEnabled(void) const {return d_sizingEnabled;}
151
152
165 SortDirection getSortDirection(void) const {return d_sortDir;}
166
167
175 bool isDragMovingEnabled(void) const {return d_movingEnabled;}
176
177
185 const Vector2f& getDragMoveOffset(void) const {return d_dragPosition;}
186
187
195 bool isClickable(void) const {return d_allowClicks;}
196
197
202 bool isSegmentHovering(void) const {return d_segmentHover;}
203
204
209 bool isSegmentPushed(void) const {return d_segmentPushed;}
210
211
216 bool isSplitterHovering(void) const {return d_splitterHover;}
217
218
223 bool isBeingDragMoved(void) const {return d_dragMoving;}
224
225
230 bool isBeingDragSized(void) const {return d_dragSizing;}
231
232
233 const Image* getSizingCursorImage() const;
234 const Image* getMovingCursorImage() const;
235
236
237 /*************************************************************************
238 Manipulator Methods
239 *************************************************************************/
250 void setSizingEnabled(bool setting);
251
252
269
270
281 void setDragMovingEnabled(bool setting);
282
283
294 void setClickable(bool setting);
295
296
297 void setSizingCursorImage(const Image* image);
298 void setSizingCursorImage(const String& name);
299 void setMovingCursorImage(const Image* image);
300 void setMovingCursorImage(const String& name);
301
302
303 /*************************************************************************
304 Construction & Destruction
305 *************************************************************************/
310 ListHeaderSegment(const String& type, const String& name);
311
312
317 virtual ~ListHeaderSegment(void);
318
319
320protected:
321 /*************************************************************************
322 Implementation Methods
323 *************************************************************************/
334 void doDragSizing(const Vector2f& local_mouse);
335
336
347 void doDragMoving(const Vector2f& local_mouse);
348
349
354 void initDragMoving(void);
355
356
362
363
369
370
383 bool isDragMoveThresholdExceeded(const Vector2f& local_mouse);
384
385 /*************************************************************************
386 New Event Handlers
387 *************************************************************************/
393
394
400
401
407
408
414
415
421
422
428
429
435
436
442
443
449
450
456
457
458 /*************************************************************************
459 Overridden Event Handlers
460 *************************************************************************/
461 virtual void onMouseMove(MouseEventArgs& e);
467
468
469 /*************************************************************************
470 Implementation Data
471 *************************************************************************/
474
477
480
482
490
491private:
492 /*************************************************************************
493 Private methods
494 *************************************************************************/
495 void addHeaderSegmentProperties(void);
496};
497
498
499template<>
501{
502public:
507
508 static const String& getDataTypeName()
509 {
510 static String type("SortDirection");
511
512 return type;
513 }
514
515 static return_type fromString(const String& str)
516 {
517 if (str == "Ascending")
518 {
520 }
521 else if (str == "Descending")
522 {
524 }
525 else
526 {
528 }
529 }
530
531 static string_return_type toString(pass_type val)
532 {
533 if (val == ListHeaderSegment::None)
534 {
535 return "None";
536 }
537 else if (val == ListHeaderSegment::Ascending)
538 {
539 return "Ascending";
540 }
541 else if (val == ListHeaderSegment::Descending)
542 {
543 return "Descending";
544 }
545 else
546 {
547 assert(false && "Invalid Sort Direction");
548 return "Ascending";
549 }
550 }
551};
552
553} // End of CEGUI namespace section
554
555#if defined(_MSC_VER)
556# pragma warning(pop)
557#endif
558
559#endif // end of guard _CEGUIListHeaderSegment_h_
Interface for Image.
Definition Image.h:161
Base class for list header segment window.
Definition widgets/ListHeaderSegment.h:50
bool d_segmentHover
true when the mouse is within the segment area (and not in sizing area).
Definition widgets/ListHeaderSegment.h:483
static const String EventClickableSettingChanged
Definition widgets/ListHeaderSegment.h:118
const Vector2f & getDragMoveOffset(void) const
Return the current drag move position offset (in pixels relative to the top-left corner of the segmen...
Definition widgets/ListHeaderSegment.h:185
static const float SegmentMoveThreshold
Amount the mouse must be dragged before drag-moving is initiated.
Definition widgets/ListHeaderSegment.h:122
static const String EventSortDirectionChanged
Definition widgets/ListHeaderSegment.h:82
virtual void onMouseButtonUp(MouseEventArgs &e)
Handler called when a mouse button has been released within this window's area.
Vector2f d_dragPoint
point we are being dragged at when sizing or moving.
Definition widgets/ListHeaderSegment.h:479
virtual void onSegmentDragPositionChanged(WindowEventArgs &e)
Handler called when the drag position changes.
SortDirection getSortDirection(void) const
Return the current sort direction set for this segment.
Definition widgets/ListHeaderSegment.h:165
static const float DefaultSizingArea
Default size of the sizing area.
Definition widgets/ListHeaderSegment.h:121
void initSizingHoverState(void)
Initialise the required states when we are hovering over the sizing area.
bool d_dragSizing
true when we are being sized.
Definition widgets/ListHeaderSegment.h:478
static const String WidgetTypeName
Window factory name.
Definition widgets/ListHeaderSegment.h:53
virtual ~ListHeaderSegment(void)
Destructor for list header segment base class.
bool d_segmentPushed
true when the left mouse button has been pressed within the confines of the segment.
Definition widgets/ListHeaderSegment.h:484
void doDragSizing(const Vector2f &local_mouse)
Update state for drag sizing.
bool isSizingEnabled(void) const
Return whether this segment can be sized.
Definition widgets/ListHeaderSegment.h:150
ListHeaderSegment(const String &type, const String &name)
Constructor for list header segment base class.
float d_splitterSize
pixel width of the sizing area.
Definition widgets/ListHeaderSegment.h:475
virtual void onMouseLeaves(MouseEventArgs &e)
Handler called when the mouse cursor is no longer over this window's surface area....
static const String EventSegmentSized
Definition widgets/ListHeaderSegment.h:112
const Image * d_sizingMouseCursor
Image to use for mouse when sizing (typically set by derived class).
Definition widgets/ListHeaderSegment.h:472
void setSortDirection(SortDirection sort_dir)
Set the current sort direction set for this segment.
static const String EventSegmentDragStop
Definition widgets/ListHeaderSegment.h:100
virtual void onSegmentDragStop(WindowEventArgs &e)
Handler called when the user stops dragging the segment (releases mouse button)
static const String EventSizingSettingChanged
Definition widgets/ListHeaderSegment.h:76
void initSegmentHoverState(void)
Initialise the required states when we are hovering over the main segment area.
bool d_movingEnabled
True when drag-moving is enabled for this segment;.
Definition widgets/ListHeaderSegment.h:486
const Image * d_movingMouseCursor
Image to use for mouse when moving (typically set by derived class).
Definition widgets/ListHeaderSegment.h:473
bool isSegmentHovering(void) const
Return whether the segment is currently in its hovering state.
Definition widgets/ListHeaderSegment.h:202
static const String EventSegmentDragStart
Definition widgets/ListHeaderSegment.h:94
bool d_splitterHover
True if the mouse is over the splitter.
Definition widgets/ListHeaderSegment.h:476
bool isClickable(void) const
Return whether the segment is clickable.
Definition widgets/ListHeaderSegment.h:195
void setClickable(bool setting)
Set whether the segment is clickable.
virtual void onSegmentClicked(WindowEventArgs &e)
Handler called when segment is clicked.
virtual void onSizingSettingChanged(WindowEventArgs &e)
Handler called when sizing setting changes.
bool d_allowClicks
true if the segment can be clicked.
Definition widgets/ListHeaderSegment.h:489
virtual void onMouseDoubleClicked(MouseEventArgs &e)
Handler called when a mouse button has been double-clicked within this window's area.
virtual void onClickableSettingChanged(WindowEventArgs &e)
Handler called when the clickable setting for the segment changes.
virtual void onSegmentDragStart(WindowEventArgs &e)
Handler called when the user starts dragging the segment.
static const String EventSegmentClicked
Definition widgets/ListHeaderSegment.h:64
void setSizingEnabled(bool setting)
Set whether this segment can be sized.
bool isDragMoveThresholdExceeded(const Vector2f &local_mouse)
Return whether the required minimum movement threshold before initiating drag-moving has been exceede...
bool isSplitterHovering(void) const
Return whether the splitter is currently in its hovering state.
Definition widgets/ListHeaderSegment.h:216
virtual void onSortDirectionChanged(WindowEventArgs &e)
Handler called when the sort direction value changes.
bool isDragMovingEnabled(void) const
Return whether drag moving is enabled for this segment.
Definition widgets/ListHeaderSegment.h:175
Vector2f d_dragPosition
position of dragged segment.
Definition widgets/ListHeaderSegment.h:488
SortDirection
Enumeration of possible values for sorting direction used with ListHeaderSegment classes.
Definition widgets/ListHeaderSegment.h:133
@ None
Items under this segment should not be sorted.
Definition widgets/ListHeaderSegment.h:134
@ Ascending
Items under this segment should be sorted in ascending order.
Definition widgets/ListHeaderSegment.h:135
@ Descending
Items under this segment should be sorted in descending order.
Definition widgets/ListHeaderSegment.h:136
bool d_sizingEnabled
true when sizing is enabled for this segment.
Definition widgets/ListHeaderSegment.h:485
void initDragMoving(void)
Initialise the required states to put the widget into drag-moving mode.
static const String EventSplitterDoubleClicked
Definition widgets/ListHeaderSegment.h:70
bool isBeingDragMoved(void) const
Return whether the segment is currently being drag-moved.
Definition widgets/ListHeaderSegment.h:223
bool isSegmentPushed(void) const
Return whether the segment is currently in its pushed state.
Definition widgets/ListHeaderSegment.h:209
virtual void onCaptureLost(WindowEventArgs &e)
Handler called when this window loses capture of mouse inputs.
virtual void onSplitterDoubleClicked(WindowEventArgs &e)
Handler called when the sizer/splitter is double-clicked.
SortDirection d_sortDir
Direction for sorting (used for deciding what icon to display).
Definition widgets/ListHeaderSegment.h:481
bool isBeingDragSized(void) const
Return whether the segment is currently being drag-moved.
Definition widgets/ListHeaderSegment.h:230
static const String EventSegmentDragPositionChanged
Definition widgets/ListHeaderSegment.h:106
virtual void onSegmentSized(WindowEventArgs &e)
Handler called when the segment is sized.
virtual void onMouseMove(MouseEventArgs &e)
Handler called when the mouse cursor has been moved within this window's area.
virtual void onMouseButtonDown(MouseEventArgs &e)
Handler called when a mouse button has been depressed within this window's area.
static const String EventMovableSettingChanged
Definition widgets/ListHeaderSegment.h:88
virtual void onMovableSettingChanged(WindowEventArgs &e)
Handler called when the drag-movable setting is changed.
static const String EventNamespace
Namespace for global events.
Definition widgets/ListHeaderSegment.h:52
void doDragMoving(const Vector2f &local_mouse)
Update state for drag moving.
void setDragMovingEnabled(bool setting)
Set whether drag moving is allowed for this segment.
bool d_dragMoving
true when segment is being drag moved.
Definition widgets/ListHeaderSegment.h:487
EventArgs based class that is used for objects passed to input event handlers concerning mouse input.
Definition InputEvent.h:281
Helper class used to convert various data types to and from the format expected in Property strings.
Definition PropertyHelper.h:84
String class used within the GUI system.
Definition String.h:64
EventArgs based class that is used for objects passed to handlers triggered for events concerning som...
Definition InputEvent.h:252
An abstract base class providing common functionality and specifying the required interface for deriv...
Definition Window.h:151
Main namespace for Crazy Eddie's GUI Library.
Definition arch_overview.dox:1