Mini Kabibi Habibi
{\rtf1\ansi\ansicpg1251\deff0\deftab709{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
{\colortbl ;\red0\green0\blue255;\red43\green145\blue175;\red0\green128\blue0;}
{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\sl240\slmult1\cf1\lang1033\f0\fs20 using\cf0 System;\fs24\par
\cf1\fs20 using\cf0 System.Windows.Forms;\fs24\par
\fs20\par
\cf1 namespace\cf0 DevExpress.XtraBars.Alerter \{\fs24\par
\cf1\fs20 class\cf0 \cf2 AlertPopupMenuButton\cf0 : \cf2 AlertPredefinedButton\cf0 \{\fs24\par
\cf2\fs20 PopupMenu\cf0 menu;\fs24\par
\cf2\fs20 AlertButtonCollection\cf0 collection;\fs24\par
\cf1\fs20 public\cf0 AlertPopupMenuButton(\cf2 AlertForm\cf0 form, \cf2 AlertButtonCollection\cf0 collection, \cf2 PopupMenu\cf0 menu)\fs24\par
\fs20 : \cf1 base\cf0 (\cf2 AlertControlHelper\cf0 .WindowImages.Images[3]) \{\fs24\par
\cf1\fs20 this\cf0 .menu = menu;\fs24\par
\cf1\fs20 this\cf0 .collection = collection;\fs24\par
\fs20 SetOwner(form);\fs24\par
\fs20 Bounds = form.ViewInfo.GetControlBoxElementRectangle(collection.PredefinedButtonCount, \cf1 this\cf0 .GetButtonSize());\fs24\par
\cf3\fs20 //Hint = "Show popup menu";\cf0\fs24\par
\cf1\fs20 if\cf0 (menu != \cf1 null\cf0 )\fs24\par
\fs20 menu.CloseUp += \cf1 new\cf0 \cf2 EventHandler\cf0 (menu_CloseUp);\fs24\par
\fs20\}\fs24\par
\cf1\fs20 public\cf0 \cf1 override\cf0 \cf1 void\cf0 Dispose() \{\fs24\par
\cf1\fs20 if\cf0 (menu != \cf1 null\cf0 ) \fs24\par
\fs20 menu.CloseUp -= \cf1 new\cf0 \cf2 EventHandler\cf0 (menu_CloseUp);\fs24\par
\cf1\fs20 base\cf0 .Dispose();\fs24\par
\fs20\}\fs24\par
\cf1\fs20 void\cf0 menu_CloseUp(\cf1 object\cf0 sender, \cf2 EventArgs\cf0 e) \{\fs24\par
\fs20 Owner.Pin = IsPinDown;\fs24\par
\fs20 actionElement = \cf1 false\cf0 ;\fs24\par
\fs20 Invalidate();\fs24\par
\fs20\}\fs24\par
\cf1\fs20 bool\cf0 IsPinDown \{\fs24\par
\cf1\fs20 get\cf0 \{\fs24\par
\cf1\fs20 foreach\cf0 (\cf2 AlertButton\cf0 item \cf1 in\cf0 collection) \{\fs24\par
\cf1\fs20 if\cf0 (item \cf1 is\cf0 \cf2 AlertPinButton\cf0 && item.Down)\fs24\par
\cf1\fs20 return\cf0 \cf1 true\cf0 ;\fs24\par
\fs20\}\fs24\par
\cf1\fs20 return\cf0 \cf1 false\cf0 ;\fs24\par
\fs20\}\fs24\par
\fs20\}\fs24\par
\cf1\fs20 void\cf0 SetInfoRecursion(\cf1 object\cf0 container) \{\fs24\par
\cf2\fs20 BarLinkContainerItem\cf0 cont = container \cf1 as\cf0 \cf2 BarLinkContainerItem\cf0 ;\fs24\par
\cf1\fs20 if\cf0 (cont == \cf1 null\cf0 ) \cf1 return\cf0 ;\fs24\par
\cf1\fs20 foreach\cf0 (\cf2 BarItemLink\cf0 link \cf1 in\cf0 cont.ItemLinks) \{\fs24\par
\fs20 SetInfoRecursion(link.Item);\fs24\par
\fs20 link.Item.Tag = \cf1 new\cf0 \cf2 AlertClickEventArgs\cf0 (Owner.Info, Owner);\fs24\par
\fs20\}\fs24\par
\fs20\}\fs24\par
\cf1\fs20 public\cf0 \cf1 override\cf0 \cf1 void\cf0 OnClick() \{\fs24\par
\cf1\fs20 base\cf0 .OnClick();\fs24\par
\fs20 Owner.Pin = \cf1 true\cf0 ;\fs24\par
\fs20 actionElement = \cf1 true\cf0 ;\fs24\par
\cf1\fs20 foreach\cf0 (\cf2 BarItemLink\cf0 link \cf1 in\cf0 menu.ItemLinks) \{\fs24\par
\fs20 SetInfoRecursion(link.Item);\fs24\par
\fs20 link.Item.Tag = \cf1 new\cf0 \cf2 AlertClickEventArgs\cf0 (Owner.Info, Owner);\fs24\par
\fs20\}\fs24\par
\cf1\fs20 this\cf0 .menu.Activator = Owner;\fs24\par
\cf1\fs20 this\cf0 .menu.ShowPopup(\cf2 Cursor\cf0 .Position);\fs24\par
\fs20\}\fs24\par
\fs20\}\fs24\par
\fs20\}\par
\fs24\par
}