This file is indexed.

/usr/include/CEGUI/elements/CEGUIScrollbar.h is in libcegui-mk2-dev 0.7.5-8.

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
/***********************************************************************
    filename:   CEGUIScrollbar.h
    created:    13/4/2004
    author:     Paul D Turner
*************************************************************************/
/***************************************************************************
 *   Copyright (C) 2004 - 2010 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 _CEGUIScrollbar_h_
#define _CEGUIScrollbar_h_

#include "../CEGUIBase.h"
#include "../CEGUIWindow.h"
#include "CEGUIScrollbarProperties.h"

#if defined(_MSC_VER)
#   pragma warning(push)
#   pragma warning(disable : 4251)
#endif

// Start of CEGUI namespace section
namespace CEGUI
{
/*!
\brief
    Base class for Scrollbar window renderer objects.
*/
class CEGUIEXPORT ScrollbarWindowRenderer : public WindowRenderer
{
public:
    /*!
    \brief
        Constructor
    */
    ScrollbarWindowRenderer(const String& name);

    /*!
    \brief
        update the size and location of the thumb to properly represent the
        current state of the scroll bar
    */
    virtual void updateThumb(void) = 0;

    /*!
    \brief
        return value that best represents current scroll bar position given the
        current location of the thumb.

    \return
        float value that, given the thumb widget position, best represents the
        current position for the scroll bar.
    */
    virtual float getValueFromThumb(void) const = 0;

    /*!
    \brief
        Given window location \a pt, return a value indicating what change
        should be made to the scroll bar.

    \param pt
        Point object describing a pixel position in window space.

    \return
        - -1 to indicate scroll bar position should be moved to a lower value.
        -  0 to indicate scroll bar position should not be changed.
        - +1 to indicate scroll bar position should be moved to a higher value.
    */
    virtual float getAdjustDirectionFromPoint(const Point& pt) const  = 0;
};

/*!
\brief
    Base scroll bar class.

    This base class for scroll bars does not have any idea of direction - a
    derived class would add whatever meaning is appropriate according to what
    that derived class represents to the user.
*/
class CEGUIEXPORT Scrollbar : public Window
{
public:
    //! Namespace for global events
    static const String EventNamespace;
    //! Window factory name
    static const String WidgetTypeName;

    /*************************************************************************
        Event name constants
    *************************************************************************/
    /** Event fired when the scroll bar position value changes.
     * Handlers are passed a const WindowEventArgs reference with
     * WindowEventArgs::window set to the Scrollbar whose position value had
     * changed.
     */
    static const String EventScrollPositionChanged;
    /** Event fired when the user begins dragging the scrollbar thumb.
     * Handlers are passed a const WindowEventArgs reference with
     * WindowEventArgs::window set to the Scrollbar whose thumb is being
     * dragged.
     */
    static const String EventThumbTrackStarted;
    /** Event fired when the user releases the scrollbar thumb.
     * Handlers are passed a const WindowEventArgs reference with
     * WindowEventArgs::window set to the Scrollbar whose thumb has been
     * released.
     */
    static const String EventThumbTrackEnded;
    /** Event fired when the scroll bar configuration data is changed.
     * Handlers are passed a const WindowEventArgs reference with
     * WindowEventArgs::window set to the Scrollbar whose configuration
     * has been changed.
     */
    static const String EventScrollConfigChanged;

    /*************************************************************************
        Child Widget name suffix constants
    *************************************************************************/
    //! Widget name suffix for the thumb component.
    static const String ThumbNameSuffix;
    //! Widget name suffix for the increase button component.
    static const String IncreaseButtonNameSuffix;
    //! Widget name suffix for the decrease button component.
    static const String DecreaseButtonNameSuffix;

    /*************************************************************************
        Accessor functions
    *************************************************************************/
    /*!
    \brief
        Return the size of the document or data.

        The document size should be thought of as the total size of the data
        that is being scrolled through (the number of lines in a text file for
        example).

    \note
        The returned value has no meaning within the Gui system, it is left up
        to the application to assign appropriate values for the application
        specific use of the scroll bar.

    \return
        float value specifying the currently set document size.
    */
    float getDocumentSize(void) const
    {
        return d_documentSize;
    }

    /*!
    \brief
        Return the page size for this scroll bar.

        The page size is typically the amount of data that can be displayed at
        one time.  This value is also used when calculating the amount the
        position will change when you click either side of the scroll bar
        thumb, the amount the position changes will is (pageSize - overlapSize).

    \note
        The returned value has no meaning within the Gui system, it is left up
        to the application to assign appropriate values for the application
        specific use of the scroll bar.

    \return
        float value specifying the currently set page size.
    */
    float getPageSize(void) const
    {
        return d_pageSize;
    }

    /*!
    \brief
        Return the step size for this scroll bar.

        The step size is typically a single unit of data that can be displayed,
        this is the amount the position will change when you click either of
        the arrow buttons on the scroll bar.  (this could be 1 for a single
        line of text, for example).

    \note
        The returned value has no meaning within the Gui system, it is left up
        to the application to assign appropriate values for the application
        specific use of the scroll bar.

    \return
        float value specifying the currently set step size.
    */
    float getStepSize(void) const
    {
        return d_stepSize;
    }

    /*!
    \brief
        Return the overlap size for this scroll bar.

        The overlap size is the amount of data from the end of a 'page' that
        will remain visible when the position is moved by a page.  This is
        usually used so that the user keeps some context of where they were
        within the document's data when jumping a page at a time.

    \note
        The returned value has no meaning within the Gui system, it is left up
        to the application to assign appropriate values for the application
        specific use of the scroll bar.

    \return
        float value specifying the currently set overlap size.
    */
    float getOverlapSize(void) const
    {
        return d_overlapSize;
    }

    /*!
    \brief
        Return the current position of scroll bar within the document.

        The range of the scroll bar is from 0 to the size of the document minus
        the size of a page (0 <= position <= (documentSize - pageSize)).

    \note
        The returned value has no meaning within the Gui system, it is left up
        to the application to assign appropriate values for the application
        specific use of the scroll bar.

    \return
        float value specifying the current position of the scroll bar within its
        document.
    */
    float getScrollPosition(void) const
    {
        return d_position;
    }

    /*!
    \brief
        Return a pointer to the 'increase' PushButtoncomponent widget for this
        Scrollbar.

    \return
        Pointer to a PushButton object.

    \exception UnknownObjectException
        Thrown if the increase PushButton component does not exist.
    */
    PushButton* getIncreaseButton() const;

    /*!
    \brief
        Return a pointer to the 'decrease' PushButton component widget for this
        Scrollbar.

    \return
        Pointer to a PushButton object.

    \exception UnknownObjectException
        Thrown if the 'decrease' PushButton component does not exist.
    */
    PushButton* getDecreaseButton() const;

    /*!
    \brief
        Return a pointer to the Thumb component widget for this Scrollbar.

    \return
        Pointer to a Thumb object.

    \exception UnknownObjectException
        Thrown if the Thumb component does not exist.
    */
    Thumb* getThumb() const;

    /*************************************************************************
        Manipulator Commands
    *************************************************************************/
    /*!
    \brief
        Initialises the Scrollbar object ready for use.

    \note
        This must be called for every window created.  Normally this is handled
        automatically by the WindowFactory for each Window type.

    \return
        Nothing
    */
    virtual void initialiseComponents(void);

    /*!
    \brief
        Set the size of the document or data.

        The document size should be thought of as the total size of the data
        that is being scrolled through (the number of lines in a text file for
        example).

    \note
        The value set has no meaning within the Gui system, it is left up to
        the application to assign appropriate values for the application
        specific use of the scroll bar.

    \param document_size
        float value specifying the document size.

    \return
        Nothing.
    */
    void setDocumentSize(float document_size);

    /*!
    \brief
        Set the page size for this scroll bar.

        The page size is typically the amount of data that can be displayed at
        one time.  This value is also used when calculating the amount the
        position will change when you click either side of the scroll bar
        thumb, the amount the position changes will is (pageSize - overlapSize).

    \note
        The value set has no meaning within the Gui system, it is left up to the
        application to assign appropriate values for the application specific
        use of the scroll bar.

    \param page_size
        float value specifying the page size.

    \return
        Nothing.
    */
    void setPageSize(float page_size);

    /*!
    \brief
        Set the step size for this scroll bar.

        The step size is typically a single unit of data that can be displayed,
        this is the amount the position will change when you click either of the
        arrow buttons on the scroll bar.  (this could be 1 for a single line of
        text, for example).

    \note
        The value set has no meaning within the Gui system, it is left up to the
        application to assign appropriate values for the application specific
        use of the scroll bar.

    \param step_size
        float value specifying the step size.

    \return
        Nothing.
    */
    void setStepSize(float step_size);

    /*!
    \brief
        Set the overlap size for this scroll bar.

        The overlap size is the amount of data from the end of a 'page' that
        will remain visible when the position is moved by a page.  This is
        usually used so that the user keeps some context of where they were
        within the document's data when jumping a page at a time.

    \note
        The value set has no meaning within the Gui system, it is left up to the
        application to assign appropriate values for the application specific
        use of the scroll bar.

    \param overlap_size
        float value specifying the overlap size.

    \return
        Nothing.
    */
    void setOverlapSize(float overlap_size);

    /*!
    \brief
        Set the current position of scroll bar within the document.

        The range of the scroll bar is from 0 to the size of the document minus
        the size of a page (0 <= position <= (documentSize - pageSize)), any
        attempt to set the position outside this range will be adjusted so that
        it falls within the legal range.

    \note
        The returned value has no meaning within the Gui system, it is left up
        to the application to assign appropriate values for the application
        specific use of the scroll bar.

    \param position
        float value specifying the position of the scroll bar within its
        document.

    \return
        Nothing.
    */
    void setScrollPosition(float position);

    /*!
    \brief
        Sets multiple scrollbar configuration parameters simultaneously.

        This function is provided in order to be able to minimise the number
        of internal state updates that occur when modifying the scrollbar
        parameters.

    \param document_size
        Pointer to a float value holding the new value to be used for the
        scroll bar document size.  If this is 0 the document size is left
        unchanged.

    \param page_size
        Pointer to a float value holding the new value to be used for the scroll
        bar page size.  If this is 0 the page size is left unchanged.

    \param step_size
        Pointer to a float value holding the new value to be used for the scroll
        bar step size.  If this is 0 the step size is left unchanged.

    \param overlap_size
        Pointer to a float value holding the new value to be used for the scroll
        bar overlap size.  If this is 0 then overlap size is left unchanged.

    \param position
        Pointer to a float value holding the new value to be used for the scroll
        bar current scroll position.  If this is 0 then the current position is
        left unchanged.

    \note
        Even if \a position is 0, the scrollbar position may still change
        depending on how the other changes affect the scrollbar.
    */
    void setConfig(const float* const document_size,
                   const float* const page_size,
                   const float* const step_size,
                   const float* const overlap_size,
                   const float* const position);

    /*!
    \brief
        Enable or disable the 'end lock' mode for the scrollbar.

        When enabled and the current position of the scrollbar is at the end of
        it's travel, the end lock mode of the scrollbar will automatically
        update the position when the document and/or page size change in order
        that the scroll position will remain at the end of it's travel.  This
        can be used to implement auto-scrolling in certain other widget types.

    \param enabled
        - true to indicate that end lock mode should be enabled.
        - false to indicate that end lock mode should be disabled.
    */
    void setEndLockEnabled(const bool enabled);

    /*!
    \brief
        Returns whether the 'end lock'mode for the scrollbar is enabled.

        When enabled, and the current position of the scrollbar is at the end of
        it's travel, the end lock mode of the scrollbar will automatically
        update the scrollbar position when the document and/or page size change
        in order that the scroll position will remain at the end of it's travel.
        This can be used to implement auto-scrolling in certain other widget
        types.

    \return
        - true to indicate that the end lock mode is enabled.
        - false to indicate that the end lock mode is disabled.
    */
    bool isEndLockEnabled() const;

    //! Constructor for Scrollbar objects
    Scrollbar(const String& type, const String& name);

    //! Destructor for Scrollbar objects
    virtual ~Scrollbar(void);

protected:
    /*!
    \brief
        update the size and location of the thumb to properly represent the
        current state of the scroll bar
    */
    void updateThumb(void);

    /*!
    \brief
        return value that best represents current scroll bar position given the
        current location of the thumb.

    \return
        float value that, given the thumb widget position, best represents the
        current position for the scroll bar.
    */
    float getValueFromThumb(void) const;

    /*!
    \brief
        Given window location \a pt, return a value indicating what change
        should be made to the scroll bar.

    \param pt
        Point object describing a pixel position in window space.

    \return
        - -1 to indicate scroll bar position should be moved to a lower value.
        -  0 to indicate scroll bar position should not be changed.
        - +1 to indicate scroll bar position should be moved to a higher value.
    */
    float getAdjustDirectionFromPoint(const Point& pt) const;

    /** implementation func that updates scroll position value, returns true if
     * value was changed.  NB: Fires no events and does no other updates.
     */
    bool setScrollPosition_impl(const float position);

    //! return whether the current scroll position is at the end of the range.
    bool isAtEnd() const;

    //! return the max allowable scroll position value
    float getMaxScrollPosition() const;

    //! handler function for when thumb moves.
    bool handleThumbMoved(const EventArgs& e);

    //! handler function for when the increase button is clicked.
    bool handleIncreaseClicked(const EventArgs& e);

    //! handler function for when the decrease button is clicked.
    bool handleDecreaseClicked(const EventArgs& e);

    //! handler function for when thumb tracking begins
    bool handleThumbTrackStarted(const EventArgs& e);

    //! handler function for when thumb tracking begins
    bool handleThumbTrackEnded(const EventArgs& e);

    /*!
    \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 == "Scrollbar")    return true;

        return Window::testClassName_impl(class_name);
    }

    //! validate window renderer
    virtual bool validateWindowRenderer(const String& name) const
    {
        return (name == "Scrollbar");
    }

    // New event handlers for slider widget
    //! Handler triggered when the scroll position changes
    virtual void onScrollPositionChanged(WindowEventArgs& e);

    //! Handler triggered when the user begins to drag the scroll bar thumb.
    virtual void onThumbTrackStarted(WindowEventArgs& e);

    //! Handler triggered when the scroll bar thumb is released
    virtual void onThumbTrackEnded(WindowEventArgs& e);

    //! Handler triggered when the scroll bar data configuration changes
    virtual void onScrollConfigChanged(WindowEventArgs& e);

    // Overridden event handlers
    virtual void onMouseButtonDown(MouseEventArgs& e);
    virtual void onMouseWheel(MouseEventArgs& e);

    // Implementation Data
    //! The size of the document / data being scrolled thorugh.
    float d_documentSize;
    //! The size of a single 'page' of data.
    float d_pageSize;
    //! Step size used for increase / decrease button clicks.
    float d_stepSize;
    //! Amount of overlap when jumping by a page.
    float d_overlapSize;
    //! Current scroll position.
    float d_position;
    //! whether 'end lock' mode is enabled.
    bool d_endLockPosition;

private:
    // Static Properties for this class
    static ScrollbarProperties::DocumentSize    d_documentSizeProperty;
    static ScrollbarProperties::PageSize        d_pageSizeProperty;
    static ScrollbarProperties::StepSize        d_stepSizeProperty;
    static ScrollbarProperties::OverlapSize     d_overlapSizeProperty;
    static ScrollbarProperties::ScrollPosition  d_scrollPositionProperty;
    static ScrollbarProperties::EndLockEnabled  d_endLockEnabledProperty;

    //! Adds scrollbar specific properties.
    void addScrollbarProperties(void);
};

} // End of  CEGUI namespace section

#if defined(_MSC_VER)
#   pragma warning(pop)
#endif

#endif  // end of guard _CEGUIScrollbar_h_