| 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 |
|
| 17 |
import QtQuick 2.4 |
| 18 |
import Lomiri.Components 1.3 |
| 19 |
|
| 20 |
/*! |
| 21 |
\qmltype ActionBar |
| 22 |
\inqmlmodule Lomiri.Components |
| 23 |
\ingroup lomiri |
| 24 |
\brief Show a row of buttons that trigger actions. When the |
| 25 |
number of visible actions specified is larger than |
| 26 |
\l numberOfSlots, an overflow button will be shown which |
| 27 |
triggers an overflow panel that shows the remaining actions. |
| 28 |
|
| 29 |
Example: |
| 30 |
|
| 31 |
\qml |
| 32 |
ActionBar { |
| 33 |
numberOfSlots: 2 |
| 34 |
actions: [ |
| 35 |
Action { |
| 36 |
iconName: "share" |
| 37 |
text: "Share" |
| 38 |
}, |
| 39 |
Action { |
| 40 |
iconName: "starred" |
| 41 |
text: "Favorite" |
| 42 |
}, |
| 43 |
Action { |
| 44 |
iconName: "lock" |
| 45 |
text: "Lock" |
| 46 |
} |
| 47 |
] |
| 48 |
} |
| 49 |
\endqml |
| 50 |
*/ |
| 51 |
StyledItem { |
| 52 |
id: bar |
| 53 |
styleName: "ActionBarStyle" |
| 54 |
|
| 55 |
/*! |
| 56 |
The actions to display in the bar. |
| 57 |
If more actions are specified than there are slots, an overflow |
| 58 |
button will be show which opens a popover with the actions that |
| 59 |
did not fit in the bar directly. |
| 60 |
*/ |
| 61 |
property list<Action> actions |
| 62 |
|
| 63 |
/*! |
| 64 |
The number of actions to be shown in the bar directly. |
| 65 |
If the actions don't fit, an overflow button (using one slot) |
| 66 |
will be shown which opens a popover with the remaining actions. |
| 67 |
|
| 68 |
Setting numberOfSlots to 0 will always show the overflow button |
| 69 |
and no other action buttons. Default value from the Ambience |
| 70 |
theme is 3. |
| 71 |
*/ |
| 72 |
property int numberOfSlots: __styleInstance.defaultNumberOfSlots |
| 73 |
|
| 74 |
/*! |
| 75 |
Set this to override the default delegate button that shows |
| 76 |
the actions in the ActionBar. Uses the defaultDelegate of |
| 77 |
ActionBarStyle by default. |
| 78 |
|
| 79 |
Example: |
| 80 |
\qml |
| 81 |
ActionBar { |
| 82 |
id: customDelegateBar |
| 83 |
anchors.right: parent.right |
| 84 |
actions: [ |
| 85 |
Action { text: "action 1" }, |
| 86 |
Action { text: "action 2" } |
| 87 |
] |
| 88 |
delegate: Button { |
| 89 |
action: modelData |
| 90 |
width: units.gu(14) |
| 91 |
strokeColor: LomiriColors.purple |
| 92 |
} |
| 93 |
} |
| 94 |
\endqml |
| 95 |
*/ |
| 96 |
property Component delegate: __styleInstance.defaultDelegate |
| 97 |
} |