This commit is contained in:
Vadim Lopatin 2014-04-14 08:35:59 +04:00
parent dce7eec7a8
commit 506efefd14
4 changed files with 17 additions and 4 deletions

View File

@ -137,6 +137,7 @@ class Window {
protected Widget _mouseCaptureWidget;
protected ushort _mouseCaptureButtons;
protected bool _mouseCaptureFocusedOut;
/// does current capture widget want to receive move events even if pointer left it
protected bool _mouseCaptureFocusedOutTrackMovements;
protected bool dispatchCancel(MouseEvent event) {
@ -172,12 +173,14 @@ class Window {
// sending FocusOut message
event.changeAction(MouseAction.FocusOut);
_mouseCaptureFocusedOut = true;
_mouseCaptureButtons = event.flags & (MouseFlag.LButton|MouseFlag.RButton|MouseFlag.MButton);
_mouseCaptureButtons = currentButtons;
_mouseCaptureFocusedOutTrackMovements = _mouseCaptureWidget.onMouseEvent(event);
return true;
} else if (_mouseCaptureFocusedOutTrackMovements) {
// pointer is outside, but we still need to track pointer
return _mouseCaptureWidget.onMouseEvent(event);
}
// don't forward message
return true;
} else {
// point is inside widget

View File

@ -64,7 +64,13 @@ class MainMenu : HorizontalLayout {
styleId = "MAIN_MENU";
_item = item;
for (int i = 0; i < item.subitemCount; i++) {
addChild(new MenuItemWidget(item.subitem(i)));
MenuItemWidget subitem = new MenuItemWidget(item.subitem(i));
if (i == 1)
subitem.setState(State.Focused);
else if (i == 2)
subitem.setState(State.Pressed);
addChild(subitem);
}
addChild((new Widget()).layoutWidth(FILL_PARENT));
}

View File

@ -614,7 +614,8 @@ immutable ATTR_SCROLLBAR_INDICATOR_HORIZONTAL = "scrollbar_indicator_horizontal"
Theme createDefaultTheme() {
Log.d("Creating default theme");
Theme res = new Theme("default");
res.fontSize(14);
//res.fontSize(14);
res.fontSize(24);
Style button = res.createSubstyle("BUTTON").backgroundImageId("btn_default_small").alignment(Align.Center);
Style buttonTransparent = res.createSubstyle("BUTTON_TRANSPARENT").backgroundImageId("btn_default_small_transparent").alignment(Align.Center);
Style text = res.createSubstyle("TEXT").margins(Rect(2,2,2,2)).padding(Rect(1,1,1,1));
@ -664,7 +665,9 @@ Theme createDefaultTheme() {
//res.dumpStats();
Style mainMenu = res.createSubstyle("MAIN_MENU").backgroundColor(0xE0E0E0).layoutWidth(FILL_PARENT);
Style menuItem = res.createSubstyle("MENU_ITEM").padding(Rect(4,2,4,2)).backgroundColor(0xE0E0E0) ;
Style menuItem = res.createSubstyle("MENU_ITEM").padding(Rect(4,2,4,2)).backgroundColor(0xE0E080) ;
menuItem.createState(State.Focused, State.Focused).backgroundColor(0x40C0C000);
menuItem.createState(State.Pressed, State.Pressed).backgroundColor(0x4080C000);
menuItem.createState(State.Hovered, State.Hovered).backgroundColor(0x80E0E000);
return res;

View File

@ -51,6 +51,7 @@ class TabItemWidget : HorizontalLayout {
_closeButton = new ImageButton("CLOSE");
_closeButton.styleId = "BUTTON_TRANSPARENT";
_closeButton.drawableId = "close";
_closeButton.trackHover = true;
_closeButton.onClickListener = &onClick;
if (_enableCloseButton) {
_closeButton.visibility = Visibility.Gone;