Skip to content

Commit

Permalink
Steel: put row renderer styles in with GridView/TreeGridView
Browse files Browse the repository at this point in the history
  • Loading branch information
joshtynjala committed Mar 9, 2024
1 parent 5936396 commit 11e4332
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 140 deletions.
7 changes: 0 additions & 7 deletions src/feathers/controls/dataRenderers/GridViewRowRenderer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ class GridViewRowRenderer extends LayoutGroup implements ITriggerView implements
@since 1.0.0
**/
public function new() {
initializeGridViewRowRendererTheme();
super();
}

Expand Down Expand Up @@ -412,12 +411,6 @@ class GridViewRowRenderer extends LayoutGroup implements ITriggerView implements
return this._columnToCellRenderer.get(column);
}

private function initializeGridViewRowRendererTheme():Void {
#if !feathersui_disable_default_theme
feathers.themes.steel.components.SteelGridViewRowRendererStyles.initialize();
#end
}

override private function initialize():Void {
super.initialize();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class TreeGridViewRowRenderer extends LayoutGroup implements ITriggerView implem
@since 1.0.0
**/
public function new() {
initializeTreeGridViewRowRendererTheme();
super();
}

Expand Down Expand Up @@ -490,12 +489,6 @@ class TreeGridViewRowRenderer extends LayoutGroup implements ITriggerView implem
return this._columnToCellRenderer.get(column);
}

private function initializeTreeGridViewRowRendererTheme():Void {
#if !feathersui_disable_default_theme
feathers.themes.steel.components.SteelTreeGridViewRowRendererStyles.initialize();
#end
}

override private function initialize():Void {
super.initialize();

Expand Down
4 changes: 0 additions & 4 deletions src/feathers/themes/steel/SteelTheme.hx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import feathers.themes.steel.components.SteelDatePickerStyles;
import feathers.themes.steel.components.SteelDrawerStyles;
import feathers.themes.steel.components.SteelFormItemStyles;
import feathers.themes.steel.components.SteelFormStyles;
import feathers.themes.steel.components.SteelGridViewRowRendererStyles;
import feathers.themes.steel.components.SteelGridViewStyles;
import feathers.themes.steel.components.SteelGroupListViewStyles;
import feathers.themes.steel.components.SteelHDividedBoxStyles;
Expand Down Expand Up @@ -52,7 +51,6 @@ import feathers.themes.steel.components.SteelTextInputStyles;
import feathers.themes.steel.components.SteelToggleButtonStyles;
import feathers.themes.steel.components.SteelToggleSwitchStyles;
import feathers.themes.steel.components.SteelToolTipStyles;
import feathers.themes.steel.components.SteelTreeGridViewRowRendererStyles;
import feathers.themes.steel.components.SteelTreeGridViewStyles;
import feathers.themes.steel.components.SteelTreeViewStyles;
import feathers.themes.steel.components.SteelVDividedBoxStyles;
Expand Down Expand Up @@ -88,7 +86,6 @@ class SteelTheme extends BaseSteelTheme {
SteelDrawerStyles.initialize(this);
SteelFormStyles.initialize(this);
SteelFormItemStyles.initialize(this);
SteelGridViewRowRendererStyles.initialize(this);
SteelGridViewStyles.initialize(this);
SteelGroupListViewStyles.initialize(this);
SteelHDividedBoxStyles.initialize(this);
Expand Down Expand Up @@ -120,7 +117,6 @@ class SteelTheme extends BaseSteelTheme {
SteelToggleButtonStyles.initialize(this);
SteelToggleSwitchStyles.initialize(this);
SteelToolTipStyles.initialize(this);
SteelTreeGridViewRowRendererStyles.initialize(this);
SteelTreeGridViewStyles.initialize(this);
SteelTreeViewStyles.initialize(this);
SteelVDividedBoxStyles.initialize(this);
Expand Down

This file was deleted.

27 changes: 27 additions & 0 deletions src/feathers/themes/steel/components/SteelGridViewStyles.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

package feathers.themes.steel.components;

import feathers.controls.dataRenderers.GridViewRowRenderer;
import feathers.controls.ToggleButtonState;
import feathers.skins.UnderlineSkin;
import feathers.controls.Button;
Expand Down Expand Up @@ -250,5 +251,31 @@ class SteelGridViewStyles {
}
});
}

if (styleProvider.getStyleFunction(GridViewRowRenderer, null) == null) {
styleProvider.setStyleFunction(GridViewRowRenderer, null, function(rowRenderer:GridViewRowRenderer):Void {
var isDesktop = DeviceUtil.isDesktop();

if (rowRenderer.backgroundSkin == null) {
var skin = new UnderlineSkin();
skin.fill = theme.getContainerFill();
skin.border = theme.getDividerBorder();
skin.selectedFill = theme.getActiveThemeFill();
skin.setFillForState(ToggleButtonState.DOWN(false), theme.getActiveThemeFill());
if (isDesktop) {
skin.width = 26.0;
skin.height = 26.0;
skin.minWidth = 26.0;
skin.minHeight = 26.0;
} else {
skin.width = 44.0;
skin.height = 44.0;
skin.minWidth = 44.0;
skin.minHeight = 44.0;
}
rowRenderer.backgroundSkin = skin;
}
});
}
}
}

This file was deleted.

29 changes: 29 additions & 0 deletions src/feathers/themes/steel/components/SteelTreeGridViewStyles.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

package feathers.themes.steel.components;

import feathers.skins.UnderlineSkin;
import feathers.controls.ToggleButtonState;
import feathers.controls.dataRenderers.TreeGridViewRowRenderer;
import feathers.controls.dataRenderers.HierarchicalItemRenderer;
import feathers.controls.Button;
import feathers.controls.ButtonState;
Expand Down Expand Up @@ -250,5 +253,31 @@ class SteelTreeGridViewStyles {
}
});
}

if (styleProvider.getStyleFunction(TreeGridViewRowRenderer, null) == null) {
styleProvider.setStyleFunction(TreeGridViewRowRenderer, null, function(rowRenderer:TreeGridViewRowRenderer):Void {
var isDesktop = DeviceUtil.isDesktop();

if (rowRenderer.backgroundSkin == null) {
var skin = new UnderlineSkin();
skin.fill = theme.getContainerFill();
skin.border = theme.getDividerBorder();
skin.selectedFill = theme.getActiveThemeFill();
skin.setFillForState(ToggleButtonState.DOWN(false), theme.getActiveThemeFill());
if (isDesktop) {
skin.width = 26.0;
skin.height = 26.0;
skin.minWidth = 26.0;
skin.minHeight = 26.0;
} else {
skin.width = 44.0;
skin.height = 44.0;
skin.minWidth = 44.0;
skin.minHeight = 44.0;
}
rowRenderer.backgroundSkin = skin;
}
});
}
}
}

0 comments on commit 11e4332

Please sign in to comment.