예제 #1
0
        private static bool PlatformSetIcon(Command cmd)
        {
            IconInfo iconInfo = null;

            Gdk.Pixbuf icon = null;

            try
            {
                switch (cmd.MenuText)
                {
                case "New...":
                    iconInfo = _theme.LookupIcon("document-new-symbolic", 16, 0);
                    break;

                case "Open...":
                    iconInfo = _theme.LookupIcon("document-open-symbolic", 16, 0);
                    break;

                case "Save...":
                    iconInfo = _theme.LookupIcon("document-save-symbolic", 16, 0);
                    break;

                case "Undo":
                    iconInfo = _theme.LookupIcon("edit-undo-symbolic", 16, 0);
                    break;

                case "Redo":
                    iconInfo = _theme.LookupIcon("edit-redo-symbolic", 16, 0);
                    break;

                case "New Item...":
                    iconInfo = _theme.LookupIcon("document-new-symbolic", 16, 0);
                    break;

                case "New Folder...":
                    iconInfo = _theme.LookupIcon("folder-new-symbolic", 16, 0);
                    break;

                case "Existing Item...":
                    iconInfo = _theme.LookupIcon("folder-documents-symbolic", 16, 0);
                    break;

                case "Existing Folder...":
                    iconInfo = _theme.LookupIcon("folder-open-symbolic", 16, 0);
                    break;

                case "Build":
                    iconInfo = _theme.LookupIcon("emblem-system-symbolic", 16, 0);
                    break;

                case "Rebuild":
                    iconInfo = _theme.LookupIcon("system-run-symbolic", 16, 0);
                    break;

                case "Cancel Build":
                    iconInfo = _theme.LookupIcon("media-playback-stop-symbolic", 16, 0);
                    break;

                case "Clean":
                    iconInfo = _theme.LookupIcon("edit-clear-symbolic", 16, 0);
                    break;

                case "Filter Output":
                    iconInfo = _theme.LookupIcon("format-indent-more-symbolic", 16, 0);
                    break;
                }

                if (iconInfo != null)
                {
                    var  colText = SystemColors.ControlText;
                    bool ws;
                    var  col = new Gdk.RGBA();
                    col.Red   = colText.R;
                    col.Green = colText.G;
                    col.Blue  = colText.B;
                    col.Alpha = colText.A;

                    icon = iconInfo.LoadSymbolic(col, col, col, col, out ws);
                }
            }
            catch { }

            if (icon != null)
            {
                cmd.Image = new Bitmap(new BitmapHandler(icon));
                return(true);
            }

            return(false);
        }