Skip to content

Commit

Permalink
Better BaseModalView layout (#1553)
Browse files Browse the repository at this point in the history
  • Loading branch information
msevestre authored Mar 20, 2022
1 parent edf0c41 commit d9820ce
Show file tree
Hide file tree
Showing 26 changed files with 159 additions and 1,028 deletions.
58 changes: 58 additions & 0 deletions src/OSPSuite.UI/Extensions/TablePanelExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
using System.Drawing;
using System.Windows.Forms;
using DevExpress.Utils.Layout;
using DevExpress.XtraEditors;

namespace OSPSuite.UI.Extensions
{
public static class TablePanelExtensions
{
public static TablePanel WithAbsoluteWidth(this TablePanel tablePanel, int columnIndex0, int width)
{
tablePanel.Columns[columnIndex0].Style = TablePanelEntityStyle.Absolute;
tablePanel.Columns[columnIndex0].Width = width;
return tablePanel;
}

public static void AdjustButtonWithImageOnly(this TablePanel tablePanel, SimpleButton button)
{
tablePanel.AdjustButtonSize(button, UIConstants.Size.RADIO_GROUP_HEIGHT, UIConstants.Size.BUTTON_HEIGHT);
}

public static void AdjustLongButtonWidth(this TablePanel tablePanel, SimpleButton button)
{
tablePanel.AdjustButtonSize(button, UIConstants.Size.LARGE_BUTTON_WIDTH);
}

public static void AdjustButton(this TablePanel tablePanel, SimpleButton button)
{
tablePanel.AdjustButtonSize(button, UIConstants.Size.BUTTON_WIDTH, UIConstants.Size.BUTTON_HEIGHT);
}

public static void AdjustButtonSize(this TablePanel tablePanel, SimpleButton button, int? width=null, int? height = null)
{
var row = tablePanel.RowFor(button);
var col = tablePanel.ColumnFor(button);
if (width.HasValue)
{
col.Style = TablePanelEntityStyle.Absolute;
col.Width = width.Value;
}

if (height.HasValue)
{
row.Style = TablePanelEntityStyle.Absolute;
row.Height = height.Value;
}
}

public static TablePanelRow RowFor(this TablePanel tablePanel, Control control)
{
return tablePanel.Rows[tablePanel.GetRow(control)];
}
public static TablePanelColumn ColumnFor(this TablePanel tablePanel, Control control)
{
return tablePanel.Columns[tablePanel.GetColumn(control)];
}
}
}
9 changes: 0 additions & 9 deletions src/OSPSuite.UI/Views/BaseModalContainerView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

161 changes: 44 additions & 117 deletions src/OSPSuite.UI/Views/BaseModalView.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d9820ce

Please sign in to comment.