-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Start splitting them into separate files Also add ribbon band resize policies For #56
- Loading branch information
1 parent
3557662
commit 4571352
Showing
7 changed files
with
328 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
component/src/desktopMain/kotlin/org/pushingpixels/aurora/component/ribbon/RibbonBand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
/* | ||
* Copyright 2020-2022 Aurora, Kirill Grouchnikov | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.pushingpixels.aurora.component.ribbon | ||
|
||
import androidx.compose.ui.graphics.painter.Painter | ||
import org.pushingpixels.aurora.component.model.Command | ||
import org.pushingpixels.aurora.component.ribbon.resize.CoreRibbonResizePolicies | ||
import org.pushingpixels.aurora.component.ribbon.resize.RibbonBandResizePolicy | ||
|
||
sealed interface AbstractRibbonBand { | ||
val title: String | ||
val icon: Painter? | ||
val expandCommand: Command? | ||
val expandCommandKeyTip: String? | ||
val collapsedStateKeyTip: String? | ||
val resizePolicies: List<RibbonBandResizePolicy> | ||
} | ||
|
||
data class RibbonBand( | ||
override val title: String, | ||
override val icon: Painter? = null, | ||
override val expandCommand: Command? = null, | ||
override val expandCommandKeyTip: String? = null, | ||
override val collapsedStateKeyTip: String? = null, | ||
override val resizePolicies: List<RibbonBandResizePolicy> = | ||
CoreRibbonResizePolicies.getCorePoliciesPermissive(), | ||
val commandProjections: List<RibbonCommandButtonProjection> = emptyList(), | ||
val componentProjections: List<RibbonComponentProjection> = emptyList(), | ||
val galleryProjections: List<RibbonGalleryProjection> = emptyList(), | ||
) : AbstractRibbonBand | ||
|
||
data class FlowRibbonBand( | ||
override val title: String, | ||
override val icon: Painter? = null, | ||
override val expandCommand: Command? = null, | ||
override val expandCommandKeyTip: String? = null, | ||
override val collapsedStateKeyTip: String? = null, | ||
override val resizePolicies: List<RibbonBandResizePolicy> = | ||
CoreRibbonResizePolicies.getCoreFlowPoliciesRestrictive(3), | ||
val flowComponentProjections: List<RibbonComponentProjection> = emptyList() | ||
) : AbstractRibbonBand | ||
|
||
|
35 changes: 35 additions & 0 deletions
35
component/src/desktopMain/kotlin/org/pushingpixels/aurora/component/ribbon/RibbonTask.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2020-2022 Aurora, Kirill Grouchnikov | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.pushingpixels.aurora.component.ribbon | ||
|
||
import androidx.compose.ui.graphics.Color | ||
import org.pushingpixels.aurora.component.ribbon.resize.RibbonBandResizeSequencingPolicy | ||
|
||
data class RibbonTask( | ||
val title: String, | ||
val bands: List<AbstractRibbonBand>, | ||
val resizeSequencingPolicy: RibbonBandResizeSequencingPolicy, | ||
val keyTip: String? = null | ||
) | ||
|
||
data class RibbonContextualTaskGroup( | ||
val title: String, | ||
val hueColor: Color, | ||
val tasks: List<RibbonTask>, | ||
val isActive: Boolean = false | ||
) | ||
|
||
|
53 changes: 53 additions & 0 deletions
53
component/src/desktopMain/kotlin/org/pushingpixels/aurora/component/ribbon/RibbonTaskbar.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2020-2022 Aurora, Kirill Grouchnikov | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.pushingpixels.aurora.component.ribbon | ||
|
||
import org.pushingpixels.aurora.component.model.Command | ||
import org.pushingpixels.aurora.component.model.CommandPopupMenuPresentationModel | ||
import org.pushingpixels.aurora.component.model.PresentationModel | ||
import org.pushingpixels.aurora.component.projection.Projection | ||
import org.pushingpixels.aurora.theming.IconFilterStrategy | ||
|
||
data class RibbonTaskbarCommandButtonPresentationModel( | ||
val iconDisabledFilterStrategy: IconFilterStrategy = IconFilterStrategy.ThemedFollowColorScheme, | ||
val iconEnabledFilterStrategy: IconFilterStrategy = IconFilterStrategy.Original, | ||
val iconActiveFilterStrategy: IconFilterStrategy = IconFilterStrategy.Original, | ||
val popupMenuPresentationModel: CommandPopupMenuPresentationModel = CommandPopupMenuPresentationModel() | ||
) : PresentationModel | ||
|
||
interface RibbonTaskbarKeyTipPolicy { | ||
/** | ||
* Returns the keytip for the task bar content (command, component, gallery, menu link) | ||
* at the specified index. | ||
* | ||
* @param contentIndex Index of the task bar content. Content index starts at 1. | ||
* @return Keytip for the specified content. | ||
*/ | ||
fun getContentKeyTip(contentIndex: Int): String | ||
|
||
/** | ||
* Returns the keytip for the overflow button of the task bar. | ||
* | ||
* @return Keytip for the overflow button of the task bar. | ||
*/ | ||
val overflowButtonKeyTip: String | ||
} | ||
|
||
class RibbonTaskbarCommandButtonProjection( | ||
val contentModel: Command, | ||
val presentationModel: RibbonTaskbarCommandButtonPresentationModel | ||
) : Projection<Command, RibbonTaskbarCommandButtonPresentationModel>() | ||
|
Oops, something went wrong.