private static IntPtr WndProc(IntPtr hWnd, int Msg, int wParam, int lParam)
        {
            Registration reg = null;

            if (!orig_winproc_dict.TryGetValue(hWnd, out reg))
            {
                return(IntPtr.Zero);
            }

            if (Msg == toolbar_created_msg)
            {
                ThumbnailToolbar tb = new ThumbnailToolbar(hWnd);
                toolbars[hWnd] = tb;
                reg.CreationCallback(tb);
            }
            else if (Msg == WM_COMMAND && HiWord(wParam) == THBN_CLICKED)
            {
                int button_id = LoWord(wParam);
                ThumbnailToolbar tb;

                if (toolbars.TryGetValue(hWnd, out tb))
                {
                    ThumbnailToolbarButton button = tb.Buttons.SingleOrDefault(b => b.Id == button_id);
                    if (button != null)
                    {
                        button.FireClicked();
                    }
                }
            }

            return(CallWindowProcW(reg.OrigWinProc, hWnd, Msg, wParam, lParam));
        }
        public static ThumbnailToolbarButton CreateThumbnailToolbarButton(this Gtk.Action action,
            Func<Gtk.Action, System.Drawing.Icon> icon_callback)
        {
            var button = new ThumbnailToolbarButton (id++) {
                DismissOnClick = false,
                Tooltip = action.Label.Replace ("_", ""),
                Enabled = action.Sensitive,
                Hidden = !action.Visible,
                Icon = icon_callback != null ? icon_callback (action) : null
            };

            button.Clicked += (o, e) => action.Activate ();

            action.AddNotification ("icon-name", (o, args) => button.Icon = icon_callback != null ? icon_callback (action) : null);
            action.AddNotification ("stock-id", (o, args) => button.Icon = icon_callback != null ? icon_callback (action) : null);
            action.AddNotification ("tooltip", (o, args) => button.Tooltip = action.Label.Replace ("_", ""));
            action.AddNotification ("sensitive", (o, args) => button.Enabled = action.Sensitive);
            action.AddNotification ("visible", (o, args) => button.Hidden = !action.Visible);

            return button;
        }
示例#3
0
        THUMBBUTTONFLAGS GetFlags(ThumbnailToolbarButton button)
        {
            THUMBBUTTONFLAGS flags = button.Enabled ? THUMBBUTTONFLAGS.THBF_ENABLED : THUMBBUTTONFLAGS.THBF_DISABLED;

            if (button.Hidden)
            {
                flags |= THUMBBUTTONFLAGS.THBF_HIDDEN;
            }
            if (button.NonInteractive)
            {
                flags |= THUMBBUTTONFLAGS.THBF_NONINTERACTIVE;
            }
            if (button.DismissOnClick)
            {
                flags |= THUMBBUTTONFLAGS.THBF_DISMISSONCLICK;
            }
            if (button.NoBackground)
            {
                flags |= THUMBBUTTONFLAGS.THBF_NOBACKGROUND;
            }

            return(flags);
        }
示例#4
0
        THUMBBUTTONFLAGS GetFlags(ThumbnailToolbarButton button)
        {
            THUMBBUTTONFLAGS flags = button.Enabled ? THUMBBUTTONFLAGS.THBF_ENABLED : THUMBBUTTONFLAGS.THBF_DISABLED;

            if (button.Hidden)
                flags |= THUMBBUTTONFLAGS.THBF_HIDDEN;
            if (button.NonInteractive)
                flags |= THUMBBUTTONFLAGS.THBF_NONINTERACTIVE;
            if (button.DismissOnClick)
                flags |= THUMBBUTTONFLAGS.THBF_DISMISSONCLICK;
            if (button.NoBackground)
                flags |= THUMBBUTTONFLAGS.THBF_NOBACKGROUND;

            return flags;
        }