Example #1
0
        public void AddMenu(int pos, object header, string iconPath, RoutedEventHandler handler, string tag = null, bool chk = false)
        {
            var contextMenu = _notify?.ContextMenu;

            if (contextMenu == null)
            {
                return;
            }

            MenuItem item = new()
            {
                Header    = header,
                IsChecked = chk,
                Icon      = new IconView {
                    Path = iconPath
                },
                Tag = tag,
            };

            item.Click += handler;

            if (pos < 0 || pos >= contextMenu.Items.Count)
            {
                contextMenu.Items.Add(item);
            }
            else
            {
                contextMenu.Items.Insert(pos, item);
            }
        }
		public void Run (IBrowsableCollection selection)
		{
			this.selection = selection;

			// Calculate the total size
			long total_size = 0;
			string path;
			System.IO.FileInfo file_info;

			foreach (IBrowsableItem item in selection.Items) {
				path = item.DefaultVersionUri.LocalPath;
				if (System.IO.File.Exists (path)) {
					file_info = new System.IO.FileInfo (path);
					total_size += file_info.Length;
				}
			}

			IconView view = new IconView (selection);
			view.DisplayDates = false;
			view.DisplayTags = false;

			Dialog.Modal = false;
			Dialog.TransientFor = null;
			
			size_label.Text = SizeUtil.ToHumanReadable (total_size);

			thumb_scrolledwindow.Add (view);
			Dialog.ShowAll ();

			//LoadHistory ();

			Dialog.Response += HandleResponse;
		}
Example #3
0
        private void build()
        {
            this.vbox1 = new VBox();

            this.toolbar1              = new Toolbar();
            this.aboutbtn1             = new ToolButton(Stock.About);
            this.aboutbtn1.Label       = "About";
            this.aboutbtn1.IsImportant = true;
            this.toolbar1.ToolbarStyle = ToolbarStyle.BothHoriz;
            this.toolbar1.Add(this.aboutbtn1);
            this.vbox1.PackStart(this.toolbar1, false, true, 0);

            this.treestore1 = this.populateTreeStoreFromSession();
            this.scrollw1   = new ScrolledWindow();
            this.hpaned1    = new HPaned();
            this.treeview1  = new TreeView(this.treestore1);
            this.treeview1.HeadersVisible = true;
            this.treeview1.AppendColumn("Session", new CellRendererText(), "text", 0);
            this.treeview1.AppendColumn("Name", new CellRendererText(), "text", 1);
            this.treeview1.ExpandAll();
            this.scrollw1.Add(this.treeview1);
            this.iconview1 = new IconView();
            this.hpaned1.Add1(this.scrollw1);
            this.hpaned1.Add2(this.iconview1);
            this.hpaned1.Position = 254;
            this.vbox1.PackStart(this.hpaned1, true, true, 0);

            this.statusbar1 = new Statusbar();
            this.vbox1.PackEnd(this.statusbar1, false, true, 0);

            this.Add(this.vbox1);
            this.SetSizeRequest(800, 600);

            this.DeleteEvent += HandleDeleteEvent;
        }
Example #4
0
        protected override void SetUpContentView()
        {
            base.SetUpContentView();

            if (CustomCell.ShowArrowIndicator)
            {
                Accessory        = UITableViewCellAccessory.DisclosureIndicator;
                EditingAccessory = UITableViewCellAccessory.DisclosureIndicator;

                SetRightMarginZero();
            }

            StackV.RemoveArrangedSubview(ContentStack);
            StackV.RemoveArrangedSubview(DescriptionLabel);
            ContentStack.RemoveFromSuperview();
            DescriptionLabel.RemoveFromSuperview();

            _coreView = new CustomCellContent();

            if (CustomCell.UseFullSize)
            {
                StackH.RemoveArrangedSubview(IconView);
                IconView.RemoveFromSuperview();

                StackH.LayoutMargins = new UIEdgeInsets(0, 0, 0, 0);
                StackH.Spacing       = 0;
            }

            StackV.AddArrangedSubview(_coreView);
        }
        void ReleaseDesignerOutlets()
        {
            if (ContactIcon != null)
            {
                ContactIcon.Dispose();
                ContactIcon = null;
            }

            if (ContactLabel != null)
            {
                ContactLabel.Dispose();
                ContactLabel = null;
            }

            if (IconView != null)
            {
                IconView.Dispose();
                IconView = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (ContactVerticalConstraint != null)
            {
                ContactVerticalConstraint.Dispose();
                ContactVerticalConstraint = null;
            }
        }
Example #6
0
        void UpdateIcon(bool forceLoad = false)
        {
            if (_iconTokenSource != null && !_iconTokenSource.IsCancellationRequested)
            {
                //if previous task be alive, cancel.
                _iconTokenSource.Cancel();
            }

            UpdateIconSize();

            if (IconView.Drawable != null)
            {
                IconView.SetImageDrawable(null);
                IconView.SetImageBitmap(null);
            }

            if (CellBase.IconSource != null)
            {
                IconView.Visibility = ViewStates.Visible;
                var cache = ImageCacheController.Instance.Get(CellBase.IconSource.GetHashCode()) as Bitmap;
                if (cache != null && !forceLoad)
                {
                    IconView.SetImageBitmap(cache);
                    Invalidate();
                    return;
                }

                var handler = Xamarin.Forms.Internals.Registrar.Registered.GetHandler <IImageSourceHandler>(CellBase.IconSource.GetType());
                LoadIconImage(handler, CellBase.IconSource);
            }
            else
            {
                IconView.Visibility = ViewStates.Gone;
            }
        }
        private void Icon_IconTapped(object sender, EventArgs e)
        {
            //Can use Bindable context + event but this will do for now..
            //google dynamically-changing-xamarin-forms-tab-icons-when-select/

            //disable previous tab
            IconView prev_obj = this.FindByName <IconView>("Icon" + currentTab.ToString()) as IconView;

            prev_obj.IconLabel_OnDisappearing(0, 0);

            //enable tab and save new setting
            IconView curr_obj = (IconView)sender;

            curr_obj.IconLabel_OnAppearing(1, 100);
            SearchResultLogic.GetData();

            var searchresults = SearchResultLogic.GetSearchResults();

            //Set position
            currentTab = Convert.ToUInt16(curr_obj.IconPosition);

            //Go to new page
            var page = new Page1();

            PlaceHolder.Content = page.Content;
        }
Example #8
0
        void LoadIconImage(IImageSourceHandler handler, ImageSource source)
        {
            _iconTokenSource = new CancellationTokenSource();
            var    token = _iconTokenSource.Token;
            Bitmap image = null;

            var scale = (float)_Context.Resources.DisplayMetrics.Density;

            Task.Run(async() =>
            {
                image = await handler.LoadImageAsync(source, _Context, token);
                token.ThrowIfCancellationRequested();
                image = CreateRoundImage(image);
            }, token).ContinueWith(t =>
            {
                if (t.IsCompleted)
                {
                    //entrust disposal of returned old image to Android OS.
                    ImageCacheController.Instance.Put(CellBase.IconSource.GetHashCode(), image);

                    Device.BeginInvokeOnMainThread(() =>
                    {
                        Task.Delay(50); // in case repeating the same source, sometimes the icon not be shown. by inserting delay it be shown.
                        IconView.SetImageBitmap(image);
                        Invalidate();
                    });
                }
            });
        }
Example #9
0
    private void InitOrUpdateView()
    {
        if (prefab == null)
        {
            prefab = LoadResourceController.GetIconView();
        }

        if (iconViews == null)
        {
            iconViews = new List <IconView>();
        }

        int i = 0;

        for (; i < rewards.Length; i++)
        {
            if (i < iconViews.Count)
            {
                iconViews[i].SetData(rewards[i].GetResource());
                iconViews[i].gameObject.SetActive(true);
            }
            else
            {
                var view = Instantiate(prefab, rewardAnchor);
                view.SetData(rewards[i].GetResource());
                iconViews.Add(view);
            }
        }

        for (; i < iconViews.Count; i++)
        {
            iconViews[i].gameObject.SetActive(false);
        }
    }
        async void setList(string i)
        {
            Label text = new Label();

            text.FontSize       = 16;
            text.TextColor      = Color.Black;
            text.Text           = AppResources.Catalog;
            text.FontAttributes = FontAttributes.Bold;

            #region price
            StackLayout SortByPriceLayout = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.EndAndExpand
            };

            IconView iconViewArrow = new IconView();
            iconViewArrow.Source          = goodsListOrderedByPriceGrowing? "ic_arrow_down": "ic_arrow_up";
            iconViewArrow.Foreground      = colorFromMobileSettings;
            iconViewArrow.HeightRequest   = 15;
            iconViewArrow.WidthRequest    = 15;
            iconViewArrow.VerticalOptions = LayoutOptions.Center;
            SortByPriceLayout.Children.Add(iconViewArrow);


            Label sortByPrice = new Label();
            sortByPrice.Margin          = new Thickness(-5, 0, 0, 0);
            sortByPrice.Text            = SortByPrice;
            sortByPrice.TextColor       = colorFromMobileSettings;
            sortByPrice.FontSize        = 12;
            sortByPrice.VerticalOptions = LayoutOptions.Center;
            SortByPriceLayout.Children.Add(sortByPrice);

            TapGestureRecognizer tgr = new TapGestureRecognizer();
            tgr.Tapped += Tgr_Tapped;
            SortByPriceLayout.GestureRecognizers.Add(tgr);
            #endregion

            StackLayout head = new StackLayout()
            {
                Orientation = StackOrientation.Horizontal, Margin = new Thickness(10, 10, 10, 10), HorizontalOptions = LayoutOptions.FillAndExpand
            };
            head.Children.Add(text);
            head.Children.Add(SortByPriceLayout);

            StackLayout rootStackLayout = new StackLayout();
            rootStackLayout.VerticalOptions = LayoutOptions.FillAndExpand;
            var goods = goodsListOrderedByPriceGrowing?  CategoriesGoods[i].OrderBy(_ => _.Price).ToList() : CategoriesGoods[i].OrderByDescending(_ => _.Price).ToList();

            var stackLayout = GetOrderedGoodsList(goods);

            rootStackLayout.Children.Add(head);
            ScrollView scrollView = new ScrollView();
            scrollView.VerticalScrollBarVisibility = ScrollBarVisibility.Never;
            scrollView.Content         = stackLayout;
            scrollView.VerticalOptions = LayoutOptions.FillAndExpand;
            rootStackLayout.Children.Add(scrollView);

            GoodsLayot.Content = rootStackLayout;
        }
 public static IconViewModel get(IconView view)
 {
     if (iconViewModel == null)
     {
         iconViewModel = new IconViewModel();
     }
     iconView = view;
     return(iconViewModel);
 }
Example #12
0
        /// <summary>
        /// Selects the color of the calendar and change button.
        /// </summary>
        private async Task SelectColor(IconView colorSelected)
        {
            colorSelected.Source = (colorSelected.Source == "ic_circle_color") ? "ic_circle_check_color" : "ic_circle_color";
            var connection = await this.apiService.CheckConnection();

            if (!connection.IsSuccess)
            {
                this.IsRunning = false;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    connection.Message,
                    Languages.Cancel);

                IsOpen = false;
                return;
            }

            //Change Foreground color to Number, before call EndPoint
            int numColor = ((Convert.ToInt32(colorSelected.Foreground.R * 255) * 256 * 256) +
                            (Convert.ToInt32(colorSelected.Foreground.G * 255) * 256) +
                            Convert.ToInt32(colorSelected.Foreground.B * 255));

            var response = await this.apiService.Put <bool>(
                Settings.UrlBaseApiSigob,
                App.PrefixApiSigob,
                string.Format(apiPostChangeColorController, numColor),
                Settings.Token,
                Settings.DbToken
                );

            if (!response.IsSuccess)
            {
                this.IsRunning = false;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    response.Message,
                    Languages.Cancel);

                IsOpen = false;
                return;
            }
            bool resultSetColor = (bool)response.Result;

            if (!resultSetColor)
            {
                this.IsRunning = false;
                await Application.Current.MainPage.DisplayAlert(
                    Languages.Error,
                    Languages.GeneralError,
                    Languages.Cancel);

                return;
            }
            MyCalendarColor      = colorSelected.Foreground;
            colorSelected.Source = "ic_circle_color";
            IsOpen = false;
        }
Example #13
0
 public TestWindow()
 {
     InitializeComponent();
     foreach (Icon icon in Enum.GetValues(typeof(Icon)))
     {
         var iconCtrl = new IconView();
         iconCtrl.Icon = icon;
         sp.Children.Add(iconCtrl);
     }
 }
Example #14
0
        /// <summary>
        /// Dispose the specified disposing.
        /// </summary>
        /// <returns>The dispose.</returns>
        /// <param name="disposing">If set to <c>true</c> disposing.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                CellBase.PropertyChanged   -= CellPropertyChanged;
                CellParent.PropertyChanged -= ParentPropertyChanged;

                if (CellBase.Section != null)
                {
                    CellBase.Section.PropertyChanged -= SectionPropertyChanged;
                    CellBase.Section = null;
                }


                SelectedBackgroundView?.Dispose();
                SelectedBackgroundView = null;

                Device.BeginInvokeOnMainThread(() =>
                {
                    HintLabel.RemoveFromSuperview();
                    HintLabel.Dispose();
                    HintLabel = null;
                    TitleLabel?.Dispose();
                    TitleLabel = null;
                    DescriptionLabel?.Dispose();
                    DescriptionLabel = null;
                    IconView.RemoveFromSuperview();
                    IconView.Image?.Dispose();
                    IconView.Dispose();
                    IconView = null;
                    _iconTokenSource?.Dispose();
                    _iconTokenSource = null;
                    _iconConstraintWidth?.Dispose();
                    _iconConstraintHeight?.Dispose();
                    _iconConstraintHeight = null;
                    _iconConstraintWidth  = null;
                    ContentStack?.RemoveFromSuperview();
                    ContentStack?.Dispose();
                    ContentStack = null;
                    Cell         = null;

                    StackV?.RemoveFromSuperview();
                    StackV?.Dispose();
                    StackV = null;

                    StackH.RemoveFromSuperview();
                    StackH.Dispose();
                    StackH = null;
                }
                                               );
            }

            base.Dispose(disposing);
        }
Example #15
0
    public override void Awake()
    {
        base.Awake();

        adsConfig = LoadResourceController.GetAdsConfigCollection();
        playerAds = DataPlayer.GetModule <PlayerAds>();
        prefab    = LoadResourceController.GetIconView();

        InitButtons();
        CheckWinLose();
    }
        public DemoIconView() : base("Gtk.IconView demo")
        {
            SetDefaultSize(650, 400);
            DeleteEvent += new DeleteEventHandler(OnWinDelete);

            VBox vbox = new VBox(false, 0);

            Add(vbox);

            Toolbar toolbar = new Toolbar();

            vbox.PackStart(toolbar, false, false, 0);

            upButton             = new ToolButton(Stock.GoUp);
            upButton.IsImportant = true;
            upButton.Sensitive   = false;
            toolbar.Insert(upButton, -1);

            ToolButton homeButton = new ToolButton(Stock.Home);

            homeButton.IsImportant = true;
            toolbar.Insert(homeButton, -1);

            fileIcon = GetIcon(Stock.File);
            dirIcon  = GetIcon(Stock.Open);

            ScrolledWindow sw = new ScrolledWindow();

            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            vbox.PackStart(sw, true, true, 0);

            // Create the store and fill it with the contents of '/'
            store = CreateStore();
            FillStore();

            IconView iconView = new IconView(store);

            iconView.SelectionMode = SelectionMode.Multiple;

            upButton.Clicked   += new EventHandler(OnUpClicked);
            homeButton.Clicked += new EventHandler(OnHomeClicked);

            iconView.TextColumn   = COL_DISPLAY_NAME;
            iconView.PixbufColumn = COL_PIXBUF;

            iconView.ItemActivated += new ItemActivatedHandler(OnItemActivated);
            sw.Add(iconView);
            iconView.GrabFocus();

            ShowAll();
        }
Example #17
0
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection       = selection;
            this.current_service = FlickrRemote.Service.FromSupported(service);

            IconView view = new IconView(selection);

            view.DisplayTags  = display_tags;
            view.DisplayDates = false;

            xml = new Glade.XML(null, "FlickrExport.glade", dialog_name, "f-spot");
            xml.Autoconnect(this);

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            HandleSizeActive(null, null);

            public_radio.Toggled    += HandlePublicChanged;
            tag_check.Toggled       += HandleTagChanged;
            hierarchy_check.Toggled += HandleHierarchyChanged;
            HandleTagChanged(null, null);
            HandleHierarchyChanged(null, null);

            Dialog.ShowAll();
            Dialog.Response       += HandleResponse;
            auth_flickr.Clicked   += HandleClicked;
            auth_text              = string.Format(auth_label.Text, current_service.Name);
            auth_label.Text        = auth_text;
            used_bandwidth.Visible = false;

            LoadPreference(SCALE_KEY);
            LoadPreference(SIZE_KEY);
            LoadPreference(BROWSER_KEY);
            LoadPreference(TAGS_KEY);
            LoadPreference(TAG_HIERARCHY_KEY);
            LoadPreference(IGNORE_TOP_LEVEL_KEY);
            LoadPreference(STRIP_META_KEY);
            LoadPreference(PUBLIC_KEY);
            LoadPreference(FAMILY_KEY);
            LoadPreference(FRIENDS_KEY);
            LoadPreference(current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote(token, current_service);
            if (token != null && token.Length > 0)
            {
                StartAuth();
            }
        }
        protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            base.OnElementPropertyChanged(sender, e);
            IconView iconView = sender as IconView;

            if (e.PropertyName == nameof(IconView.Source))
            {
                UpdateBitmapColor(iconView.ForegroundColor);
            }
            else if (e.PropertyName == nameof(IconView.ForegroundColor))
            {
                UpdateBitmapColor(iconView.ForegroundColor);
            }
        }
Example #19
0
        public MenuDTViewModel()
        {
            IconView iconMenu = new IconView
            {
                //WidthRequest = 25,
                HeightRequest     = 26,
                HorizontalOptions = LayoutOptions.Center,
                Foreground        = Color.FromHex("19164B")
            };

            iconMenu.SetBinding(IconView.SourceProperty, BaseViewModel.IconPropertyName);

            Label tituloMenu = new Label
            {
                TextColor             = Color.FromHex("19164B"),
                FontSize              = 16,
                VerticalTextAlignment = TextAlignment.Center,
                FontFamily            = Device.OnPlatform("OpenSans-Bold", "OpenSans-Bold", null)
            };

            tituloMenu.SetBinding(Label.TextProperty, BaseViewModel.TitlePropertyName);

            Grid Menu = new Grid
            {
                Padding           = new Thickness(5, 10),
                ColumnSpacing     = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Center,
                RowDefinitions    =
                {
                    new RowDefinition {
                        Height = new GridLength(0, GridUnitType.Auto)
                    }
                },
                ColumnDefinitions =
                {
                    new ColumnDefinition {
                        Width = new GridLength(60, GridUnitType.Absolute)
                    },
                    new ColumnDefinition {
                        Width = new GridLength(1, GridUnitType.Star)
                    }
                }
            };

            Menu.Children.Add(iconMenu, 0, 0);
            Menu.Children.Add(tituloMenu, 1, 0);
            View = Menu;
            SelectedBackgroundColor = Color.Transparent;
        }
Example #20
0
        public SelectAvatarDialog(Window parent) : base()
        {
            XML glade = new XML(null, "FileFind.Meshwork.GtkClient.meshwork.glade",
                                "SelectAvatarDialog", null);

            this.Remove(this.Child);

            glade.Autoconnect(this);

            Window window = (Window)glade ["SelectAvatarDialog"];

            this.Title = window.Title;
            Widget child = window.Child;

            child.Reparent(this);
            window.Destroy();
            child.Show();

            store = new ListStore(typeof(Gdk.Pixbuf),
                                  typeof(string));

            avatarIconView = new IconView(store);
            avatarIconView.PixbufColumn      = 0;
            avatarIconView.ItemActivated    += avatarIconView_ItemActivated;
            avatarIconView.SelectionChanged += avatarIconView_SelectionChanged;
            avatarIconView.DragDataReceived += avatarIconView_DragDataReceived;
            avatarIconView.ButtonPressEvent += avatarIconView_ButtonPressEvent;

            Gtk.Drag.DestSet(avatarIconView, DestDefaults.All,
                             new TargetEntry [] {
                new TargetEntry("STRING",
                                0, (uint)0)
            },
                             Gdk.DragAction.Copy);

            iconViewScrolledWindow.Add(avatarIconView);

            avatarIconView.Show();


            Resize(570, 400);

            GLib.Timeout.Add(50, new GLib.TimeoutHandler(PulseProgressBar));

            // Load images
            gravatarThread = new Thread(new ThreadStart(LoadImages));
            gravatarThread.Start();
        }
Example #21
0
        static void Main(String[] args)
        {
            if (Clutter.GTK.Application.Init() != InitError.Success)
            {
                return;
            }

            var window = new Clutter.GTK.Window();

            window.Destroyed += (sender, e) => Gtk.Application.Quit();
            window.SetDefaultSize(400, 300);

            var store = new ListStore(typeof(string), typeof(Pixbuf));

            AddListstoreRows(store, "devhelp", "empathy", "evince", "seahorse", "totem");

            var iconview = new IconView(store);

            iconview.TextColumn   = 0;
            iconview.PixbufColumn = 1;

            var sw = new ScrolledWindow();

            window.Add(sw);
            sw.Add(iconview);
            sw.ShowAll();

            var stage = window.Stage;

            var toolbar = new Toolbar();

            AddToolbarItems(toolbar, Stock.Add, Stock.Bold, Stock.Italic, Stock.Cancel, Stock.Cdrom, Stock.Convert);

            toolbar.ShowAll();
            var actor = new Clutter.GTK.Actor(toolbar);

            actor.AddConstraint(new BindConstraint(stage, BindCoordinate.Width, 0f));
            actor.Entered    += OnEntered;
            actor.LeaveEvent += OnLeft;

            actor.Y        = actor.Height * -0.5f;
            actor.Opacity  = 128;
            actor.Reactive = true;
            stage.AddChild(actor);

            window.ShowAll();
            Gtk.Application.Run();
        }
        public PreviewPopup(IconView view) : base(Gtk.WindowType.Toplevel)
        {
            Gtk.VBox vbox = new Gtk.VBox();
            this.Add(vbox);
            this.AddEvents((int)(Gdk.EventMask.PointerMotionMask |
                                 Gdk.EventMask.KeyReleaseMask |
                                 Gdk.EventMask.ButtonPressMask));

            this.Decorated       = false;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint   = true;
            this.SetPosition(Gtk.WindowPosition.None);

            this.KeyReleaseEvent  += HandleKeyRelease;
            this.ButtonPressEvent += HandleButtonPress;
            this.Destroyed        += HandleDestroyed;

            this.view = view;
            view.MotionNotifyEvent += HandleIconViewMotion;
            view.KeyPressEvent     += HandleIconViewKeyPress;
            view.KeyReleaseEvent   += HandleKeyRelease;
            view.DestroyEvent      += HandleIconViewDestroy;

            this.BorderWidth = 6;

            hist           = new FSpot.Histogram();
            hist.Color [0] = 127;
            hist.Color [1] = 127;
            hist.Color [2] = 127;
            hist.Color [3] = 0xff;

            image          = new Gtk.Image();
            image.CanFocus = false;


            label          = new Gtk.Label(String.Empty);
            label.CanFocus = false;
            label.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            label.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            this.ModifyFg(Gtk.StateType.Normal, new Gdk.Color(127, 127, 127));
            this.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(0, 0, 0));

            vbox.PackStart(image, true, true, 0);
            vbox.PackStart(label, true, false, 0);
            vbox.ShowAll();
        }
Example #23
0
        public UserNotify(IIconService iconService)
        {
            _notify = new TaskbarIcon()
            {
                Visibility  = Visibility.Visible,
                ContextMenu = new ContextMenu(),
            };

            var rvc = IconView.GetIconService(_notify);

            IconView.SetIconService(_notify, iconService);

            SetOff();

            _notify.TrayLeftMouseUp  += _notify_TrayLeftMouseUp;;
            _notify.TrayRightMouseUp += _notify_TrayRightMouseUp;
        }
        public MainPage()
        {
            InitializeComponent();

            //Enable Tab1
            var page = new Page1();

            PlaceHolder.Content = page.Content;
            currentTab          = 1;

            //Ensure Tab 2 to 4 is disabled
            for (int count = 2; count <= 4; count++)
            {
                IconView obj = (IconView)this.FindByName <IconView>("Icon" + count.ToString());
                obj.IconLabel_OnDisappearing(0, 0);
            }
        }
Example #25
0
        /// <summary>
        /// Dispose the specified disposing.
        /// </summary>
        /// <returns>The dispose.</returns>
        /// <param name="disposing">If set to <c>true</c> disposing.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                CellBase.PropertyChanged   -= CellPropertyChanged;
                CellParent.PropertyChanged -= ParentPropertyChanged;

                if (CellBase.Section != null)
                {
                    CellBase.Section.PropertyChanged -= SectionPropertyChanged;
                    CellBase.Section = null;
                }

                HintLabel?.Dispose();
                HintLabel = null;
                TitleLabel?.Dispose();
                TitleLabel = null;
                DescriptionLabel?.Dispose();
                DescriptionLabel = null;
                IconView?.SetImageDrawable(null);
                IconView?.SetImageBitmap(null);
                IconView?.Dispose();
                IconView = null;
                ContentStack?.Dispose();
                ContentStack = null;
                AccessoryStack?.Dispose();
                AccessoryStack = null;
                Cell           = null;

                _iconTokenSource?.Dispose();
                _iconTokenSource = null;
                _Context         = null;

                _backgroundColor?.Dispose();
                _backgroundColor = null;
                _selectedColor?.Dispose();
                _selectedColor = null;
                _ripple?.Dispose();
                _ripple = null;

                Background?.Dispose();
                Background = null;
            }
            base.Dispose(disposing);
        }
        public void Run(IBrowsableCollection selection)
        {
            xml = new Glade.XML(null, "PicasaWebExport.glade", dialog_name, "f-spot");
            xml.Autoconnect(this);

            this.items             = selection.Items;
            album_button.Sensitive = false;
            IconView view = new IconView(selection);

            view.DisplayDates = false;
            view.DisplayTags  = false;

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            view.Show();
            Dialog.Show();


            GoogleAccountManager manager = GoogleAccountManager.GetInstance();

            manager.AccountListChanged += PopulateGoogleOptionMenu;
            PopulateGoogleOptionMenu(manager, null);
            album_optionmenu.Changed += HandleAlbumOptionMenuChanged;

            if (edit_button != null)
            {
                edit_button.Clicked += HandleEditGallery;
            }

            Dialog.Response += HandleResponse;
            connect          = true;
            HandleSizeActive(null, null);
            Connect();

            scale_check.Toggled += HandleScaleCheckToggled;

            LoadPreference(SCALE_KEY);
            LoadPreference(SIZE_KEY);
            LoadPreference(ROTATE_KEY);
            LoadPreference(BROWSER_KEY);
//			LoadPreference (Preferences.EXPORT_PICASAWEB_META);
            LoadPreference(TAG_KEY);
        }
Example #27
0
        private void UpdateIconSize()
        {
            Size size;

            if (CellBase.IconSize != default(Size))
            {
                size = CellBase.IconSize;
            }
            else if (CellParent != null &&
                     CellParent.CellIconSize != default(Size))
            {
                size = CellParent.CellIconSize;
            }
            else
            {
                size = new Size(32, 32);
            }

            //do nothing when current size is previous size
            if (size == _iconSize)
            {
                return;
            }

            if (_iconSize != default(Size))
            {
                //remove previous constraint
                _iconConstraintHeight.Active = false;
                _iconConstraintWidth.Active  = false;
                _iconConstraintHeight?.Dispose();
                _iconConstraintWidth?.Dispose();
            }

            _iconConstraintHeight = IconView.HeightAnchor.ConstraintEqualTo((nfloat)size.Height);
            _iconConstraintWidth  = IconView.WidthAnchor.ConstraintEqualTo((nfloat)size.Width);

            _iconConstraintHeight.Priority = 999f;             // fix warning-log:Unable to simultaneously satisfy constraints.
            _iconConstraintHeight.Active   = true;
            _iconConstraintWidth.Active    = true;

            IconView.UpdateConstraints();

            _iconSize = size;
        }
            public GamesListWidget()
                : base()
            {
                HBox hbox = new HBox ();
                hbox.PackStart (new
                        Label (Catalog.
                               GetString
                               ("Filter")), false,
                        false, 4);

                view = CreateIconView ();
                win = new ScrolledWindow ();
                win.HscrollbarPolicy = PolicyType.Automatic;
                win.VscrollbarPolicy = PolicyType.Automatic;
                win.Add (view);
                PackStart (win, true, true, 4);

                ShowAll ();
            }
        public void Run(IBrowsableCollection selection)
        {
            Glade.XML xml = new Glade.XML(null, "GalleryExport.glade", "gallery_export_dialog", "f-spot");
            xml.Autoconnect(this);
            export_dialog = (Gtk.Dialog)xml.GetWidget("gallery_export_dialog");

            this.items = selection.Items;
            Array.Sort <IBrowsableItem> (this.items as Photo[], new Photo.CompareDateName());
            album_button.Sensitive = false;
            IconView view = new IconView(selection);

            view.DisplayDates = false;
            view.DisplayTags  = false;

            export_dialog.Modal        = false;
            export_dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            view.Show();
            export_dialog.Show();

            GalleryAccountManager manager = GalleryAccountManager.GetInstance();

            manager.AccountListChanged += PopulateGalleryOptionMenu;
            PopulateGalleryOptionMenu(manager, null);

            if (edit_button != null)
            {
                edit_button.Clicked += HandleEditGallery;
            }

            export_dialog.Response += HandleResponse;
            connect = true;
            HandleSizeActive(null, null);
            Connect();

            LoadPreference(SCALE_KEY);
            LoadPreference(SIZE_KEY);
            LoadPreference(BROWSER_KEY);
            LoadPreference(META_KEY);
            LoadPreference(ROTATE_KEY);
        }
Example #30
0
        public void Run(IBrowsableCollection selection)
        {
            xml = new Glade.XML(null, "CDExport.glade", dialog_name, "f-spot");
            xml.Autoconnect(this);

            this.selection = selection;

            // Calculate the total size
            long   total_size = 0;
            string path;

            System.IO.FileInfo file_info;

            foreach (IBrowsableItem item in selection.Items)
            {
                path = item.DefaultVersionUri.LocalPath;
                if (System.IO.File.Exists(path))
                {
                    file_info   = new System.IO.FileInfo(path);
                    total_size += file_info.Length;
                }
            }

            IconView view = new IconView(selection);

            view.DisplayDates = false;
            view.DisplayTags  = false;

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            size_label.Text = SizeUtil.ToHumanReadable(total_size);

            thumb_scrolledwindow.Add(view);
            Dialog.ShowAll();

            previous_frame.Visible = IsEmpty(dest);
            //LoadHistory ();

            Dialog.Response += HandleResponse;
        }
        public void Run(SupportedService service, IBrowsableCollection selection, bool display_tags)
        {
            this.selection       = selection;
            this.current_service = FlickrRemote.Service.FromSupported(service);

            IconView view = new IconView(selection);

            view.DisplayTags  = display_tags;
            view.DisplayDates = false;

            Dialog.Modal        = false;
            Dialog.TransientFor = null;

            thumb_scrolledwindow.Add(view);
            HandleSizeActive(null, null);

            public_radio.Toggled += HandlePublicChanged;

            Dialog.ShowAll();
            Dialog.Response     += HandleResponse;
            auth_flickr.Clicked += HandleClicked;
            auth_text            = string.Format(auth_label.Text, current_service.Name);
            auth_label.Text      = auth_text;

            LoadPreference(Preferences.EXPORT_FLICKR_SCALE);
            LoadPreference(Preferences.EXPORT_FLICKR_SIZE);
            LoadPreference(Preferences.EXPORT_FLICKR_BROWSER);
            LoadPreference(Preferences.EXPORT_FLICKR_TAGS);
            LoadPreference(Preferences.EXPORT_FLICKR_STRIP_META);
            LoadPreference(Preferences.EXPORT_FLICKR_PUBLIC);
            LoadPreference(Preferences.EXPORT_FLICKR_FAMILY);
            LoadPreference(Preferences.EXPORT_FLICKR_FRIENDS);
            LoadPreference(current_service.PreferencePath);

            do_export_flickr.Sensitive = false;
            fr = new FlickrRemote(token, current_service);
            if (token != null && token.Length > 0)
            {
                StartAuth();
            }
        }
Example #32
0
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     if (e.PropertyName == nameof(IconView.ThemeName))
     {
         if (sender is IconView iconView && Control != null)
         {
             SetOverrideUserInterfaceStyle(iconView.ThemeName);
         }
     }
     if (e.PropertyName == nameof(IconView.Source))
     {
         IconView iconView = sender as IconView;
         SetImageColor(iconView.ForegroundColor);
     }
     if (e.PropertyName == nameof(IconView.ForegroundColor))
     {
         IconView iconView = sender as IconView;
         SetImageColor(iconView.ForegroundColor);
     }
 }
		public void Run (SupportedService service, IBrowsableCollection selection, bool display_tags)
		{
			this.selection = selection;
			this.current_service = FlickrRemote.Service.FromSupported (service);

			IconView view = new IconView (selection);
			view.DisplayTags = display_tags;
			view.DisplayDates = false;

			Dialog.Modal = false;
			Dialog.TransientFor = null;

			thumb_scrolledwindow.Add (view);
			HandleSizeActive (null, null);
			
			public_radio.Toggled += HandlePublicChanged;

			Dialog.ShowAll ();
			Dialog.Response += HandleResponse;
			auth_flickr.Clicked += HandleClicked;
			auth_text = string.Format (auth_label.Text, current_service.Name);
			auth_label.Text = auth_text;

			LoadPreference (Preferences.EXPORT_FLICKR_SCALE);
			LoadPreference (Preferences.EXPORT_FLICKR_SIZE);
			LoadPreference (Preferences.EXPORT_FLICKR_BROWSER);
			LoadPreference (Preferences.EXPORT_FLICKR_TAGS);
			LoadPreference (Preferences.EXPORT_FLICKR_STRIP_META);
			LoadPreference (Preferences.EXPORT_FLICKR_PUBLIC);
			LoadPreference (Preferences.EXPORT_FLICKR_FAMILY);
			LoadPreference (Preferences.EXPORT_FLICKR_FRIENDS);
			LoadPreference (current_service.PreferencePath);

			do_export_flickr.Sensitive = false;
			fr = new FlickrRemote (token, current_service);
			if (token != null && token.Length > 0) {
				StartAuth ();
			}
		}
            private IconView CreateIconView()
            {
                gamesStore =
                    new ListStore (typeof (object),
                               typeof (string));
                IconView view = new IconView (gamesStore);
                view.MarkupColumn = 1;
                view.ItemActivated += OnItemActivated;

                view.Clear ();
                CellRendererText renderer =
                    new CellRendererText ();
                renderer.Xalign = 0;
                view.PackStart (renderer, false);
                view.SetAttributes (renderer, "markup", 1);
                return view;
            }
		public void Run (IBrowsableCollection selection)
		{
			this.items = selection.Items;
			album_button.Sensitive = false;
			IconView view = new IconView (selection);
			view.DisplayDates = false;
			view.DisplayTags = false;

			Dialog.Modal = false;
			Dialog.TransientFor = null;

			thumb_scrolledwindow.Add (view);
			view.Show ();
			Dialog.Show ();


			GalleryAccountManager manager = GalleryAccountManager.GetInstance ();
			manager.AccountListChanged += PopulateGalleryOptionMenu;
			PopulateGalleryOptionMenu (manager, null);

			if (edit_button != null)
				edit_button.Clicked += HandleEditGallery;
			
			Dialog.Response += HandleResponse;
			connect = true;
			HandleSizeActive (null, null);
			Connect ();

			LoadPreference (Preferences.EXPORT_GALLERY_SCALE);
			LoadPreference (Preferences.EXPORT_GALLERY_SIZE);
			LoadPreference (Preferences.EXPORT_GALLERY_BROWSER);
			LoadPreference (Preferences.EXPORT_GALLERY_META);
			LoadPreference (Preferences.EXPORT_GALLERY_ROTATE);
		}
Example #36
0
        private void CreateNodeViewContent()
        {
            if (node.Link != null)
            {
                this.link = new Link(node.Link, node.GetLinkType());
                width += (link.Size.Width + INTER_CONTROL_PADDING);
            }

            if (node.HasNoteText)
            {
                this.noteIcon = new NoteIcon();
                width += (noteIcon.Size.Width + INTER_CONTROL_PADDING);
            }

            for (int i = 0; i < MetaModel.MetaModel.Instance.SystemIconList.Count; i++)
            {
                var systemIcon = MetaModel.MetaModel.Instance.SystemIconList[i];
                if(systemIcon.ShowIcon(node))
                {
                    recIcons.Add(new IconView(systemIcon));
                }
            }

            for (int i = 0; i < node.Icons.Count; i++)
            {
                IconView icon = new IconView(node.Icons[i]);
                this.recIcons.Add(icon);
                width += (icon.Size.Width + INTER_CONTROL_PADDING);
            }

            RefreshFont();
        }
	public int ImportFromFile (PhotoStore store, string path)
	{
		this.store = store;
		this.CreateDialog ("import_dialog");
		
		this.Dialog.TransientFor = main_window;
		this.Dialog.WindowPosition = Gtk.WindowPosition.CenterOnParent;
		this.Dialog.Response += HandleDialogResponse;

	        AllowFinish = false;
		
		this.Dialog.DefaultResponse = ResponseType.Ok;
		
		//import_folder_entry.Activated += HandleEntryActivate;
		recurse_check.Toggled += HandleRecurseToggled;
		copy_check.Toggled += HandleRecurseToggled;

		menu = new SourceMenu (this);
		source_option_menu.Menu = menu;

		collection = new FSpot.PhotoList (new Photo [0]);
		tray = new FSpot.ScalingIconView (collection);
		tray.Selection.Changed += HandleTraySelectionChanged;
		icon_scrolled.SetSizeRequest (200, 200);
		icon_scrolled.Add (tray);
		//icon_scrolled.Visible = false;
		tray.DisplayTags = false;
		tray.Show ();

		photo_view = new FSpot.PhotoImageView (collection);
		photo_scrolled.Add (photo_view);
		photo_scrolled.SetSizeRequest (200, 200);
		photo_view.Show ();

		//FSpot.Global.ModifyColors (frame_eventbox);
		FSpot.Global.ModifyColors (photo_scrolled);
		FSpot.Global.ModifyColors (photo_view);

		photo_view.Pixbuf = PixbufUtils.LoadFromAssembly ("f-spot-48.png");
		photo_view.Fit = true;
			
		tag_entry = new FSpot.Widgets.TagEntry (MainWindow.Toplevel.Database.Tags, false);
		tag_entry.UpdateFromTagNames (new string []{});
		tagentry_box.Add (tag_entry);

		tag_entry.Show ();

		this.Dialog.Show ();
		//source_option_menu.Changed += HandleSourceChanged;
		if (path != null) {
			SetImportPath (path);
			int i = menu.FindItemPosition (path);

			if (i > 0) {
				source_option_menu.SetHistory ((uint)i);
			} else if (Directory.Exists (path)) {
				SourceItem path_item = new SourceItem (new VfsSource (path));
				menu.Prepend (path_item);
				path_item.ShowAll ();
				SetImportPath (path);
				source_option_menu.SetHistory (0);
			} 
			idle_start.Start ();
		}
						
		ResponseType response = (ResponseType) this.Dialog.Run ();
		
		while (response == ResponseType.Ok) {
			try {
				if (Directory.Exists (this.ImportPath))
					break;
			} catch (System.Exception e){
				System.Console.WriteLine (e);
				break;
			}

			HigMessageDialog md = new HigMessageDialog (this.Dialog,
			        DialogFlags.DestroyWithParent,
				MessageType.Error,
				ButtonsType.Ok,
				Catalog.GetString ("Directory does not exist."),
				String.Format (Catalog.GetString ("The directory you selected \"{0}\" does not exist.  " + 
								  "Please choose a different directory"), this.ImportPath));

			md.Run ();
			md.Destroy ();

			response = (Gtk.ResponseType) this.Dialog.Run ();
		}

		if (response == ResponseType.Ok) {
			this.UpdateTagStore (tag_entry.GetTypedTagNames ());
			this.Finish ();

			if (tags_selected != null && tags_selected.Count > 0) {
				for (int i = 0; i < collection.Count; i++) {
					Photo p = collection [i] as Photo;
					
					if (p == null)
						continue;
					
					p.AddTag ((Tag [])tags_selected.ToArray(typeof(Tag)));
					store.Commit (p);
				}
			}

			this.Dialog.Destroy ();
			return collection.Count;
		} else {
			this.Cancel ();
			//this.Dialog.Destroy();
			return 0;
		}
	}
		public bool Execute (Tag t)
		{
			this.CreateDialog ("edit_icon_dialog");

			this.Dialog.Title = String.Format (Catalog.GetString ("Edit Icon for Tag {0}"), t.Name);

			preview_image.Pixbuf = t.Icon;

			query = new FSpot.PhotoQuery (db.Photos);
			
			if (db.Tags.Hidden != null)
				query.Terms = FSpot.Query.OrTerm.FromTags (new Tag []{ t, db.Tags.Hidden });
			else 
				query.Terms = new FSpot.Query.Literal (t);

			image_view = new FSpot.PhotoImageView (query);
			image_view.SelectionXyRatio = 1.0;
			image_view.SelectionChanged += HandleSelectionChanged;
			image_view.PhotoChanged += HandlePhotoChanged;

			photo_scrolled_window.Add (image_view);

			if (query.Photos.Length > 0) {
				photo_spin_button.Wrap = true;
				photo_spin_button.Adjustment.Lower = 1.0;
				photo_spin_button.Adjustment.Upper = (double)query.Photos.Length;
				photo_spin_button.Adjustment.StepIncrement = 1.0;
				photo_spin_button.ValueChanged += HandleSpinButtonChanged;
				
				image_view.Item.Index = 0;
			} else {
				photo_spin_button.Sensitive = false;
				photo_spin_button.Value = 0.0;
			}			
			
			
			// FIXME this path choosing method is completely wrong/broken/evil it needs to be
			// based on real data but I want to get this release out.
			string theme_dir = System.IO.Path.Combine (FSpot.Defines.GNOME_ICON_THEME_PREFIX,
								   "share/icons/gnome/48x48/emblems");
			if (System.IO.Directory.Exists (theme_dir))
				icon_view = new IconView (new FSpot.DirectoryCollection (theme_dir));
			else if (System.IO.Directory.Exists ("/opt/gnome/share/icons/gnome/48x48/emblems"))
				icon_view = new IconView (new FSpot.DirectoryCollection ("/opt/gnome/share/icons/gnome/48x48/emblems"));
			else if (System.IO.Directory.Exists ("/usr/share/icons/gnome/48x48/emblems"))
				icon_view = new IconView (new FSpot.DirectoryCollection ("/usr/share/icons/gnome/48x48/emblems"));
			else // This will just load an empty collection if the directory doesn't exist.
				icon_view = new IconView (new FSpot.DirectoryCollection ("/usr/local/share/icons/gnome/48x48/emblems"));

			icon_scrolled_window.Add (icon_view);
			icon_view.ThumbnailWidth = 32;
			icon_view.DisplayTags = false;
			icon_view.DisplayDates = false;
			icon_view.Selection.Changed += HandleIconViewSelectionChanged;
			icon_view.Show();

			image_view.Show ();

			ResponseType response = (ResponseType) this.Dialog.Run ();
			bool success = false;

			if (response == ResponseType.Ok) {
				try {
					t.Icon = preview_image.Pixbuf;
					//db.Tags.Commit (t);
					success = true;
				} catch (Exception ex) {
					// FIXME error dialog.
					Console.WriteLine ("error {0}", ex);
				}
			}
			
			this.Dialog.Destroy ();
			return success;
		}
	//
	// IconView event handlers
	// 

	void HandleDoubleClicked (IconView icon_view, int clicked_item)
	{
		icon_view.FocusCell = clicked_item;
		SetViewMode (ModeType.PhotoView);
	}
	void HandleViewDirectory (object sender, EventArgs args)
	{
		Gtk.Window win = new Gtk.Window ("Directory View");
		IconView view = new IconView (new FSpot.DirectoryCollection (System.IO.Directory.GetCurrentDirectory ()));
		new FSpot.PreviewPopup (view);

		view.DisplayTags = false;

		Gtk.ScrolledWindow scrolled = new ScrolledWindow ();
		win.Add (scrolled);
		scrolled.Add (view);
		win.ShowAll ();
	}