mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-29 02:34:06 +02:00
Refactor FormNotificationBase.GetBorderStyle
This commit is contained in:
parent
ca55119531
commit
1b92b112e2
Core/Notification
@ -1,14 +1,24 @@
|
|||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using TweetDuck.Core.Utils;
|
|
||||||
using TweetDuck.Plugins;
|
using TweetDuck.Plugins;
|
||||||
using TweetDuck.Resources;
|
using TweetDuck.Resources;
|
||||||
|
|
||||||
namespace TweetDuck.Core.Notification.Example{
|
namespace TweetDuck.Core.Notification.Example{
|
||||||
sealed class FormNotificationExample : FormNotificationMain{
|
sealed class FormNotificationExample : FormNotificationMain{
|
||||||
public override bool RequiresResize => true;
|
public override bool RequiresResize => true;
|
||||||
|
|
||||||
protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom;
|
protected override bool CanDragWindow => Program.UserConfig.NotificationPosition == TweetNotification.Position.Custom;
|
||||||
private bool CanResizeWindow => Program.UserConfig.NotificationSize == TweetNotification.Size.Custom;
|
|
||||||
|
protected override FormBorderStyle NotificationBorderStyle{
|
||||||
|
get{
|
||||||
|
if (Program.UserConfig.NotificationSize == TweetNotification.Size.Custom){
|
||||||
|
switch(base.NotificationBorderStyle){
|
||||||
|
case FormBorderStyle.FixedSingle: return FormBorderStyle.Sizable;
|
||||||
|
case FormBorderStyle.FixedToolWindow: return FormBorderStyle.SizableToolWindow;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return base.NotificationBorderStyle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly TweetNotification exampleNotification;
|
private readonly TweetNotification exampleNotification;
|
||||||
|
|
||||||
@ -32,14 +42,5 @@ public void ShowExampleNotification(bool reset){
|
|||||||
|
|
||||||
UpdateTitle();
|
UpdateTitle();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FormBorderStyle GetBorderStyle(){
|
|
||||||
if (WindowsUtils.ShouldAvoidToolWindow && Visible){ // Visible = workaround for alt+tab
|
|
||||||
return CanResizeWindow ? FormBorderStyle.Sizable : FormBorderStyle.FixedSingle;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return CanResizeWindow ? FormBorderStyle.SizableToolWindow : FormBorderStyle.FixedToolWindow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,18 @@ protected Point PrimaryLocation{
|
|||||||
|
|
||||||
set{
|
set{
|
||||||
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
Visible = (base.Location = value) != ControlExtensions.InvisibleLocation;
|
||||||
FormBorderStyle = GetBorderStyle();
|
FormBorderStyle = NotificationBorderStyle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual FormBorderStyle NotificationBorderStyle{
|
||||||
|
get{
|
||||||
|
if (WindowsUtils.ShouldAvoidToolWindow && Visible){ // Visible = workaround for alt+tab
|
||||||
|
return FormBorderStyle.FixedSingle;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
return FormBorderStyle.FixedToolWindow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -225,14 +236,5 @@ public void DisplayTooltip(string text){
|
|||||||
toolTip.Show(text, this, position);
|
toolTip.Show(text, this, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual FormBorderStyle GetBorderStyle(){
|
|
||||||
if (WindowsUtils.ShouldAvoidToolWindow && Visible){ // Visible = workaround for alt+tab
|
|
||||||
return FormBorderStyle.FixedSingle;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
return FormBorderStyle.FixedToolWindow;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user