/usr/include/CEGUI/elements/CEGUIListHeaderSegment.h is in libcegui-mk2-dev 0.7.6-2ubuntu4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 | /***********************************************************************
filename: CEGUIListHeaderSegment.h
created: 15/6/2004
author: Paul D Turner
purpose: Interface to list header segment class.
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
* IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
***************************************************************************/
#ifndef _CEGUIListHeaderSegment_h_
#define _CEGUIListHeaderSegment_h_
#include "../CEGUIBase.h"
#include "../CEGUIWindow.h"
#include "CEGUIListHeaderSegmentProperties.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
Base class for list header segment window
*/
class CEGUIEXPORT ListHeaderSegment : public Window
{
public:
static const String EventNamespace; //!< Namespace for global events
static const String WidgetTypeName; //!< Window factory name
/*************************************************************************
Constants
*************************************************************************/
// Event names
/** Event fired when the segment is clicked.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment that was clicked.
*/
static const String EventSegmentClicked;
/** Event fired when the sizer/splitter is double-clicked.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment whose
* sizer / splitter area was double-clicked.
*/
static const String EventSplitterDoubleClicked;
/** Event fired when the user drag-sizable setting is changed.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment whose user sizable
* setting has been changed.
*/
static const String EventSizingSettingChanged;
/** Event fired when the sort direction value is changed.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment whose sort direction
* has been changed.
*/
static const String EventSortDirectionChanged;
/** Event fired when the user drag-movable setting is changed.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment whose user
* drag-movable setting has been changed.
*/
static const String EventMovableSettingChanged;
/** Event fired when the segment has started to be dragged.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment that has started to
* be dragged.
*/
static const String EventSegmentDragStart;
/** Event fired when segment dragging has stopped (via mouse release).
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment that is no longer
* being dragged.
*/
static const String EventSegmentDragStop;
/** Event fired when the segment drag position has changed.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment whose position has
* changed due to being dragged.
*/
static const String EventSegmentDragPositionChanged;
/** Event fired when the segment is sized by the user.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment that has been
* resized by the user dragging.
*/
static const String EventSegmentSized;
/** Event fired when the clickable setting for the segment is changed.
* Hanlders are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ListHeaderSegment whose setting that
* controls whether the segment is clickable has been changed.
*/
static const String EventClickableSettingChanged;
// Defaults
static const float DefaultSizingArea; //!< Default size of the sizing area.
static const float SegmentMoveThreshold; //!< Amount the mouse must be dragged before drag-moving is initiated.
/*************************************************************************
Enumerated types
*************************************************************************/
/*!
\brief
Enumeration of possible values for sorting direction used with ListHeaderSegment classes
*/
enum SortDirection
{
None, //!< Items under this segment should not be sorted.
Ascending, //!< Items under this segment should be sorted in ascending order.
Descending //!< Items under this segment should be sorted in descending order.
};
/*************************************************************************
Accessor Methods
*************************************************************************/
/*!
\brief
Return whether this segment can be sized.
\return
true if the segment can be horizontally sized, false if the segment can not be horizontally sized.
*/
bool isSizingEnabled(void) const {return d_sizingEnabled;}
/*!
\brief
Return the current sort direction set for this segment.
Note that this has no impact on the way the segment functions (aside from the possibility
of varied rendering). This is intended as a 'helper setting' to classes that make use of
the ListHeaderSegment objects.
\return
One of the SortDirection enumerated values indicating the current sort direction set for this
segment.
*/
SortDirection getSortDirection(void) const {return d_sortDir;}
/*!
\brief
Return whether drag moving is enabled for this segment.
\return
true if the segment can be drag moved, false if the segment can not be drag moved.
*/
bool isDragMovingEnabled(void) const {return d_movingEnabled;}
/*!
\brief
Return the current drag move position offset (in pixels relative to the top-left corner of the segment).
\return
Point object describing the drag move offset position.
*/
const Point& getDragMoveOffset(void) const {return d_dragPosition;}
/*!
\brief
Return whether the segment is clickable.
\return
true if the segment can be clicked, false of the segment can not be clicked (so no highlighting or events will happen).
*/
bool isClickable(void) const {return d_allowClicks;}
/*!
\brief
Return whether the segment is currently in its hovering state.
*/
bool isSegmentHovering(void) const {return d_segmentHover;}
/*!
\brief
Return whether the segment is currently in its pushed state.
*/
bool isSegmentPushed(void) const {return d_segmentPushed;}
/*!
\brief
Return whether the splitter is currently in its hovering state.
*/
bool isSplitterHovering(void) const {return d_splitterHover;}
/*!
\brief
Return whether the segment is currently being drag-moved.
*/
bool isBeingDragMoved(void) const {return d_dragMoving;}
/*!
\brief
Return whether the segment is currently being drag-moved.
*/
bool isBeingDragSized(void) const {return d_dragSizing;}
const Image* getSizingCursorImage() const;
const Image* getMovingCursorImage() const;
/*************************************************************************
Manipulator Methods
*************************************************************************/
/*!
\brief
Set whether this segment can be sized.
\param setting
true if the segment may be horizontally sized, false if the segment may not be horizontally sized.
\return
Nothing.
*/
void setSizingEnabled(bool setting);
/*!
\brief
Set the current sort direction set for this segment.
Note that this has no impact on the way the segment functions (aside from the possibility
of varied rendering). This is intended as a 'helper setting' to classes that make use of
the ListHeaderSegment objects.
\param sort_dir
One of the SortDirection enumerated values indicating the current sort direction set for this
segment.
\return
Nothing
*/
void setSortDirection(SortDirection sort_dir);
/*!
\brief
Set whether drag moving is allowed for this segment.
\param setting
true if the segment may be drag moved, false if the segment may not be drag moved.
\return
Nothing.
*/
void setDragMovingEnabled(bool setting);
/*!
\brief
Set whether the segment is clickable.
\param setting
true if the segment may be clicked, false of the segment may not be clicked (so no highlighting or events will happen).
\return
Nothing.
*/
void setClickable(bool setting);
void setSizingCursorImage(const Image* image);
void setSizingCursorImage(const String& imageset, const String& image);
void setMovingCursorImage(const Image* image);
void setMovingCursorImage(const String& imageset, const String& image);
/*************************************************************************
Construction & Destruction
*************************************************************************/
/*!
\brief
Constructor for list header segment base class
*/
ListHeaderSegment(const String& type, const String& name);
/*!
\brief
Destructor for list header segment base class.
*/
virtual ~ListHeaderSegment(void);
protected:
/*************************************************************************
Implementation Methods
*************************************************************************/
/*!
\brief
Update state for drag sizing.
\param local_mouse
Mouse position as a pixel offset from the top-left corner of this window.
\return
Nothing.
*/
void doDragSizing(const Point& local_mouse);
/*!
\brief
Update state for drag moving.
\param local_mouse
Mouse position as a pixel offset from the top-left corner of this window.
\return
Nothing.
*/
void doDragMoving(const Point& local_mouse);
/*!
\brief
Initialise the required states to put the widget into drag-moving mode.
*/
void initDragMoving(void);
/*!
\brief
Initialise the required states when we are hovering over the sizing area.
*/
void initSizingHoverState(void);
/*!
\brief
Initialise the required states when we are hovering over the main segment area.
*/
void initSegmentHoverState(void);
/*!
\brief
Return whether the required minimum movement threshold before initiating drag-moving
has been exceeded.
\param local_mouse
Mouse position as a pixel offset from the top-left corner of this window.
\return
true if the threshold has been exceeded and drag-moving should be initiated, or false
if the threshold has not been exceeded.
*/
bool isDragMoveThresholdExceeded(const Point& local_mouse);
/*!
\brief
Return whether this window was inherited from the given class name at some point in the inheritance hierarchy.
\param class_name
The class name that is to be checked.
\return
true if this window was inherited from \a class_name. false if not.
*/
virtual bool testClassName_impl(const String& class_name) const
{
if (class_name=="ListHeaderSegment") return true;
return Window::testClassName_impl(class_name);
}
/*************************************************************************
New Event Handlers
*************************************************************************/
/*!
\brief
Handler called when segment is clicked.
*/
virtual void onSegmentClicked(WindowEventArgs& e);
/*!
\brief
Handler called when the sizer/splitter is double-clicked.
*/
virtual void onSplitterDoubleClicked(WindowEventArgs& e);
/*!
\brief
Handler called when sizing setting changes.
*/
virtual void onSizingSettingChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the sort direction value changes.
*/
virtual void onSortDirectionChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the drag-movable setting is changed.
*/
virtual void onMovableSettingChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the user starts dragging the segment.
*/
virtual void onSegmentDragStart(WindowEventArgs& e);
/*!
\brief
Handler called when the user stops dragging the segment (releases mouse button)
*/
virtual void onSegmentDragStop(WindowEventArgs& e);
/*!
\brief
Handler called when the drag position changes.
*/
virtual void onSegmentDragPositionChanged(WindowEventArgs& e);
/*!
\brief
Handler called when the segment is sized.
*/
virtual void onSegmentSized(WindowEventArgs& e);
/*!
\brief
Handler called when the clickable setting for the segment changes
*/
virtual void onClickableSettingChanged(WindowEventArgs& e);
/*************************************************************************
Overridden Event Handlers
*************************************************************************/
virtual void onMouseMove(MouseEventArgs& e);
virtual void onMouseButtonDown(MouseEventArgs& e);
virtual void onMouseButtonUp(MouseEventArgs& e);
virtual void onMouseDoubleClicked(MouseEventArgs& e);
virtual void onMouseLeaves(MouseEventArgs& e);
virtual void onCaptureLost(WindowEventArgs& e);
/*************************************************************************
Implementation Data
*************************************************************************/
const Image* d_sizingMouseCursor; //!< Image to use for mouse when sizing (typically set by derived class).
const Image* d_movingMouseCursor; //!< Image to use for mouse when moving (typically set by derived class).
float d_splitterSize; //!< pixel width of the sizing area.
bool d_splitterHover; //!< True if the mouse is over the splitter
bool d_dragSizing; //!< true when we are being sized.
Point d_dragPoint; //!< point we are being dragged at when sizing or moving.
SortDirection d_sortDir; //!< Direction for sorting (used for deciding what icon to display).
bool d_segmentHover; //!< true when the mouse is within the segment area (and not in sizing area).
bool d_segmentPushed; //!< true when the left mouse button has been pressed within the confines of the segment.
bool d_sizingEnabled; //!< true when sizing is enabled for this segment.
bool d_movingEnabled; //!< True when drag-moving is enabled for this segment;
bool d_dragMoving; //!< true when segment is being drag moved.
Point d_dragPosition; //!< position of dragged segment.
bool d_allowClicks; //!< true if the segment can be clicked.
private:
/*************************************************************************
Static Properties for this class
*************************************************************************/
static ListHeaderSegmentProperties::Clickable d_clickableProperty;
static ListHeaderSegmentProperties::Dragable d_dragableProperty;
static ListHeaderSegmentProperties::Sizable d_sizableProperty;
static ListHeaderSegmentProperties::SortDirection d_sortDirectionProperty;
static ListHeaderSegmentProperties::SizingCursorImage d_sizingCursorProperty;
static ListHeaderSegmentProperties::MovingCursorImage d_movingCursorProperty;
/*************************************************************************
Private methods
*************************************************************************/
void addHeaderSegmentProperties(void);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIListHeaderSegment_h_
|