/usr/include/CEGUI/elements/CEGUIScrollablePane.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 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 | /***********************************************************************
filename: CEGUIScrollablePane.h
created: 1/3/2005
author: Paul D Turner
*************************************************************************/
/***************************************************************************
* Copyright (C) 2004 - 2009 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 _CEGUIScrollablePane_h_
#define _CEGUIScrollablePane_h_
#include "../CEGUIBase.h"
#include "../CEGUIWindow.h"
#include "CEGUIScrollablePaneProperties.h"
#if defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable : 4251)
#endif
// Start of CEGUI namespace section
namespace CEGUI
{
//! Base class for ScrollablePane window renderer objects.
class CEGUIEXPORT ScrollablePaneWindowRenderer : public WindowRenderer
{
public:
//! Constructor
ScrollablePaneWindowRenderer(const String& name);
/*!
\brief
Return a Rect that described the pane's viewable area, relative
to this Window, in pixels.
\return
Rect object describing the ScrollablePane's viewable area.
*/
virtual Rect getViewableArea(void) const = 0;
};
/*!
\brief
Base class for the ScrollablePane widget.
The ScrollablePane widget allows child windows to be attached which cover an
area larger than the ScrollablePane itself and these child windows can be
scrolled into view using the scrollbars of the scrollable pane.
*/
class CEGUIEXPORT ScrollablePane : public Window
{
public:
//! Window factory name
static const String WidgetTypeName;
//! Namespace for global events
static const String EventNamespace;
/** Event fired when an area on the content pane has been updated.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ScrollablePane whose content pane
* has been updated.
*/
static const String EventContentPaneChanged;
/** Event fired when the vertical scroll bar 'force' setting is changed.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ScrollablePane whose vertical scroll
* bar mode has been changed.
*/
static const String EventVertScrollbarModeChanged;
/** Event fired when the horizontal scroll bar 'force' setting is changed.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ScrollablePane whose horizontal scroll
* bar mode has been changed.
*/
static const String EventHorzScrollbarModeChanged;
/** Event fired when the auto size setting for the pane is changed.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ScrollablePane whose auto size
* setting has been changed.
*/
static const String EventAutoSizeSettingChanged;
/** Event fired when the pane gets scrolled.
* Handlers are passed a const WindowEventArgs reference with
* WindowEventArgs::window set to the ScrollablePane that has been scrolled.
*/
static const String EventContentPaneScrolled;
//! Widget name suffix for the vertical scrollbar component.
static const String VertScrollbarNameSuffix;
//! Widget name suffix for the horizontal scrollbar component.
static const String HorzScrollbarNameSuffix;
//! Widget name suffix for the scrolled container component.
static const String ScrolledContainerNameSuffix;
//! Constructor for the ScrollablePane base class.
ScrollablePane(const String& type, const String& name);
//! Destructor for the ScrollablePane base class.
~ScrollablePane(void);
/*!
\brief
Returns a pointer to the window holding the pane contents.
The purpose of this is so that attached windows may be inspected,
client code may not modify the returned window in any way.
\return
Pointer to the ScrolledContainer that is acting as the container for the
scrollable pane content. The returned window is const, client code
should not modify the ScrolledContainer settings directly.
*/
const ScrolledContainer* getContentPane(void) const;
/*!
\brief
Return whether the vertical scroll bar is always shown.
\return
- true if the scroll bar will be shown even if it is not required.
- false if the scroll bar will only be shown when it is required.
*/
bool isVertScrollbarAlwaysShown(void) const;
/*!
\brief
Set whether the vertical scroll bar should always be shown.
\param setting
- true if the vertical scroll bar should be shown even when it is not
required.
- false if the vertical scroll bar should only be shown when it is
required.
\return
Nothing.
*/
void setShowVertScrollbar(bool setting);
/*!
\brief
Return whether the horizontal scroll bar is always shown.
\return
- true if the scroll bar will be shown even if it is not required.
- false if the scroll bar will only be shown when it is required.
*/
bool isHorzScrollbarAlwaysShown(void) const;
/*!
\brief
Set whether the horizontal scroll bar should always be shown.
\param setting
- true if the horizontal scroll bar should be shown even when it is not
required.
- false if the horizontal scroll bar should only be shown when it is
required.
\return
Nothing.
*/
void setShowHorzScrollbar(bool setting);
/*!
\brief
Return whether the content pane is auto sized.
\return
- true to indicate the content pane will automatically resize itself.
- false to indicate the content pane will not automatically resize
itself.
*/
bool isContentPaneAutoSized(void) const;
/*!
\brief
Set whether the content pane should be auto-sized.
\param setting
- true to indicate the content pane should automatically resize itself.
- false to indicate the content pane should not automatically resize
itself.
\return
Nothing.
*/
void setContentPaneAutoSized(bool setting);
/*!
\brief
Return the current content pane area for the ScrollablePane.
\return
Rect object that details the current pixel extents of the content
pane attached to this ScrollablePane.
*/
const Rect& getContentPaneArea(void) const;
/*!
\brief
Set the current content pane area for the ScrollablePane.
\note
If the ScrollablePane is configured to auto-size the content pane
this call will have no effect.
\param area
Rect object that details the pixel extents to use for the content
pane attached to this ScrollablePane.
\return
Nothing.
*/
void setContentPaneArea(const Rect& area);
/*!
\brief
Returns the horizontal scrollbar step size as a fraction of one
complete view page.
\return
float value specifying the step size where 1.0f would be the width of
the viewing area.
*/
float getHorizontalStepSize(void) const;
/*!
\brief
Sets the horizontal scrollbar step size as a fraction of one
complete view page.
\param step
float value specifying the step size, where 1.0f would be the width of
the viewing area.
\return
Nothing.
*/
void setHorizontalStepSize(float step);
/*!
\brief
Returns the horizontal scrollbar overlap size as a fraction of one
complete view page.
\return
float value specifying the overlap size where 1.0f would be the width of
the viewing area.
*/
float getHorizontalOverlapSize(void) const;
/*!
\brief
Sets the horizontal scrollbar overlap size as a fraction of one
complete view page.
\param overlap
float value specifying the overlap size, where 1.0f would be the width
of the viewing area.
\return
Nothing.
*/
void setHorizontalOverlapSize(float overlap);
/*!
\brief
Returns the horizontal scroll position as a fraction of the
complete scrollable width.
\return
float value specifying the scroll position.
*/
float getHorizontalScrollPosition(void) const;
/*!
\brief
Sets the horizontal scroll position as a fraction of the
complete scrollable width.
\param position
float value specifying the new scroll position.
\return
Nothing.
*/
void setHorizontalScrollPosition(float position);
/*!
\brief
Returns the vertical scrollbar step size as a fraction of one
complete view page.
\return
float value specifying the step size where 1.0f would be the height of
the viewing area.
*/
float getVerticalStepSize(void) const;
/*!
\brief
Sets the vertical scrollbar step size as a fraction of one
complete view page.
\param step
float value specifying the step size, where 1.0f would be the height of
the viewing area.
\return
Nothing.
*/
void setVerticalStepSize(float step);
/*!
\brief
Returns the vertical scrollbar overlap size as a fraction of one
complete view page.
\return
float value specifying the overlap size where 1.0f would be the height
of the viewing area.
*/
float getVerticalOverlapSize(void) const;
/*!
\brief
Sets the vertical scrollbar overlap size as a fraction of one
complete view page.
\param overlap
float value specifying the overlap size, where 1.0f would be the height
of the viewing area.
\return
Nothing.
*/
void setVerticalOverlapSize(float overlap);
/*!
\brief
Returns the vertical scroll position as a fraction of the
complete scrollable height.
\return
float value specifying the scroll position.
*/
float getVerticalScrollPosition(void) const;
/*!
\brief
Sets the vertical scroll position as a fraction of the
complete scrollable height.
\param position
float value specifying the new scroll position.
\return
Nothing.
*/
void setVerticalScrollPosition(float position);
/*!
\brief
Return a Rect that described the pane's viewable area, relative
to this Window, in pixels.
\return
Rect object describing the ScrollablePane's viewable area.
*/
Rect getViewableArea(void) const;
/*!
\brief
Return a pointer to the vertical scrollbar component widget for this
ScrollablePane.
\return
Pointer to a Scrollbar object.
\exception UnknownObjectException
Thrown if the vertical Scrollbar component does not exist.
*/
Scrollbar* getVertScrollbar() const;
/*!
\brief
Return a pointer to the horizontal scrollbar component widget for
this ScrollablePane.
\return
Pointer to a Scrollbar object.
\exception UnknownObjectException
Thrown if the horizontal Scrollbar component does not exist.
*/
Scrollbar* getHorzScrollbar() const;
// Overridden from Window
void initialiseComponents(void);
void destroy(void);
protected:
/*!
\brief
display required integrated scroll bars according to current size of
the ScrollablePane view area and the size of the attached
ScrolledContainer.
*/
void configureScrollbars(void);
/*!
\brief
Return whether the vertical scrollbar is needed.
\return
- true if the scrollbar is either needed or forced via setting.
- false if the scrollbar should not be shown.
*/
bool isVertScrollbarNeeded(void) const;
/*!
\brief
Return whether the horizontal scrollbar is needed.
\return
- true if the scrollbar is either needed or forced via setting.
- false if the scrollbar should not be shown.
*/
bool isHorzScrollbarNeeded(void) const;
/*!
\brief
Update the content container position according to the current
state of the widget (like scrollbar positions, etc).
*/
void updateContainerPosition(void);
/*!
\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=="ScrollablePane")
return true;
return Window::testClassName_impl(class_name);
}
/*!
\brief
Return a pointer to the ScrolledContainer component widget for this
ScrollablePane.
\return
Pointer to a ScrolledContainer object.
\exception UnknownObjectException
Thrown if the scrolled container component does not exist.
*/
ScrolledContainer* getScrolledContainer() const;
// validate window renderer
virtual bool validateWindowRenderer(const String& name) const
{
return (name == "ScrollablePane");
}
/*************************************************************************
Event triggers
*************************************************************************/
/*!
\brief
Event trigger method called when some pane content has changed size
or location.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onContentPaneChanged(WindowEventArgs& e);
/*!
\brief
Event trigger method called when the setting that controls whether the
vertical scrollbar is always shown or not, is changed.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
/*!
\brief
Event trigger method called when the setting that controls whether the
horizontal scrollbar is always shown or not, is changed.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
/*!
\brief
Notification method called whenever the setting that controls whether
the content pane is automatically sized is changed.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
/*!
\brief
Notification method called whenever the content pane is scrolled via
changes in the scrollbar positions.
\param e
WindowEventArgs object.
\return
Nothing.
*/
virtual void onContentPaneScrolled(WindowEventArgs& e);
/*************************************************************************
Event handler methods
*************************************************************************/
/*!
\brief
Handler method which gets subscribed to the scrollbar position change
events.
*/
bool handleScrollChange(const EventArgs& e);
/*!
\brief
Handler method which gets subscribed to the ScrolledContainer content
change events.
*/
bool handleContentAreaChange(const EventArgs& e);
/*!
\brief
Handler method which gets subscribed to the ScrolledContainer auto-size
setting changes.
*/
bool handleAutoSizePaneChanged(const EventArgs& e);
// Overridden from Window
void addChild_impl(Window* wnd);
void removeChild_impl(Window* wnd);
void onSized(WindowEventArgs& e);
void onMouseWheel(MouseEventArgs& e);
//! true if vertical scrollbar should always be displayed
bool d_forceVertScroll;
//! true if horizontal scrollbar should always be displayed
bool d_forceHorzScroll;
//! holds content area so we can track changes.
Rect d_contentRect;
//! vertical scroll step fraction.
float d_vertStep;
//! vertical scroll overlap fraction.
float d_vertOverlap;
//! horizontal scroll step fraction.
float d_horzStep;
//! horizontal scroll overlap fraction.
float d_horzOverlap;
//! Event connection to content pane
Event::Connection d_contentChangedConn;
//! Event connection to content pane
Event::Connection d_autoSizeChangedConn;
private:
static ScrollablePaneProperties::ForceHorzScrollbar d_horzScrollbarProperty;
static ScrollablePaneProperties::ForceVertScrollbar d_vertScrollbarProperty;
static ScrollablePaneProperties::ContentPaneAutoSized d_autoSizedProperty;
static ScrollablePaneProperties::ContentArea d_contentAreaProperty;
static ScrollablePaneProperties::HorzStepSize d_horzStepProperty;
static ScrollablePaneProperties::HorzOverlapSize d_horzOverlapProperty;
static ScrollablePaneProperties::HorzScrollPosition d_horzScrollPositionProperty;
static ScrollablePaneProperties::VertStepSize d_vertStepProperty;
static ScrollablePaneProperties::VertOverlapSize d_vertOverlapProperty;
static ScrollablePaneProperties::VertScrollPosition d_vertScrollPositionProperty;
void addScrollablePaneProperties(void);
};
} // End of CEGUI namespace section
#if defined(_MSC_VER)
# pragma warning(pop)
#endif
#endif // end of guard _CEGUIScrollablePane_h_
|