| 1 | /* |
| 2 | * Copyright 2015 Canonical Ltd. |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU Lesser General Public License as published by |
| 6 | * the Free Software Foundation; version 3. |
| 7 | * |
| 8 | * This program is distributed in the hope that it will be useful, |
| 9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 | * GNU Lesser General Public License for more details. |
| 12 | * |
| 13 | * You should have received a copy of the GNU Lesser General Public License |
| 14 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | * |
| 16 | * Author: Andrea Bernabei <[email protected]> |
| 17 | */ |
| 18 | |
| 19 | #ifndef UCSLOTSLAYOUT_P_P_H |
| 20 | #define UCSLOTSLAYOUT_P_P_Hcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:20:9`! |
| 21 | |
| 22 | #include <QtGlobal> |
| 23 | |
| 24 | #if QT_VERSIONcxx . . $ `<external>/15045578679651060896/qglobal.h:57:9`! >= QT_VERSION_CHECKcxx . . $ `<external>/15045578679651060896/qglobal.h:61:9`!(6, 0, 0) |
| 25 | #include <LomiriToolkit-Qt6/private/ucslotslayout_p.h> |
| 26 | #else |
| 27 | #include <LomiriToolkit/private/ucslotslayout_p.h>cxx . . $ `<file>/include/LomiriToolkit/5.5.0/LomiriToolkit/private/ucslotslayout_p.h`/ |
| 28 | #endif |
| 29 | |
| 30 | #include <QtQuick/private/qquickitem_p.h> |
| 31 | |
| 32 | #define IMPLICIT_SLOTSLAYOUT_WIDTH_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:32:9`! 40 |
| 33 | #define IMPLICIT_SLOTSLAYOUT_HEIGHT_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:33:9`! 7 |
| 34 | #define SLOTSLAYOUT_SLOTS_SIDEMARGINS_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:34:9`! 1 |
| 35 | #define SLOTSLAYOUT_SLOTS_TOPBOTTOMMARGINS_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:35:9`! 0 |
| 36 | #define SLOTSLAYOUT_LEFTMARGIN_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:36:9`! 1 |
| 37 | #define SLOTSLAYOUT_RIGHTMARGIN_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:37:9`! 1 |
| 38 | |
| 39 | //we want a different top/bottom margin if any of the slot is taller than this |
| 40 | #define SLOTSLAYOUT_TOPBOTTOMMARGIN_SIZETHRESHOLD_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:40:9`! 4 |
| 41 | #define SLOTSLAYOUT_TOPMARGIN1_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:41:9`! 1 |
| 42 | #define SLOTSLAYOUT_TOPMARGIN2_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:42:9`! 2 |
| 43 | #define SLOTSLAYOUT_BOTTOMMARGIN1_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:43:9`! 1 |
| 44 | #define SLOTSLAYOUT_BOTTOMMARGIN2_GUcxx . . $ `src/LomiriToolkit/ucslotslayout_p_p.h:44:9`! 2 |
| 45 | |
| 46 | UT_NAMESPACE_BEGINcxx . . $ `src/LomiriToolkit/lomiritoolkitglobal.h:52:9`! |
| 47 | |
| 48 | class UCSlotsLayoutPrivatecxx . . $ UCSlotsLayoutPrivate# : public QQuickItemPrivatecxx . . $ QQuickItemPrivate# |
| 49 | { |
| 50 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(UCSlotsLayout) |
| 51 | public: |
| 52 | UCSlotsLayoutPrivatecxx . . $ UCSlotsLayoutPrivate#UCSlotsLayoutPrivate(49f6e7a06ebc5aa8).(); |
| 53 | virtual ~cxx . . $ UCSlotsLayoutPrivate#`~UCSlotsLayoutPrivate`(ced63f7c635d850d).UCSlotsLayoutPrivatecxx . . $ UCSlotsLayoutPrivate#(); |
| 54 | void initcxx . . $ UCSlotsLayoutPrivate#init(49f6e7a06ebc5aa8).(); |
| 55 | void updateTopBottomPaddingIfNeededcxx . . $ UCSlotsLayoutPrivate#updateTopBottomPaddingIfNeeded(49f6e7a06ebc5aa8).(); |
| 56 | |
| 57 | //returns true if we want to ignore "slot" during the layout process |
| 58 | bool skipSlotcxx . . $ UCSlotsLayoutPrivate#skipSlot(644f6ea002a0c712).(QQuickItemcxx . . $ QQuickItem# *slot); |
| 59 | |
| 60 | //utility method that scans a list and adds the slot after all the slots which |
| 61 | //have same position |
| 62 | void insertSlotIntoSortedListcxx . . $ UCSlotsLayoutPrivate#insertSlotIntoSortedList(722b33ae28857aba).(QQuickItemcxx . . $ QQuickItem# *slot, |
| 63 | UCSlotsLayoutcxx . . $ UCSlotsLayout#::UCSlotPositioncxx . . $ UCSlotsLayout#UCSlotPosition# desiredSlotPosition, |
| 64 | QListcxx . . $ QList#<QQuickItemcxx . . $ QQuickItem# *> &slotsList); |
| 65 | |
| 66 | //add or remove a slot from the internal data structures |
| 67 | void addSlotcxx . . $ UCSlotsLayoutPrivate#addSlot(28aa4acb8f529eea).(QQuickItemcxx . . $ QQuickItem# *slot); |
| 68 | void removeSlotcxx . . $ UCSlotsLayoutPrivate#removeSlot(28aa4acb8f529eea).(QQuickItemcxx . . $ QQuickItem# *slot); |
| 69 | |
| 70 | //layout "items" in a row, optionally anchoring the row to a sibling with margin siblingAnchorMargin |
| 71 | //The optional anchoring behaviour can be disable by passing QQuickAnchorLine() |
| 72 | void layoutInRowcxx . . $ UCSlotsLayoutPrivate#layoutInRow(b009b1064a2e83f7).(qrealcxx . . $ qreal# siblingAnchorMargin, QQuickAnchorLinecxx . . $ QQuickAnchorLine# siblingAnchor, QListcxx . . $ QList#<QQuickItemcxx . . $ QQuickItem# *> &items); |
| 73 | |
| 74 | //this method sets up vertical anchors and paddings for a slot ("item"). |
| 75 | //Attached properties are taken from "attached", if not null, otherwise |
| 76 | //qml engine is queried. |
| 77 | void setupSlotsVerticalPositioningcxx . . $ UCSlotsLayoutPrivate#setupSlotsVerticalPositioning(36ef60defd59fc2b).(QQuickItemcxx . . $ QQuickItem# *item, UCSlotsAttachedcxx . . $ UCSlotsAttached#* attached = Q_NULLPTRcxx . . $ `<external>/4507883856836070869/qcompilerdetection.h:1095:10`!); |
| 78 | |
| 79 | //We have two vertical positioning modes according to the visual design rules: |
| 80 | //- RETURN VALUE CenterVertically --> All items have to be vertically centered |
| 81 | //- RETURN VALUE AlignToTop --> All items have to anchor to the top of the listitem (using a top margin as well) |
| 82 | //This is mainly used by the layout method |
| 83 | enum UCSlotPositioningModecxx . . $ UCSlotsLayoutPrivate#UCSlotPositioningMode# { AlignToTopcxx . . $ UCSlotsLayoutPrivate#AlignToTop., CenterVerticallycxx . . $ UCSlotsLayoutPrivate#CenterVertically. }; |
| 84 | UCSlotsLayoutPrivatecxx . . $ UCSlotsLayoutPrivate#::UCSlotPositioningModecxx . . $ UCSlotsLayoutPrivate#UCSlotPositioningMode# getVerticalPositioningModecxx . . $ UCSlotsLayoutPrivate#getVerticalPositioningMode(7d027236e0d8549c).() const; |
| 85 | |
| 86 | //connect/disconnect item's UCSlotsAttached properties changes to/from the right slot |
| 87 | void handleAttachedPropertySignalscxx . . $ UCSlotsLayoutPrivate#handleAttachedPropertySignals(f7a8f0943d3aad06).(QQuickItemcxx . . $ QQuickItem# *item, bool connect); |
| 88 | |
| 89 | static inline UCSlotsLayoutPrivatecxx . . $ UCSlotsLayoutPrivate# *getcxx . . $ UCSlotsLayoutPrivate#get(56f1953a6cd86623).(UCSlotsLayoutcxx . . $ UCSlotsLayout# *that) |
| 90 | { |
| 91 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(that); |
| 92 | return that->d_funccxx . . $ UCSlotsLayout#d_func(d233649751b80aab).(); |
| 93 | } |
| 94 | |
| 95 | void _q_onGuValueChangedcxx . . $ UCSlotsLayoutPrivate#_q_onGuValueChanged(49f6e7a06ebc5aa8).(); |
| 96 | void _q_updateCachedHeightcxx . . $ UCSlotsLayoutPrivate#_q_updateCachedHeight(49f6e7a06ebc5aa8).(); |
| 97 | void _q_updateProgressionStatuscxx . . $ UCSlotsLayoutPrivate#_q_updateProgressionStatus(49f6e7a06ebc5aa8).(); |
| 98 | void _q_updateGuValuescxx . . $ UCSlotsLayoutPrivate#_q_updateGuValues(49f6e7a06ebc5aa8).(); |
| 99 | void _q_updateCachedMainSlotHeightcxx . . $ UCSlotsLayoutPrivate#_q_updateCachedMainSlotHeight(49f6e7a06ebc5aa8).(); |
| 100 | void _q_updateSlotsBBoxHeightcxx . . $ UCSlotsLayoutPrivate#_q_updateSlotsBBoxHeight(49f6e7a06ebc5aa8).(); |
| 101 | void _q_updateSizecxx . . $ UCSlotsLayoutPrivate#_q_updateSize(49f6e7a06ebc5aa8).(); |
| 102 | void _q_onSlotWidthChangedcxx . . $ UCSlotsLayoutPrivate#_q_onSlotWidthChanged(49f6e7a06ebc5aa8).(); |
| 103 | void _q_onSlotOverrideVerticalPositioningChangedcxx . . $ UCSlotsLayoutPrivate#_q_onSlotOverrideVerticalPositioningChanged(49f6e7a06ebc5aa8).(); |
| 104 | void _q_onSlotPositionChangedcxx . . $ UCSlotsLayoutPrivate#_q_onSlotPositionChanged(49f6e7a06ebc5aa8).(); |
| 105 | void _q_relayoutcxx . . $ UCSlotsLayoutPrivate#_q_relayout(49f6e7a06ebc5aa8).(); |
| 106 | |
| 107 | UCSlotsLayoutPaddingcxx . . $ UCSlotsLayoutPadding# paddingcxx . . $ UCSlotsLayoutPrivate#padding.; |
| 108 | |
| 109 | //These lists are just to split the children() between leading |
| 110 | //and trailing slots. Some of the slots in this lists may be |
| 111 | //ignored during relayout, for example if they're not visible or |
| 112 | //similar conditions. (see relayout implementation to make sure |
| 113 | //what conditions we check before ignoring a slot) |
| 114 | QListcxx . . $ QList#<QQuickItemcxx . . $ QQuickItem# *> leadingSlotscxx . . $ UCSlotsLayoutPrivate#leadingSlots.; |
| 115 | QListcxx . . $ QList#<QQuickItemcxx . . $ QQuickItem# *> trailingSlotscxx . . $ UCSlotsLayoutPrivate#trailingSlots.; |
| 116 | |
| 117 | QQuickItemcxx . . $ QQuickItem#* mainSlotcxx . . $ UCSlotsLayoutPrivate#mainSlot.; |
| 118 | |
| 119 | //We cache the current parent so that we can disconnect from the signals when the |
| 120 | //parent changes. We need this because itemChange(..) only provides the new parent |
| 121 | QQuickItemcxx . . $ QQuickItem# *m_parentItemcxx . . $ UCSlotsLayoutPrivate#m_parentItem.; |
| 122 | |
| 123 | qrealcxx . . $ qreal# mainSlotHeightcxx . . $ UCSlotsLayoutPrivate#mainSlotHeight.; |
| 124 | //max slots height ignoring the main slot |
| 125 | qrealcxx . . $ qreal# maxSlotsHeightcxx . . $ UCSlotsLayoutPrivate#maxSlotsHeight.; |
| 126 | //we cache the height so that we only relayout when it goes |
| 127 | //from 0 to non-0 and not viceversa |
| 128 | qrealcxx . . $ qreal# _q_cachedHeightcxx . . $ UCSlotsLayoutPrivate#_q_cachedHeight.; |
| 129 | |
| 130 | //currently fixed, but we may allow changing this in the future |
| 131 | qint32cxx . . $ qint32# maxNumberOfLeadingSlotscxx . . $ UCSlotsLayoutPrivate#maxNumberOfLeadingSlots.; |
| 132 | qint32cxx . . $ qint32# maxNumberOfTrailingSlotscxx . . $ UCSlotsLayoutPrivate#maxNumberOfTrailingSlots.; |
| 133 | |
| 134 | //Show the chevron, name taken from old ListItem API to minimize changes |
| 135 | bool progressioncxx . . $ UCSlotsLayoutPrivate#progression. : 1; |
| 136 | }; |
| 137 | |
| 138 | class UCSlotsAttachedPrivatecxx . . $ UCSlotsAttachedPrivate# : public QObjectPrivatecxx . . $ QObjectPrivate# |
| 139 | { |
| 140 | Q_DECLARE_PUBLICcxx . . $ `<external>/15045578679651060896/qglobal.h:1172:9`!(UCSlotsAttached) |
| 141 | public: |
| 142 | UCSlotsAttachedPrivatecxx . . $ UCSlotsAttachedPrivate#UCSlotsAttachedPrivate(49f6e7a06ebc5aa8).(); |
| 143 | |
| 144 | static inline UCSlotsAttachedPrivatecxx . . $ UCSlotsAttachedPrivate# *getcxx . . $ UCSlotsAttachedPrivate#get(6a2beb5a14f8a423).(UCSlotsAttachedcxx . . $ UCSlotsAttached# *that) |
| 145 | { |
| 146 | Q_ASSERTcxx . . $ `<external>/15045578679651060896/qglobal.h:859:13`!(that); |
| 147 | return that->d_funccxx . . $ UCSlotsAttached#d_func(b92b906afefd277d).(); |
| 148 | } |
| 149 | |
| 150 | void _q_onGuValueChangedcxx . . $ UCSlotsAttachedPrivate#_q_onGuValueChanged(49f6e7a06ebc5aa8).(); |
| 151 | |
| 152 | UCSlotsLayoutPaddingcxx . . $ UCSlotsLayoutPadding# paddingcxx . . $ UCSlotsAttachedPrivate#padding.; |
| 153 | UCSlotsLayoutcxx . . $ UCSlotsLayout#::UCSlotPositioncxx . . $ UCSlotsLayout#UCSlotPosition# positioncxx . . $ UCSlotsAttachedPrivate#position.; |
| 154 | bool overrideVerticalPositioningcxx . . $ UCSlotsAttachedPrivate#overrideVerticalPositioning. : 1; |
| 155 | }; |
| 156 | |
| 157 | UT_NAMESPACE_ENDcxx . . $ `src/LomiriToolkit/lomiritoolkitglobal.h:53:9`! |
| 158 | |
| 159 | #endif // UCSLOTSLAYOUT_P_P_H |