private PushButtonData createButton(string ButtonName, string ButtonText, string className, string ToolTip, string smallIcon, string largeIcon) { PushButtonData pbd; try { pbd = new PushButtonData(ButtonName, ButtonText, AddInPath, string.Concat(CLASSPATH, className)) { Image = RibbonUtil.GetBitmapImage(smallIcon), LargeImage = RibbonUtil.GetBitmapImage(largeIcon), ToolTip = ToolTip }; } catch (Exception e) { if (!makeButton) { TaskDialog.Show("make button", "failed"); makeButton = true; } return(null); } return(pbd); }
private bool AddStackedPullDownhButtons(RibbonPanel rp) { SplitButton sb0; SplitButton sb1; SplitButtonData sbData0 = new SplitButtonData("pullDownButton0", "function select"); sbData0.Image = RibbonUtil.GetBitmapImage(SMALLICON); SplitButtonData sbData1 = new SplitButtonData("pullDownButton1", "auto activate"); sbData1.Image = RibbonUtil.GetBitmapImage(SMALLICON); PushButtonData pbData0 = createButton("pushButton0", "Auto Update: On - Turn Off", "ToggAutoActivate", "Revit Windows Settings", SMALLICON, LARGEICON); PushButtonData pbData1 = createButton("pushButton1", "Settings", "SettingsFormShow", "Revit Windows Settings", SMALLICON, LARGEICON); IList <RibbonItem> ris = rp.AddStackedItems(sbData0, pbData0, pbData1); sb0 = ris[0] as SplitButton; // sb1 = ris[1] as SplitButton; pb01 = ris[1] as PushButton; PushButtonData pbd; // pull down button 0 pbd = createButton("button00", "Side Views Larger ", "IncreaseSideViewSize", "Make the Active View Larger", SMALLICON, LARGEICON); sb0.AddPushButton(pbd); pbd = createButton("button01", "Side Views Smaller", "DecreaseSideViewSize", "Make the Active View Smaller", SMALLICON, LARGEICON); sb0.AddPushButton(pbd); // // pull down button 1 // pbd = createButton("button10", "Activate Auto On", "AutoActivateOn", // "Turn on AutoActivate", SMALLICON, LARGEICON); // sb1.AddPushButton(pbd); // // pbd = createButton("button11", "Activate Auto Off", "AutoActivateOff", // "Turn off AutoActivate", SMALLICON, LARGEICON); // sb1.AddPushButton(pbd); // return(true); }
private bool AddSplitButton(RibbonPanel rp) { try { SplitButtonData sbData = new SplitButtonData("splitButton01", "function select"); sbData.Image = RibbonUtil.GetBitmapImage(LARGEICON); sbData.LargeImage = RibbonUtil.GetBitmapImage(LARGEICON); SplitButton sb = rp.AddItem(sbData) as SplitButton; PushButtonData pbd; pbd = createButton("SplitBtn01", "Proper\nCascade", "OrganizeProperCascade", "Organize Revit Windows by Proper Cascade", SMALLICON, LARGEICON); sb.AddPushButton(pbd); pbd = createButton("SplitBtn02", "Window's\nCascade", "OrganizeWindowsCascade", "Organize Revit Windows by Windows Cascade", SMALLICON, LARGEICON); sb.AddPushButton(pbd); pbd = createButton("SplitBtn03", "Active on\nLeft Tiled", "OrganizeLeft", "Place the Active Window on the Left", SMALLICON, LARGEICON); sb.AddPushButton(pbd); pbd = createButton("SplitBtn04", "Active on\nTop Tiled", "OrganizeTop", "Place the Active Window on the Top", SMALLICON, LARGEICON); sb.AddPushButton(pbd); pbd = createButton("SplitBtn05", "Active on\nRight Tiled", "OrganizeRight", "Place the Active Window on the Right", SMALLICON, LARGEICON); sb.AddPushButton(pbd); pbd = createButton("SplitBtn06", "Active on\nBottom Tiled", "OrganizeBottom", "Place the Active Window on the Bottom", SMALLICON, LARGEICON); sb.AddPushButton(pbd); pbd = createButton("SplitBtn07", "Active to\nLeft Stacked", "OrganizeLeftOverlapped", "Place the Active Window on the Left\nand Stack Remaining Windows", SMALLICON, LARGEICON); sb.AddPushButton(pbd); } catch { return(false); } return(true); }