update default theme

This commit is contained in:
Vadim Lopatin 2016-05-25 14:32:22 +03:00
parent 50e2f08049
commit 9ef54524db
33 changed files with 132 additions and 30 deletions

View File

@ -622,8 +622,11 @@ class Window : CustomEventTarget {
targetState = State.Focused | State.KeyboardFocused; targetState = State.Focused | State.KeyboardFocused;
if (oldFocus is newFocus) if (oldFocus is newFocus)
return oldFocus; return oldFocus;
if (oldFocus !is null) if (oldFocus !is null) {
oldFocus.resetState(targetState); oldFocus.resetState(targetState);
if (oldFocus)
oldFocus.focusGroupFocused(false);
}
if (newFocus is null || isChild(newFocus)) { if (newFocus is null || isChild(newFocus)) {
if (newFocus !is null) { if (newFocus !is null) {
// when calling, setState(focused), window.focusedWidget is still previously focused widget // when calling, setState(focused), window.focusedWidget is still previously focused widget
@ -631,6 +634,8 @@ class Window : CustomEventTarget {
newFocus.setState(targetState); newFocus.setState(targetState);
} }
_focusedWidget = newFocus; _focusedWidget = newFocus;
if (_focusedWidget)
_focusedWidget.focusGroupFocused(true);
// after focus change, ask for actions update automatically // after focus change, ask for actions update automatically
//requestActionsUpdate(); //requestActionsUpdate();
} }

View File

@ -321,6 +321,7 @@ class DockWindow : WindowFrame {
this(string ID) { this(string ID) {
super(ID); super(ID);
focusGroup = true;
} }
override protected void initialize() { override protected void initialize() {

View File

@ -120,6 +120,7 @@ class TabItemWidget : HorizontalLayout {
setItem(item); setItem(item);
clickable = true; clickable = true;
trackHover = true; trackHover = true;
_label.trackHover = true;
} }
void setStyles(string tabButtonStyle, string tabButtonTextStyle) { void setStyles(string tabButtonStyle, string tabButtonTextStyle) {
styleId = tabButtonStyle; styleId = tabButtonStyle;
@ -814,9 +815,10 @@ class TabWidget : VerticalLayout, TabHandler, TabCloseHandler {
} }
/// change style ids /// change style ids
void setStyles(string tabWidgetStyle, string tabStyle, string tabButtonStyle, string tabButtonTextStyle) { void setStyles(string tabWidgetStyle, string tabStyle, string tabButtonStyle, string tabButtonTextStyle, string tabHostStyle = null) {
styleId = tabWidgetStyle; styleId = tabWidgetStyle;
_tabControl.setStyles(tabStyle, tabButtonStyle, tabButtonTextStyle); _tabControl.setStyles(tabStyle, tabButtonStyle, tabButtonTextStyle);
_tabHost.styleId = tabHostStyle;
} }
private bool _tabNavigationInProgress; private bool _tabNavigationInProgress;

View File

@ -282,7 +282,9 @@ public:
@property uint state() const { @property uint state() const {
if ((_state & State.Parent) != 0 && _parent !is null) if ((_state & State.Parent) != 0 && _parent !is null)
return _parent.state; return _parent.state;
if (focusGroupFocused)
return _state | State.WindowFocused; // TODO: return _state | State.WindowFocused; // TODO:
return _state;
} }
/// override to handle focus changes /// override to handle focus changes
protected void handleFocusChange(bool focused, bool receivedFocusFromKeyboard = false) { protected void handleFocusChange(bool focused, bool receivedFocusFromKeyboard = false) {
@ -296,6 +298,8 @@ public:
} }
/// set new widget state (set of flags from State enum) /// set new widget state (set of flags from State enum)
@property Widget state(uint newState) { @property Widget state(uint newState) {
if ((_state & State.Parent) != 0 && _parent !is null)
return _parent.state(newState);
if (newState != _state) { if (newState != _state) {
uint oldState = _state; uint oldState = _state;
_state = newState; _state = newState;
@ -791,10 +795,41 @@ public:
@property bool focusGroup() { return _focusGroup; } @property bool focusGroup() { return _focusGroup; }
/// set focus group flag for container widget /// set focus group flag for container widget
@property Widget focusGroup(bool flg) { _focusGroup = flg; return this; } @property Widget focusGroup(bool flg) { _focusGroup = flg; return this; }
@property bool focusGroupFocused() const {
Widget w = focusGroupWidget();
return (w._state & State.WindowFocused) != 0;
}
protected bool setWindowFocusedFlag(bool flg) {
if (flg) {
if ((_state & State.WindowFocused) == 0) {
_state |= State.WindowFocused;
invalidate();
return true;
}
} else {
if ((_state & State.WindowFocused) != 0) {
_state &= ~State.WindowFocused;
invalidate();
return true;
}
}
return false;
}
@property Widget focusGroupFocused(bool flg) {
Widget w = focusGroupWidget();
w.setWindowFocusedFlag(flg);
while (w.parent) {
w = w.parent;
if (w.parent is null || w.focusGroup) {
w.setWindowFocusedFlag(flg);
}
}
return this;
}
/// find nearest parent of this widget with focusGroup flag, returns topmost parent if no focusGroup flag set to any of parents. /// find nearest parent of this widget with focusGroup flag, returns topmost parent if no focusGroup flag set to any of parents.
Widget focusGroupWidget() { Widget focusGroupWidget() inout {
Widget p = this; Widget p = cast(Widget)this;
while (p) { while (p) {
if (!p.parent || p.focusGroup) if (!p.parent || p.focusGroup)
break; break;
@ -1694,6 +1729,11 @@ class WidgetGroup : Widget {
_children.clear(destroyObj); _children.clear(destroyObj);
} }
/// replace child with other child
void replaceChild(Widget newChild, Widget oldChild) {
_children.replace(newChild, oldChild);
}
} }
/** WidgetGroup with default drawing of children (just draw all children) */ /** WidgetGroup with default drawing of children (just draw all children) */

View File

@ -27,7 +27,7 @@ class WindowFrame : VerticalLayout {
protected Widget _bodyWidget; protected Widget _bodyWidget;
@property Widget bodyWidget() { return _bodyWidget; } @property Widget bodyWidget() { return _bodyWidget; }
@property void bodyWidget(Widget widget) { @property void bodyWidget(Widget widget) {
_children.replace(widget, _bodyWidget); _bodyLayout.replaceChild(widget, _bodyWidget);
_bodyWidget = widget; _bodyWidget = widget;
_bodyWidget.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT); _bodyWidget.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
_bodyWidget.parent = this; _bodyWidget.parent = this;
@ -38,6 +38,7 @@ class WindowFrame : VerticalLayout {
protected TextWidget _caption; protected TextWidget _caption;
protected ImageButton _closeButton; protected ImageButton _closeButton;
protected bool _showCloseButton; protected bool _showCloseButton;
protected HorizontalLayout _bodyLayout;
@property TextWidget caption() { return _caption; } @property TextWidget caption() { return _caption; }
@ -76,11 +77,16 @@ class WindowFrame : VerticalLayout {
_captionLayout.addChild(_caption); _captionLayout.addChild(_caption);
_captionLayout.addChild(_closeButton); _captionLayout.addChild(_closeButton);
_bodyLayout = new HorizontalLayout();
_bodyLayout.styleId = STYLE_DOCK_WINDOW_BODY;
_bodyWidget = createBodyWidget(); _bodyWidget = createBodyWidget();
_bodyWidget.styleId = STYLE_DOCK_WINDOW_BODY; _bodyLayout.addChild(_bodyWidget);
_bodyWidget.layoutWidth(FILL_PARENT).layoutHeight(FILL_PARENT);
//_bodyWidget.styleId = STYLE_DOCK_WINDOW_BODY;
addChild(_captionLayout); addChild(_captionLayout);
addChild(_bodyWidget); addChild(_bodyLayout);
} }
protected Widget createBodyWidget() { protected Widget createBodyWidget() {

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="dock_window_background_focused"
android:state_window_focused="true" />
<item
android:drawable="dock_window_background_normal" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 331 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 B

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="dock_window_caption_background_focused"
android:state_window_focused="true" />
<item
android:drawable="dock_window_caption_background_normal" />
</selector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="dock_window_caption_background_focused_down"
android:state_window_focused="true" />
<item
android:drawable="dock_window_caption_background_normal_down" />
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 249 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 188 B

After

Width:  |  Height:  |  Size: 266 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 198 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 194 B

After

Width:  |  Height:  |  Size: 433 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 297 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 427 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 298 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 B

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

View File

@ -3,6 +3,9 @@
<item <item
android:drawable="tab_btn_dark_down_focused_selected" android:drawable="tab_btn_dark_down_focused_selected"
android:state_selected="true" android:state_window_focused="true" /> android:state_selected="true" android:state_window_focused="true" />
<item
android:drawable="tab_btn_dark_down_focused_hover"
android:state_hovered="true" android:state_window_focused="true" />
<item <item
android:drawable="tab_btn_dark_down_focused" android:drawable="tab_btn_dark_down_focused"
android:state_window_focused="true" /> android:state_window_focused="true" />

View File

@ -3,6 +3,9 @@
<item <item
android:drawable="tab_btn_dark_up_focused_selected" android:drawable="tab_btn_dark_up_focused_selected"
android:state_selected="true" android:state_window_focused="true" /> android:state_selected="true" android:state_window_focused="true" />
<item
android:drawable="tab_btn_dark_up_focused_hover"
android:state_hovered="true" android:state_window_focused="true" />
<item <item
android:drawable="tab_btn_dark_up_focused" android:drawable="tab_btn_dark_up_focused"
android:state_window_focused="true" /> android:state_window_focused="true" />

View File

@ -164,7 +164,7 @@
</style> </style>
<style id="TAB_DOWN_DARK" <style id="TAB_DOWN_DARK"
backgroundImageId="tab_down_background_dark" backgroundImageId="dock_window_caption_background_down"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
> >
</style> </style>
@ -173,24 +173,21 @@
backgroundImageId="tab_btn_dark_down" backgroundImageId="tab_btn_dark_down"
/> />
<style id="TAB_UP_DARK" <style id="TAB_UP_DARK"
backgroundImageId="tab_up_background_dark" backgroundImageId="dock_window_caption_background"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
> >
</style> </style>
<style id="TAB_UP_BUTTON_DARK" <style id="TAB_UP_BUTTON_DARK"
padding="5,1,1,1" padding="5,1,1,1"
backgroundImageId="tab_btn_dark_up" backgroundImageId="tab_btn_dark_up"
/> >
<length id="overlap" value="2"/>
</style>
<style id="TAB_UP_BUTTON_DARK_TEXT" <style id="TAB_UP_BUTTON_DARK_TEXT"
textColor="#E0E0E0" textColor="#000000"
align="Center" align="Center"
> >
<state state_selected="true" state_window_focused="true" state_hovered="true" textColor="#800000"/> <state state_selected="false" state_window_focused="false" state_hovered="false" textColor="#9c9c9c"/>
<state state_selected="true" state_window_focused="true" textColor="#000000"/>
<state state_selected="true" textColor="#E0E0E0"/>
<state state_window_focused="true" state_hovered="true" textColor="#FFE0E0"/>
<state state_window_focused="true" textColor="#FFFFFF"/>
<state state_hovered="true" textColor="#808000"/>
</style> </style>
<style id="TAB_UP" <style id="TAB_UP"
backgroundImageId="tab_up_background" backgroundImageId="tab_up_background"
@ -221,7 +218,7 @@
<style id="MAIN_MENU" <style id="MAIN_MENU"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
backgroundColor="#d6dbe9" backgroundImageId="main_menu_background"
layoutWeight="0" layoutWeight="0"
/> />
<style id="MAIN_MENU_ITEM" <style id="MAIN_MENU_ITEM"
@ -305,6 +302,16 @@
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT" layoutHeight="FILL_PARENT"
/> />
<style id="EDIT_BOX_NO_FRAME"
fontFace="Menlo,Consolas,DejaVuSansMono,Lucida Sans Typewriter,Courier New,Lucida Console"
backgroundColor="#FFFFFF"
padding="2,2,2,2"
margins="2,2,2,2"
minWidth="100"
minHeight="60"
layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT"
/>
<style id="STRING_GRID" <style id="STRING_GRID"
backgroundImageId="editbox_background" backgroundImageId="editbox_background"
padding="2,2,2,2" padding="2,2,2,2"
@ -322,7 +329,7 @@
layoutWeight="0" layoutWeight="0"
/> />
<style id="DOCK_HOST" <style id="DOCK_HOST"
backgroundColor="#293955" backgroundColor="#eceffa"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT" layoutHeight="FILL_PARENT"
padding="2,2,2,2" padding="2,2,2,2"
@ -330,15 +337,15 @@
<style id="DOCK_HOST_BODY" <style id="DOCK_HOST_BODY"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT" layoutHeight="FILL_PARENT"
padding="1,1,1,1" padding="0,0,0,0"
margins="4,4,4,4" margins="3,3,3,3"
/> />
<style id="DOCK_WINDOW" <style id="DOCK_WINDOW"
backgroundColor="#8E9BBC" backgroundImageId="dock_window_background"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT" layoutHeight="FILL_PARENT"
padding="1,1,1,1" padding="0,0,0,0"
margins="4,4,4,4" margins="2,2,2,2"
/> />
<style id="FLOATING_WINDOW" <style id="FLOATING_WINDOW"
backgroundImageId="popup_window_background" backgroundImageId="popup_window_background"
@ -348,27 +355,26 @@
margins="4,4,4,4" margins="4,4,4,4"
/> />
<style id="DOCK_WINDOW_CAPTION" <style id="DOCK_WINDOW_CAPTION"
backgroundColor="#4d6082" backgroundImageId="dock_window_caption_background"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="WRAP_CONTENT" layoutHeight="WRAP_CONTENT"
padding="1,1,1,1" padding="1,1,1,1"
/> />
<style id="DOCK_WINDOW_CAPTION_LABEL" <style id="DOCK_WINDOW_CAPTION_LABEL"
textColor="#FFFFFF" textColor="#000000"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="WRAP_CONTENT" layoutHeight="WRAP_CONTENT"
padding="3,3,3,3" padding="3,3,3,3"
align="Left|VCenter" align="Left|VCenter"
/> />
<style id="DOCK_WINDOW_BODY" <style id="DOCK_WINDOW_BODY"
backgroundColor="#FFFFFF"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="FILL_PARENT" layoutHeight="FILL_PARENT"
padding="1,1,1,1" padding="3,3,3,3"
/> />
<style id="TOOLBAR_HOST" <style id="TOOLBAR_HOST"
backgroundColor="#d6dbe9" backgroundImageId="toolbar_host_background"
layoutWidth="FILL_PARENT" layoutWidth="FILL_PARENT"
layoutHeight="WRAP_CONTENT" layoutHeight="WRAP_CONTENT"
padding="1,1,1,1" padding="1,1,1,1"

View File

@ -26,6 +26,15 @@ res/combobox_background_dark.xml
res/editbox_background.xml res/editbox_background.xml
res/editbox_background_dark.xml res/editbox_background_dark.xml
res/exit.png res/exit.png
res/dock_window_background.xml
res/dock_window_background_focused.9.png
res/dock_window_background_normal.9.png
res/dock_window_caption_background.xml
res/dock_window_caption_background_focused.9.png
res/dock_window_caption_background_normal.9.png
res/dock_window_caption_background_down.xml
res/dock_window_caption_background_focused_down.9.png
res/dock_window_caption_background_normal_down.9.png
res/fileclose.png res/fileclose.png
res/fileopen.png res/fileopen.png
res/frame_blue.9.png res/frame_blue.9.png
@ -35,6 +44,7 @@ res/list_item_background.xml
res/list_item_background_dark.xml res/list_item_background_dark.xml
res/list_item_background_solid.xml res/list_item_background_solid.xml
res/list_item_background_solid_dark.xml res/list_item_background_solid_dark.xml
res/main_menu_background.9.png
res/main_menu_item_background.xml res/main_menu_item_background.xml
res/main_menu_item_background_dark.xml res/main_menu_item_background_dark.xml
res/main_menu_item_background_hover.9.png res/main_menu_item_background_hover.9.png
@ -190,6 +200,7 @@ res/mdpi/tab_btn_dark_down_selected_dark.9.png
res/mdpi/tab_btn_dark_up_focused.9.png res/mdpi/tab_btn_dark_up_focused.9.png
res/mdpi/tab_btn_dark_up_focused_dark.9.png res/mdpi/tab_btn_dark_up_focused_dark.9.png
res/mdpi/tab_btn_dark_up_focused_selected.9.png res/mdpi/tab_btn_dark_up_focused_selected.9.png
res/mdpi/tab_btn_dark_up_focused_hover.9.png
res/mdpi/tab_btn_dark_up_focused_selected_dark.9.png res/mdpi/tab_btn_dark_up_focused_selected_dark.9.png
res/mdpi/tab_btn_dark_up_hover.9.png res/mdpi/tab_btn_dark_up_hover.9.png
res/mdpi/tab_btn_dark_up_hover_dark.9.png res/mdpi/tab_btn_dark_up_hover_dark.9.png
@ -206,6 +217,7 @@ res/mdpi/tab_up_background_dark_focused_dark.9.png
res/mdpi/tab_up_background_dark_normal.9.png res/mdpi/tab_up_background_dark_normal.9.png
res/mdpi/tab_up_background_dark_normal_dark.9.png res/mdpi/tab_up_background_dark_normal_dark.9.png
res/mdpi/text-plain.png res/mdpi/text-plain.png
res/mdpi/toolbar_host_background.9.png
res/mdpi/toolbar_background.9.png res/mdpi/toolbar_background.9.png
res/mdpi/toolbar_background_dark.9.png res/mdpi/toolbar_background_dark.9.png
res/mdpi/toolbar_button_hover.9.png res/mdpi/toolbar_button_hover.9.png