Пример #1
0
        private void OnAvatarButtonClicked(object o, EventArgs args)
        {
            AvatarButton button = (AvatarButton)o;

            if (AvatarSelected != null)
            {
                Gdk.Pixbuf avatar = AvatarManager.PromoteAvatar(button.Index);
                if (avatar != null)
                {
                    AvatarSelected(avatar);
                }
            }
        }
Пример #2
0
        public AvatarMenuItem() : base(true)
        {
            Gdk.Pixbuf[] avatars = AvatarManager.Avatars;

            uint cols = 4;
            uint rows = 5;

            Table table = new Table(rows, cols, false);

            if (avatars.Length > 0)
            {
                // Create a label and add it to the table
                Label label = new Label("Recent Avatars:");
                label.Xalign = 0.0f;
                Widget label_host = RegisterWidget(label);
                table.Attach(label_host, 0, 6, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
                uint curIndex = 0;

                for (uint row = 1; row < rows; row++)
                {
                    for (uint col = 0; col < cols; col++)
                    {
                        if (curIndex < avatars.Length)
                        {
                            AvatarButton button = new AvatarButton(avatars[curIndex], curIndex);
                            button.Clicked += OnAvatarButtonClicked;
                            Widget button_host = RegisterWidget(button);
                            table.Attach(button_host, col, col + 1, row, row + 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
                        }
                        curIndex++;
                    }
                }
            }
            else
            {
                // Create a label and add it to the table
                Label label = new Label("No Recent Avatars");
                label.Sensitive = false;
                label.Xalign    = 0.0f;
                Widget label_host = RegisterWidget(label);
                table.Attach(label_host, 0, 6, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
            }

            HBox shrinker = new HBox();

            shrinker.PackStart(table, false, false, 0);

            shrinker.ShowAll();
            Add(shrinker);
        }
Пример #3
0
        public AvatarMenuItem()
            : base(true)
        {
            Gdk.Pixbuf[] avatars = AvatarManager.Avatars;

            uint cols = 4;
            uint rows = 5;

            Table table = new Table(rows, cols, false);

            if(avatars.Length > 0) {
                // Create a label and add it to the table
                Label label = new Label("Recent Avatars:");
                label.Xalign = 0.0f;
                Widget label_host = RegisterWidget(label);
                table.Attach(label_host, 0, 6, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
                uint curIndex = 0;

                for(uint row = 1; row < rows; row++) {
                    for(uint col = 0; col < cols; col++) {
                        if( curIndex < avatars.Length ) {
                            AvatarButton button = new AvatarButton(avatars[curIndex], curIndex);
                            button.Clicked += OnAvatarButtonClicked;
                            Widget button_host = RegisterWidget(button);
                            table.Attach(button_host, col, col + 1, row, row + 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
                        }
                        curIndex++;
                    }
                }
            } else {
                // Create a label and add it to the table
                Label label = new Label("No Recent Avatars");
                label.Sensitive = false;
                label.Xalign = 0.0f;
                Widget label_host = RegisterWidget(label);
                table.Attach(label_host, 0, 6, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Shrink, 0, 0);
            }

            HBox shrinker = new HBox();
            shrinker.PackStart(table, false, false, 0);

            shrinker.ShowAll();
            Add(shrinker);
        }