Restrict ClickThrough to what it was originally intended for.

This commit is contained in:
Paul Chote
2011-01-05 23:09:45 +13:00
parent 5254deedcb
commit 7cabe920db
21 changed files with 25 additions and 55 deletions

View File

@@ -15,6 +15,7 @@ namespace OpenRA.Widgets
public class BackgroundWidget : Widget
{
public readonly string Background = "dialog";
public readonly bool ClickThrough = false;
public override void DrawInner( WorldRenderer wr )
{
@@ -23,10 +24,16 @@ namespace OpenRA.Widgets
public BackgroundWidget() : base() { }
public override bool HandleMouseInput(MouseInput mi)
{
return !ClickThrough;
}
protected BackgroundWidget(BackgroundWidget other)
: base(other)
{
Background = other.Background;
ClickThrough = other.ClickThrough;
}
public override Widget Clone() { return new BackgroundWidget(this); }

View File

@@ -167,14 +167,9 @@ namespace OpenRA.Widgets
public static void ShowDropDown<T>(Widget w, IEnumerable<T> ts, Func<T, int, LabelWidget> ft)
{
var dropDown = new ScrollPanelWidget()
{
Bounds = new Rectangle(w.RenderOrigin.X, w.RenderOrigin.Y + w.Bounds.Height, w.Bounds.Width, 100),
Visible = true,
ClickThrough = false,
OnMouseUp = mi => true,
ItemSpacing = 1
};
var dropDown = new ScrollPanelWidget();
dropDown.Bounds = new Rectangle(w.RenderOrigin.X, w.RenderOrigin.Y + w.Bounds.Height, w.Bounds.Width, 100);
dropDown.ItemSpacing = 1;
List<LabelWidget> items = new List<LabelWidget>();
List<Widget> dismissAfter = new List<Widget>();
@@ -182,8 +177,6 @@ namespace OpenRA.Widgets
{
var ww = ft(t, dropDown.Bounds.Width - dropDown.ScrollbarWidth);
dismissAfter.Add(ww);
ww.ClickThrough = false;
ww.IsVisible = () => true;
ww.OnMouseMove = mi => items.Do(lw =>
{
lw.Background = null; ww.Background = "dialog2";

View File

@@ -27,7 +27,6 @@ namespace OpenRA.Widgets
public string Height = "0";
public string Delegate = null;
public string EventHandler = null;
public bool ClickThrough = true;
public bool Visible = true;
public readonly List<Widget> Children = new List<Widget>();
@@ -63,7 +62,6 @@ namespace OpenRA.Widgets
Width = widget.Width;
Height = widget.Height;
Delegate = widget.Delegate;
ClickThrough = widget.ClickThrough;
Visible = widget.Visible;
Bounds = widget.Bounds;

View File

@@ -447,7 +447,6 @@ Background@MAP_CHOOSER:
Id:MAP_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -204,7 +204,6 @@ Container@INGAME_ROOT:
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
ClickThrough: True
DrawBackground: False
RemoveTime:250
ChatEntry@CHAT_ENTRY:
@@ -213,7 +212,6 @@ Container@INGAME_ROOT:
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
ClickThrough: True
Background@DEVELOPERMODE_BG:
Id:DEVELOPERMODE_BG
Delegate:DeveloperModeDelegate
@@ -414,7 +412,6 @@ Container@OBSERVER_ROOT:
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
ClickThrough: True
DrawBackground: False
RemoveTime:250
ChatEntry@CHAT_ENTRY:
@@ -423,7 +420,6 @@ Container@OBSERVER_ROOT:
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
ClickThrough: True
Background@FMVPLAYER:
Id:FMVPLAYER
Width:WINDOW_RIGHT

View File

@@ -73,7 +73,6 @@ Background@MAINMENU_BG:
Text:Video Player
Bold:True
Background@PERF_BG:
ClickThrough:true
Id:PERF_BG
Background:dialog4
Delegate:PerfDebugDelegate
@@ -218,7 +217,6 @@ Background@MUSIC_MENU:
Id:MUSIC_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -26,7 +26,6 @@ Background@REPLAYBROWSER_BG:
Id:REPLAY_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -120,7 +120,6 @@ Background@JOINSERVER_BG:
Id:SERVER_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -31,7 +31,6 @@ Background@VIDEOPLAYER_MENU:
Id:VIDEO_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -417,7 +417,6 @@ Background@MAP_CHOOSER:
Id:MAP_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -203,7 +203,6 @@ Container@INGAME_ROOT:
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
ClickThrough: True
DrawBackground: False
RemoveTime:250
ChatEntry@CHAT_ENTRY:
@@ -212,7 +211,6 @@ Container@INGAME_ROOT:
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
ClickThrough: True
Background@DEVELOPERMODE_BG:
Id:DEVELOPERMODE_BG
Delegate:DeveloperModeDelegate

View File

@@ -220,7 +220,6 @@ Background@MUSIC_MENU:
Id:MUSIC_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -122,7 +122,6 @@ Background@JOINSERVER_BG:
Id:SERVER_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -32,7 +32,6 @@ Background@VIDEOPLAYER_MENU:
Id:VIDEO_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -1,6 +1,3 @@
Container:
ClickThrough:true
Children:
Background@MAINMENU_BG:
Id:MAINMENU_BG
X:(WINDOW_RIGHT - WIDTH)/2

View File

@@ -447,7 +447,6 @@ Background@MAP_CHOOSER:
Id:MAP_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -211,7 +211,6 @@ Container@INGAME_ROOT:
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
ClickThrough: True
DrawBackground: False
RemoveTime:250
ChatEntry@CHAT_ENTRY:
@@ -220,7 +219,6 @@ Container@INGAME_ROOT:
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
ClickThrough: True
Background@DEVELOPERMODE_BG:
Id:DEVELOPERMODE_BG
Delegate:DeveloperModeDelegate
@@ -421,7 +419,6 @@ Container@OBSERVER_ROOT:
Y:WINDOW_BOTTOM - HEIGHT - 30
Width: 760
Height: 200
ClickThrough: True
DrawBackground: False
RemoveTime:250
ChatEntry@CHAT_ENTRY:
@@ -430,7 +427,6 @@ Container@OBSERVER_ROOT:
Y:WINDOW_BOTTOM - HEIGHT
Width: 760
Height: 30
ClickThrough: True
Background@FMVPLAYER:
Id:FMVPLAYER
Width:WINDOW_RIGHT

View File

@@ -219,7 +219,6 @@ Background@MUSIC_MENU:
Id:MUSIC_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -26,7 +26,6 @@ Background@REPLAYBROWSER_BG:
Id:REPLAY_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -120,7 +120,6 @@ Background@JOINSERVER_BG:
Id:SERVER_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false

View File

@@ -31,7 +31,6 @@ Background@VIDEOPLAYER_MENU:
Id:VIDEO_TEMPLATE
Width:PARENT_RIGHT-28
Height:25
ClickThrough:false
X:2
Y:0
Visible:false