Add tooltips to overflowing labels
This commit is contained in:
committed by
abcdefg30
parent
1fee50be2e
commit
fde215360c
@@ -287,7 +287,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
() => currentFilename == filepath && currentPackage == package,
|
||||
() => { LoadAsset(package, filepath); });
|
||||
|
||||
item.Get<LabelWidget>("TITLE").GetText = () => filepath;
|
||||
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||
WidgetUtils.TruncateLabelToTooltip(label, filepath);
|
||||
|
||||
item.IsVisible = () =>
|
||||
{
|
||||
bool visible;
|
||||
|
||||
@@ -201,7 +201,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
item.OnDoubleClick = Load;
|
||||
|
||||
var title = Path.GetFileNameWithoutExtension(savePath);
|
||||
item.Get<LabelWidget>("TITLE").GetText = () => title;
|
||||
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||
WidgetUtils.TruncateLabelToTooltip(label, title);
|
||||
|
||||
var date = File.GetLastWriteTime(savePath).ToString("yyyy-MM-dd HH:mm:ss");
|
||||
item.Get<LabelWidget>("DATE").GetText = () => date;
|
||||
|
||||
@@ -192,7 +192,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
() => SelectMap(preview),
|
||||
StartMissionClicked);
|
||||
|
||||
item.Get<LabelWidget>("TITLE").GetText = () => preview.Title;
|
||||
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||
WidgetUtils.TruncateLabelToTooltip(label, preview.Title);
|
||||
|
||||
missionList.AddChild(item);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,7 +135,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
foreach (var song in music)
|
||||
{
|
||||
var item = ScrollItemWidget.Setup(song.Filename, itemTemplate, () => currentSong == song, () => { currentSong = song; Play(); }, () => { });
|
||||
item.Get<LabelWidget>("TITLE").GetText = () => song.Title;
|
||||
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||
WidgetUtils.TruncateLabelToTooltip(label, song.Title);
|
||||
|
||||
item.Get<LabelWidget>("LENGTH").GetText = () => SongLengthLabel(song);
|
||||
musicList.AddChild(item);
|
||||
}
|
||||
|
||||
@@ -709,7 +709,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
};
|
||||
|
||||
item.Text = Path.GetFileNameWithoutExtension(replay.FilePath);
|
||||
item.Get<LabelWidget>("TITLE").GetText = () => item.Text;
|
||||
var label = item.Get<LabelWithTooltipWidget>("TITLE");
|
||||
WidgetUtils.TruncateLabelToTooltip(label, item.Text);
|
||||
|
||||
item.IsVisible = () => replayState[replay].Visible;
|
||||
replayList.AddChild(item);
|
||||
}
|
||||
|
||||
@@ -594,12 +594,10 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
var canJoin = game.IsJoinable;
|
||||
var item = ScrollItemWidget.Setup(serverTemplate, () => currentServer == game, () => SelectServer(game), () => onJoin(game));
|
||||
var title = item.GetOrNull<LabelWidget>("TITLE");
|
||||
var title = item.GetOrNull<LabelWithTooltipWidget>("TITLE");
|
||||
if (title != null)
|
||||
{
|
||||
var font = Game.Renderer.Fonts[title.Font];
|
||||
var label = WidgetUtils.TruncateText(game.Name, title.Bounds.Width, font);
|
||||
title.GetText = () => label;
|
||||
WidgetUtils.TruncateLabelToTooltip(title, game.Name);
|
||||
title.GetColor = () => canJoin ? title.TextColor : incompatibleGameColor;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,11 +48,14 @@ Container@ASSETBROWSER_PANEL:
|
||||
X: 2
|
||||
Y: 0
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 15
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@FILENAME_DESC:
|
||||
X: 15
|
||||
Y: 340
|
||||
@@ -200,3 +203,4 @@ Container@ASSETBROWSER_PANEL:
|
||||
Width: 140
|
||||
Height: 35
|
||||
Text: Back
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -48,11 +48,14 @@ Container@GAMESAVE_BROWSER_PANEL:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 200 - 10
|
||||
Height: 25
|
||||
TooltipContainer: GAMESAVE_TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@DATE:
|
||||
X: PARENT_RIGHT - WIDTH - 10
|
||||
Width: 200
|
||||
@@ -112,4 +115,4 @@ Container@GAMESAVE_BROWSER_PANEL:
|
||||
Height: 35
|
||||
Text: Save
|
||||
Visible: False
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
TooltipContainer@GAMESAVE_TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -154,11 +154,14 @@ Container@LOBBY_MUSIC_BIN:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 50
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@LENGTH:
|
||||
X: PARENT_RIGHT - 60
|
||||
Width: 50
|
||||
|
||||
@@ -85,10 +85,12 @@ Container@LOBBY_SERVERS_BIN:
|
||||
X: 2
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 5
|
||||
Width: 245
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Image@PASSWORD_PROTECTED:
|
||||
X: 272
|
||||
Y: 6
|
||||
|
||||
@@ -39,11 +39,14 @@ Container@MISSIONBROWSER_PANEL:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: False
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Container@MISSION_INFO:
|
||||
X: 337
|
||||
Y: 15
|
||||
@@ -148,6 +151,7 @@ Container@MISSIONBROWSER_PANEL:
|
||||
Y: 1
|
||||
Width: 712
|
||||
Height: 418
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
Background@FULLSCREEN_PLAYER:
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -106,10 +106,12 @@ Container@MULTIPLAYER_PANEL:
|
||||
X: 2
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 5
|
||||
Width: 245
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Image@PASSWORD_PROTECTED:
|
||||
X: 272
|
||||
Y: 6
|
||||
|
||||
@@ -30,11 +30,14 @@ Container@MUSIC_PANEL:
|
||||
X: 2
|
||||
Y: 0
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 50
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@LENGTH:
|
||||
Width: 50
|
||||
X: PARENT_RIGHT - 60
|
||||
@@ -192,3 +195,4 @@ Container@MUSIC_PANEL:
|
||||
Width: 300
|
||||
Height: 20
|
||||
Font: Small
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -167,7 +167,7 @@ Container@REPLAYBROWSER_PANEL:
|
||||
Container@REPLAY_LIST_CONTAINER:
|
||||
X: 310
|
||||
Y: 20
|
||||
Width: 245
|
||||
Width: 250
|
||||
Height: PARENT_BOTTOM - 20 - 20
|
||||
Children:
|
||||
Label@REPLAYBROWSER_LABEL_TITLE:
|
||||
@@ -188,11 +188,14 @@ Container@REPLAYBROWSER_PANEL:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Container@MAP_PREVIEW_ROOT:
|
||||
X: PARENT_RIGHT - WIDTH - 20
|
||||
Y: 50
|
||||
|
||||
@@ -43,11 +43,14 @@ Background@ASSETBROWSER_PANEL:
|
||||
X: 2
|
||||
Y: 0
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@FILENAME_DESC:
|
||||
X: 20
|
||||
Y: 370
|
||||
@@ -203,3 +206,4 @@ Background@ASSETBROWSER_PANEL:
|
||||
Height: 25
|
||||
Font: Bold
|
||||
Text: Close
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -43,11 +43,14 @@ Background@GAMESAVE_BROWSER_PANEL:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 200 - 10
|
||||
Height: 25
|
||||
TooltipContainer: GAMESAVE_TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@DATE:
|
||||
X: PARENT_RIGHT - WIDTH - 10
|
||||
Width: 200
|
||||
@@ -113,4 +116,4 @@ Background@GAMESAVE_BROWSER_PANEL:
|
||||
Text: Save
|
||||
Font: Bold
|
||||
Visible: False
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
TooltipContainer@GAMESAVE_TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -144,11 +144,14 @@ Container@LOBBY_MUSIC_BIN:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 50
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@LENGTH:
|
||||
X: PARENT_RIGHT - 60
|
||||
Width: 50
|
||||
|
||||
@@ -82,10 +82,12 @@ Container@LOBBY_SERVERS_BIN:
|
||||
Height: 25
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 5
|
||||
Width: 245
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Image@PASSWORD_PROTECTED:
|
||||
X: 272
|
||||
Y: 6
|
||||
|
||||
@@ -34,11 +34,14 @@ Background@MISSIONBROWSER_PANEL:
|
||||
Width: PARENT_RIGHT - 27
|
||||
Height: 25
|
||||
X: 2
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Container@MISSION_INFO:
|
||||
X: 300
|
||||
Y: 50
|
||||
@@ -149,6 +152,7 @@ Background@MISSIONBROWSER_PANEL:
|
||||
Y: 1
|
||||
Width: 640
|
||||
Height: 375
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
Background@FULLSCREEN_PLAYER:
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
@@ -98,10 +98,12 @@ Background@MULTIPLAYER_PANEL:
|
||||
Height: 25
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 5
|
||||
Width: 245
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Image@PASSWORD_PROTECTED:
|
||||
X: 272
|
||||
Y: 6
|
||||
|
||||
@@ -18,11 +18,14 @@ Background@MUSIC_PANEL:
|
||||
X: 2
|
||||
Y: 0
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 50
|
||||
Height: 25
|
||||
TooltipContainer: MUSIC_TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@LENGTH:
|
||||
Width: 50
|
||||
X: PARENT_RIGHT - 60
|
||||
@@ -180,3 +183,4 @@ Background@MUSIC_PANEL:
|
||||
Width: 300
|
||||
Height: 20
|
||||
Font: Small
|
||||
TooltipContainer@MUSIC_TOOLTIP_CONTAINER:
|
||||
|
||||
@@ -155,7 +155,7 @@ Background@REPLAYBROWSER_PANEL:
|
||||
Container@REPLAY_LIST_CONTAINER:
|
||||
X: 310
|
||||
Y: 20
|
||||
Width: 245
|
||||
Width: 250
|
||||
Height: PARENT_BOTTOM - 20 - 55
|
||||
Children:
|
||||
Label@REPLAYBROWSER_LABEL_TITLE:
|
||||
@@ -176,11 +176,14 @@ Background@REPLAYBROWSER_PANEL:
|
||||
Height: 25
|
||||
X: 2
|
||||
Visible: false
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Container@MAP_PREVIEW_ROOT:
|
||||
X: PARENT_RIGHT - WIDTH - 20
|
||||
Y: 50
|
||||
|
||||
@@ -34,11 +34,14 @@ Background@MISSIONBROWSER_PANEL:
|
||||
Width: PARENT_RIGHT - 27
|
||||
Height: 25
|
||||
X: 2
|
||||
EnableChildMouseOver: True
|
||||
Children:
|
||||
Label@TITLE:
|
||||
LabelWithTooltip@TITLE:
|
||||
X: 10
|
||||
Width: PARENT_RIGHT - 20
|
||||
Height: 25
|
||||
TooltipContainer: TOOLTIP_CONTAINER
|
||||
TooltipTemplate: SIMPLE_TOOLTIP
|
||||
Label@DIFFICULTY_DESC:
|
||||
X: 210 - WIDTH - 125
|
||||
Y: 468
|
||||
@@ -152,6 +155,7 @@ Background@MISSIONBROWSER_PANEL:
|
||||
Height: 480
|
||||
AspectRatio: 1.2
|
||||
DrawOverlay: False
|
||||
TooltipContainer@TOOLTIP_CONTAINER:
|
||||
|
||||
Background@FULLSCREEN_PLAYER:
|
||||
Width: WINDOW_RIGHT
|
||||
|
||||
Reference in New Issue
Block a user