Skip to content

Commit afb1266

Browse files
committed
Add AddSeparator extension to create a separator in the ribbon panel.
1 parent 6245070 commit afb1266

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77
## [0.2.0] / 2025-07-04
88
### Features
99
- Add `ricaun.AutoCAD.UI.Example` sample project.
10+
### UI
11+
- Add `AddSeparator` extension to create a separator in the ribbon panel.
12+
### Example
13+
- Add `CircleCreate` command to the example project.
1014
### Fixes
1115
- Fix `CheckURLValid` to support `http` and `https`.
1216
- Fix `SetImage` to update `Image` property.

ricaun.AutoCAD.UI.Example/App.cs

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,13 @@ public override void OnStartup(RibbonControl ribbonControl)
1515
{
1616
var ribbonPanel = ribbonControl.CreateOrSelectPanel(PanelName, TabName);
1717

18-
ribbonPanel.RowStackedItems(
18+
ribbonPanel.RowLargeStackedItems(
1919
ribbonPanel.CreateButton("Theme")
20+
.SetShowText(false)
21+
.SetCommand(Commands.ThemeChange)
22+
.SetLargeImage("https://github.com/ricaun-io/Autodesk.Icon.Example/releases/download/2.0.0/Box-Grey-Light.tiff"),
23+
ribbonPanel.CreateButton("Theme")
24+
.SetShowText(false)
2025
.SetCommand(Commands.ThemeChange)
2126
.SetLargeImage("https://github.com/ricaun-io/Autodesk.Icon.Example/releases/download/2.0.0/Box-Red-Light.tiff"),
2227
ribbonPanel.CreateButton("Theme")
@@ -27,8 +32,12 @@ public override void OnStartup(RibbonControl ribbonControl)
2732
.SetLargeImage("https://github.com/ricaun-io/Autodesk.Icon.Example/releases/download/2.0.0/Box-Blue-32-Light.png")
2833
);
2934

30-
ribbonPanel.CreateButton("Circle")
35+
ribbonPanel.AddSeparator();
36+
37+
ribbonPanel.CreateButton("Circle\rCreate")
3138
.SetCommand(Commands.CircleCreate)
39+
.SetDescription("Create a circle with a random radius in the model space.")
40+
.SetToolTip("This button use the command 'CircleCreate'.")
3241
.SetLargeImage("Resources/Box-Cyan-Light.tiff");
3342

3443
ribbonControl.ActiveTab = ribbonPanel.Tab;

ricaun.AutoCAD.UI/RibbonExtension.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,5 +420,17 @@ public static void Remove(this RibbonTab ribbonTab)
420420
ribbonControl.Tabs.Remove(ribbonTab);
421421
}
422422
#endregion
423+
424+
/// <summary>
425+
/// Adds a separator to the ribbon panel.
426+
/// </summary>
427+
/// <param name="ribbonPanel">The ribbon panel to extend.</param>
428+
/// <returns>The ribbon panel with the separator added.</returns>
429+
public static RibbonPanel AddSeparator(this RibbonPanel ribbonPanel)
430+
{
431+
if (ribbonPanel is null) return ribbonPanel;
432+
ribbonPanel.AddItem(new RibbonSeparator());
433+
return ribbonPanel;
434+
}
423435
}
424436
}

0 commit comments

Comments
 (0)