File: wrapsizer.h

package info (click to toggle)
wxwidgets3.0 3.0.5.1%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 120,464 kB
  • sloc: cpp: 896,633; makefile: 52,303; ansic: 21,971; sh: 5,713; python: 2,940; xml: 1,534; perl: 264; javascript: 33
file content (76 lines) | stat: -rw-r--r-- 2,525 bytes parent folder | download | duplicates (10)
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
/////////////////////////////////////////////////////////////////////////////
// Name:        wrapsizer.h
// Purpose:     interface of wxWrapSizer
// Author:      wxWidgets team
// Licence:     wxWindows licence
/////////////////////////////////////////////////////////////////////////////

// flags for wxWrapSizer
enum
{
    wxEXTEND_LAST_ON_EACH_LINE,
    wxREMOVE_LEADING_SPACES,
    wxWRAPSIZER_DEFAULT_FLAGS
};

/**
    @class wxWrapSizer

    A wrap sizer lays out its items in a single line, like a box sizer -- as long
    as there is space available in that direction.
    Once all available space in the primary direction has been used, a new line
    is added and items are added there.

    So a wrap sizer has a primary orientation for adding items, and adds lines
    as needed in the secondary direction.

    @library{wxcore}
    @category{winlayout}

    @see wxBoxSizer, wxSizer, @ref overview_sizer
*/
class wxWrapSizer : public wxBoxSizer
{
public:
    /**
        Constructor for a wxWrapSizer.

        @a orient determines the primary direction of the sizer (the most common
        case being @c wxHORIZONTAL). The flags parameter can be a combination of
        the values @c wxEXTEND_LAST_ON_EACH_LINE which will cause the last item
        on each line to use any remaining space on that line and @c wxREMOVE_LEADING_SPACES
        which removes any spacer elements from the beginning of a row.

        Both of these flags are on by default.
    */
    wxWrapSizer(int orient = wxHORIZONTAL,
                int flags = wxWRAPSIZER_DEFAULT_FLAGS);

    /**
        Not used by an application.

        This is the mechanism by which sizers can inform sub-items of the first
        determined size component.
        The sub-item can then better determine its size requirements.

        Returns @true if the information was used (and the sub-item min size was
        updated).
    */
    virtual bool InformFirstDirection(int direction, int size,
                                      int availableOtherDir);
    
    virtual void RecalcSizes();
    virtual wxSize CalcMin();

protected:
    /**
        Can be overridden in the derived classes to treat some normal items as
        spacers.

        This method is used to determine whether the given @a item should be
        considered to be a spacer for the purposes of @c wxREMOVE_LEADING_SPACES
        implementation. By default only returns @true for the real spacers.
     */
    virtual bool IsSpaceItem(wxSizerItem *item) const;
};