mirror of
https://github.com/chylex/TweetDuck.git
synced 2025-05-09 05:34:05 +02:00
Remove TabButton and TabPanel
This commit is contained in:
parent
00d6dc5626
commit
ebe5d50dae
@ -1,25 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
sealed class TabButton : FlatButton{
|
||||
public Action Callback { get; private set; }
|
||||
|
||||
public void SetupButton(int locationX, int sizeWidth, string title, Action callback){
|
||||
Callback = callback;
|
||||
|
||||
SuspendLayout();
|
||||
FlatAppearance.BorderColor = Color.DimGray;
|
||||
FlatAppearance.MouseDownBackColor = Color.White;
|
||||
FlatAppearance.MouseOverBackColor = Color.White;
|
||||
FlatStyle = FlatStyle.Flat;
|
||||
Location = new Point(locationX, 0);
|
||||
Margin = new Padding(0);
|
||||
Size = new Size(sizeWidth, 30);
|
||||
Text = title;
|
||||
UseVisualStyleBackColor = true;
|
||||
ResumeLayout(true);
|
||||
}
|
||||
}
|
||||
}
|
68
Core/Controls/TabPanel.Designer.cs
generated
68
Core/Controls/TabPanel.Designer.cs
generated
@ -1,68 +0,0 @@
|
||||
namespace TweetDuck.Core.Controls {
|
||||
partial class TabPanel {
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing) {
|
||||
if (disposing && (components != null)) {
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Component Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent() {
|
||||
this.panelButtons = new System.Windows.Forms.Panel();
|
||||
this.panelContent = new System.Windows.Forms.Panel();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// panelButtons
|
||||
//
|
||||
this.panelButtons.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panelButtons.Location = new System.Drawing.Point(0, 0);
|
||||
this.panelButtons.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelButtons.Name = "panelButtons";
|
||||
this.panelButtons.Size = new System.Drawing.Size(640, 30);
|
||||
this.panelButtons.TabIndex = 0;
|
||||
//
|
||||
// panelContent
|
||||
//
|
||||
this.panelContent.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.panelContent.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.panelContent.Location = new System.Drawing.Point(0, 29);
|
||||
this.panelContent.Margin = new System.Windows.Forms.Padding(0);
|
||||
this.panelContent.Name = "panelContent";
|
||||
this.panelContent.Size = new System.Drawing.Size(640, 451);
|
||||
this.panelContent.TabIndex = 1;
|
||||
//
|
||||
// TabPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.panelContent);
|
||||
this.Controls.Add(this.panelButtons);
|
||||
this.Name = "TabPanel";
|
||||
this.Size = new System.Drawing.Size(640, 480);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Panel panelButtons;
|
||||
private System.Windows.Forms.Panel panelContent;
|
||||
}
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace TweetDuck.Core.Controls{
|
||||
sealed partial class TabPanel : UserControl{
|
||||
public Panel Content => panelContent;
|
||||
public IEnumerable<TabButton> Buttons => panelButtons.Controls.Cast<TabButton>();
|
||||
|
||||
public TabButton ActiveButton { get; private set; }
|
||||
|
||||
private int btnWidth;
|
||||
|
||||
public TabPanel(){
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public void SetupTabPanel(int buttonWidth){
|
||||
this.btnWidth = buttonWidth;
|
||||
}
|
||||
|
||||
public TabButton AddButton(string title, Action callback){
|
||||
TabButton button = new TabButton();
|
||||
button.SetupButton((btnWidth-1)*panelButtons.Controls.Count, btnWidth, title, callback);
|
||||
button.Click += (sender, args) => SelectTab((TabButton)sender);
|
||||
|
||||
panelButtons.Controls.Add(button);
|
||||
return button;
|
||||
}
|
||||
|
||||
public void SelectTab(TabButton button){
|
||||
if (ActiveButton != null){
|
||||
ActiveButton.BackColor = SystemColors.Control;
|
||||
}
|
||||
|
||||
button.BackColor = Color.White;
|
||||
button.Callback();
|
||||
|
||||
ActiveButton = button;
|
||||
}
|
||||
|
||||
public void ReplaceContent(Control newControl){
|
||||
newControl.Dock = DockStyle.Fill;
|
||||
Content.SuspendLayout();
|
||||
Content.Controls.Clear();
|
||||
Content.Controls.Add(newControl);
|
||||
Content.ResumeLayout(true);
|
||||
}
|
||||
}
|
||||
}
|
@ -83,15 +83,6 @@
|
||||
<Compile Include="Core\Controls\LabelVertical.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core\Controls\TabButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core\Controls\TabPanel.cs">
|
||||
<SubType>UserControl</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Core\Controls\TabPanel.Designer.cs">
|
||||
<DependentUpon>TabPanel.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Core\Handling\BrowserProcessHandler.cs" />
|
||||
<Compile Include="Core\Handling\ContextMenuBase.cs" />
|
||||
<Compile Include="Core\Handling\ContextMenuBrowser.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user