示例#1
0
        protected override void OnSetScrollAdjustments(Gtk.Adjustment hadjustment, Gtk.Adjustment vadjustment)
        {
            if (hadjustment == null)
            {
                hadjustment = new Gtk.Adjustment(0, 0, 0, 0, 0, 0);
            }
            if (vadjustment == null)
            {
                vadjustment = new Gtk.Adjustment(0, 0, 0, 0, 0, 0);
            }

            bool need_change = false;

            if (Hadjustment != hadjustment)
            {
                Hadjustment               = hadjustment;
                Hadjustment.Upper         = scaled_width;
                Hadjustment.ValueChanged += HandleAdjustmentsValueChanged;
                need_change               = true;
            }
            if (Vadjustment != vadjustment)
            {
                Vadjustment               = vadjustment;
                Vadjustment.Upper         = scaled_height;
                Vadjustment.ValueChanged += HandleAdjustmentsValueChanged;
                need_change               = true;
            }

            if (need_change)
            {
                HandleAdjustmentsValueChanged(this, EventArgs.Empty);
            }
        }
示例#2
0
 public BigList(IListModel provider)
 {
     this.provider = provider;
       RefAccessible ().Role = Atk.Role.List;
       hAdjustment = new Gtk.Adjustment (0, 0, currentWidth, 1, 1, 1);
       hAdjustment.ValueChanged += new EventHandler (HAdjustmentValueChangedHandler);
       vAdjustment = new Gtk.Adjustment (0, 0, provider.Rows, 1, 1, 1);
       vAdjustment.ValueChanged += new EventHandler (VAdjustmentValueChangedHandler);
       layout = new Pango.Layout (PangoContext);
       ExposeEvent += new ExposeEventHandler (ExposeHandler);
       ButtonPressEvent += new ButtonPressEventHandler (ButtonPressEventHandler);
       ButtonReleaseEvent += new ButtonReleaseEventHandler (ButtonReleaseEventHandler);
       KeyPressEvent += new KeyPressEventHandler (KeyHandler);
       Realized += new EventHandler (RealizeHandler);
       Unrealized += new EventHandler (UnrealizeHandler);
       ScrollEvent += new ScrollEventHandler (ScrollHandler);
         SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);
       MotionNotifyEvent += new MotionNotifyEventHandler (MotionNotifyEventHandler);
       AddEvents ((int) EventMask.ButtonPressMask | (int) EventMask.ButtonReleaseMask | (int) EventMask.KeyPressMask | (int) EventMask.PointerMotionMask);
       CanFocus = true;
       style_widget = new EventBox ();
       style_widget.StyleSet += new StyleSetHandler (StyleHandler);
       layout.SetMarkup (ellipsis);
       layout.GetPixelSize (out ellipsis_width, out line_height);
       layout.SetMarkup ("n");
       layout.GetPixelSize (out en_width, out line_height);
       layout.SetMarkup ("W");
       layout.GetPixelSize (out en_width, out line_height);
       old_width = Allocation.Width;
 }
示例#3
0
        void Vadjustment_Changed(object sender, EventArgs e)
        {
            if (!m_init_done)
            {
                return;
            }

            if (m_ignore_scroll_change)
            {
                m_ignore_scroll_change = false;
                return;
            }

            Gtk.Adjustment zz   = sender as Gtk.Adjustment;
            double         val  = zz.Value;
            int            page = 1;

            for (int k = 0; k < m_numpages; k++)
            {
                if (val <= m_page_scroll_pos[k])
                {
                    m_GtkpageEntry.Text = page.ToString();
                    m_page_txt          = m_GtkpageEntry.Text;
                    return;
                }
                page += 1;
            }
            m_GtkpageEntry.Text = m_numpages.ToString();
            m_page_txt          = m_GtkpageEntry.Text;
        }
示例#4
0
            public ScreensaverConfigDialog()
                : base(Assembly.GetExecutingAssembly (), "ScreensaverConfigDialog.ui", "screensaver-config-dialog")
            {
                delay_adjustment = new Adjustment (default_delay, 1.0, 20.0, .5, 5, 0);
                LoadPreference (SCREENSAVER_DELAY);
                delay_scale.Adjustment = delay_adjustment;
                delay_adjustment.ValueChanged += HandleDelayChanged;

                tag_button = new MenuButton ();
                tag_button.SizeRequested += delegate (object sender, SizeRequestedArgs args) {
                    var req = args.Requisition;
                    req.Width += 100;
                    args.Requisition = req;
                };
                TagMenu menu = new TagMenu (null, MainWindow.Toplevel.Database.Tags);
                menu.Populate (false);
                menu.TagSelected += HandleTagSelected;
                tag_button.Menu = menu;
                tag_button.ShowAll ();
                table.Attach (tag_button, 2, 3, 1, 2);
                LoadPreference (SCREENSAVER_TAG);
                all_radio.Toggled += HandleTagRadioToggled;

                do_button.Clicked += HandleUseFSpot;
            }
		public QuickTaskOverviewMode (QuickTaskStrip parent)
		{
			this.parentStrip = parent;
			Events |= EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.ButtonMotionMask |
				EventMask.PointerMotionMask | EventMask.LeaveNotifyMask | EventMask.EnterNotifyMask;
			vadjustment = this.parentStrip.VAdjustment;

			vadjustment.ValueChanged += RedrawOnUpdate;
			vadjustment.Changed += RedrawOnUpdate;
			parentStrip.TaskProviderUpdated += RedrawOnUpdate;
			TextEditor = parent.TextEditor;
//			TextEditor.Caret.PositionChanged += CaretPositionChanged;
			TextEditor.HighlightSearchPatternChanged += RedrawOnUpdate;
			TextEditor.TextViewMargin.SearchRegionsUpdated += RedrawOnUpdate;
			TextEditor.TextViewMargin.MainSearchResultChanged += RedrawOnUpdate;
			TextEditor.GetTextEditorData ().HeightTree.LineUpdateFrom += HandleLineUpdateFrom;
			TextEditor.HighlightSearchPatternChanged += HandleHighlightSearchPatternChanged;
			HasTooltip = true;

			fadeInStage.ActorStep += delegate(Actor<QuickTaskOverviewMode> actor) {
				barColorValue = actor.Percent;
				return true;
			};
			fadeInStage.Iteration += (sender, e) => QueueDraw ();

			fadeOutStage.ActorStep += delegate(Actor<QuickTaskOverviewMode> actor) {
				barColorValue = 1 - actor.Percent;
				return true;
			};
			fadeOutStage.Iteration += (sender, e) => QueueDraw ();

			fadeInStage.UpdateFrequency = fadeOutStage.UpdateFrequency = 10;
		}
示例#6
0
        public ConfigurableColumn(ListStoreMapping mapping, IColumnInfo info, DataColumn column)
        {
            this.Mapping = mapping;
            this.ColumnInfo = info;
            this.DataColumn = column;

            this.Reorderable = true;
            this.Resizable = true;
            this.MinWidth = 20;
            this.FixedWidth = 80;
            this.Sizing = TreeViewColumnSizing.Fixed;
            this.Clickable = true;
            this.SortIndicator = false;
            this.SortOrder = SortType.Ascending;

            if(this.ColumnInfo != null)
            {
                this.Title = this.ColumnInfo.Caption;
                this.Visible = this.ColumnInfo.Visible;
            }
            else if (this.DataColumn != null)
            {
                this.Title = this.DataColumn.Caption;
            }

            CreateCellRenderers();

            this.Mapping.ColumnsStore.AddNode(this);

            this.AddNotification(NotifyChange);
            this.WidthAdjustment = new Adjustment(80, 20, 1000, 1, 2, 0);
            this.WidthAdjustment.Changed += delegate {
                this.FixedWidth = (int)(this.WidthAdjustment.Value);
            };
        }
示例#7
0
        public ImageView(Adjustment hadjustment, Adjustment vadjustment, bool canSelect)
        {
            OnSetScrollAdjustments (hadjustment, vadjustment);
            AdjustmentsChanged += ScrollToAdjustments;
            WidgetFlags &= ~WidgetFlags.NoWindow;
            SetFlag (WidgetFlags.CanFocus);

            can_select = canSelect;
        }
 public ySpinButton(Adjustment adjustment, double climb_rate, uint digits)
     : base(adjustment, climb_rate, digits)
 {
     Binding = new BindingControler<ySpinButton> (this, new Expression<Func<ySpinButton, object>>[] {
         (w => w.Value),
         (w => w.ValueAsInt),
         (w => w.ValueAsDecimal),
     });
 }
示例#9
0
 internal static string Dump(this Gtk.Adjustment alig)
 {
     if (alig == null)
     {
         return("<null>");
     }
     return(String.Format("Value:{0},PageSize{1},PageIncrement:{2},StepIncrement:{3},Lower:{4},Upper:{5}",
                          alig.Value, alig.PageSize, alig.PageIncrement, alig.StepIncrement, alig.Lower, alig.Upper));
 }
示例#10
0
        public ImageView(Adjustment hadjustment, Adjustment vadjustment, bool can_select)
            : base()
        {
            OnSetScrollAdjustments (hadjustment, vadjustment);
            children = new List<LayoutChild> ();
            AdjustmentsChanged += ScrollToAdjustments;
            WidgetFlags &= ~WidgetFlags.NoWindow;
            SetFlag (WidgetFlags.CanFocus);

            this.can_select = can_select;
        }
示例#11
0
    private Gtk.Widget CreateObjectList()
    {
        Gtk.HBox hbox = new Gtk.HBox(false, 0);

        Gtk.Adjustment vadjustment = new Gtk.Adjustment(0, 0, 100, 1, 10, 10);
        Gtk.VScrollbar scrollbar   = new Gtk.VScrollbar(vadjustment);

        hbox.PackStart(new ObjectListWidget(this, vadjustment), true, true, 0);
        hbox.PackEnd(scrollbar, false, true, 0);
        return(hbox);
    }
		public QuickTaskMiniMapMode (QuickTaskStrip parent)
		{
			minimap = new Minimpap (parent);
			PackStart (minimap, true, true, 0);
			
			rightMap = new QuickTaskOverviewMode (parent);
			PackStart (rightMap, true, true, 0);
			vadjustment = parent.VAdjustment;

			vadjustment.ValueChanged += RedrawOnVAdjustmentChange;

		}
示例#13
0
		public QuickTaskOverviewMode (QuickTaskStrip parent)
		{
			this.parentStrip = parent;
			Events |= EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.ButtonMotionMask | EventMask.PointerMotionMask | EventMask.LeaveNotifyMask;
			vadjustment = this.parentStrip.VAdjustment;
			
			vadjustment.ValueChanged += RedrawOnUpdate;
			vadjustment.Changed += RedrawOnUpdate;
			parentStrip.TaskProviderUpdated += RedrawOnUpdate;
			TextEditor = parent.TextEditor;
//			TextEditor.Caret.PositionChanged += CaretPositionChanged;
			TextEditor.HighlightSearchPatternChanged += RedrawOnUpdate;
			TextEditor.TextViewMargin.SearchRegionsUpdated += RedrawOnUpdate;
			TextEditor.TextViewMargin.MainSearchResultChanged += RedrawOnUpdate;
		}
示例#14
0
		public HScale (double min, double max, double step) : base (IntPtr.Zero)
		{
			if (GetType() != typeof (HScale)) {
				Adjustment adj = new Adjustment (min, min, max, step, 10 * step, 0);
				string[] names = new string [1];
				GLib.Value[] vals = new GLib.Value [1];
				names [0] = "adjustment";
				vals [0] = new GLib.Value (adj);
				CreateNativeObject (names, vals);
				vals [0].Dispose ();
				return;
			}

			Raw = gtk_hscale_new_with_range (min, max, step);
		}
示例#15
0
		public SmartScrolledWindow (Gtk.Widget vScrollBar = null)
		{
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			this.vScrollBar = vScrollBar ?? new VScrollbar (vAdjustment);
			this.vScrollBar.Parent = this;
			this.vScrollBar.Show ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			hScrollBar.Parent = this;
			hScrollBar.Show ();
		}
示例#16
0
		public SmartScrolledWindow ()
		{
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			vScrollBar = new VScrollbar (vAdjustment);
			vScrollBar.Parent = this;
			vScrollBar.Show ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			hScrollBar.Parent = this;
			hScrollBar.Show ();
		}
示例#17
0
文件: list.cs 项目: lulzzz/ifolder
        int currentWidth = 50; // pixels

        public BigList(IListModel provider)
        {
            this.provider = provider;

            //Accessibility
            RefAccessible().Role = Atk.Role.List;

            hAdjustment = new Gtk.Adjustment(0, 0, currentWidth, 1, 1, 1);
            hAdjustment.ValueChanged += new EventHandler(HAdjustmentValueChangedHandler);

            vAdjustment = new Gtk.Adjustment(0, 0, provider.Rows, 1, 1, 1);
            vAdjustment.ValueChanged += new EventHandler(VAdjustmentValueChangedHandler);

            layout = new Pango.Layout(PangoContext);

            ExposeEvent        += new ExposeEventHandler(ExposeHandler);
            ButtonPressEvent   += new ButtonPressEventHandler(ButtonPressEventHandler);
            ButtonReleaseEvent += new ButtonReleaseEventHandler(ButtonReleaseEventHandler);
            KeyPressEvent      += new KeyPressEventHandler(KeyHandler);
            Realized           += new EventHandler(RealizeHandler);
            Unrealized         += new EventHandler(UnrealizeHandler);
            ScrollEvent        += new ScrollEventHandler(ScrollHandler);
            SizeAllocated      += new SizeAllocatedHandler(SizeAllocatedHandler);
            MotionNotifyEvent  += new MotionNotifyEventHandler(MotionNotifyEventHandler);

            AddEvents((int)EventMask.ButtonPressMask | (int)EventMask.ButtonReleaseMask | (int)EventMask.KeyPressMask | (int)EventMask.PointerMotionMask);
            CanFocus = true;

            style_widget           = new EventBox();
            style_widget.StyleSet += new StyleSetHandler(StyleHandler);

            //
            // Compute the height and ellipsis width of the font,
            // and the en_width for our ellipsizing algorithm
            //
            layout.SetMarkup(ellipsis);
            layout.GetPixelSize(out ellipsis_width, out line_height);

            layout.SetMarkup("n");
            layout.GetPixelSize(out en_width, out line_height);

            layout.SetMarkup("W");
            layout.GetPixelSize(out en_width, out line_height);

            old_width = Allocation.Width;
        }
示例#18
0
        public PayFromMeter()
        {
            this.Build ();
            //Main meters
            ReadingListStore = new Gtk.ListStore (typeof (int), 	// 0 - meter id
                                                 typeof (int),		// 1 - tariff id
                                                 typeof (double),	// 2 - value
                                                  typeof(int), 		// 3 - current reading id
                                                 typeof (string),	// 4 - meter name
                                                  typeof(string),	// 5 - date of last reading
                                                  typeof (int),		// 6 - Last reading value
                                                  typeof (int),		// 7 - delta of value
                                                  typeof(string),	// 8 - current reading date
                                                  typeof(bool)		// 9 - take next as PreValue (for fill only)
                                                  );

            Gtk.CellRendererSpin CellValue = new CellRendererSpin();
            CellValue.Editable = true;
            Adjustment adjValue = new Adjustment(0,0,1000000,1,10,0);
            CellValue.Adjustment = adjValue;
            CellValue.Edited += OnValueSpinEdited;

            treeviewMeters.AppendColumn ("Тип счетчика/тариф", new Gtk.CellRendererText (), "text", 4);
            treeviewMeters.AppendColumn ("Дата", new Gtk.CellRendererText (), "text", 5);
            treeviewMeters.AppendColumn ("Предыдущие", new Gtk.CellRendererText (), RenderPreValueColumn);
            treeviewMeters.AppendColumn ("Дата", new Gtk.CellRendererText (), "text", 8);
            treeviewMeters.AppendColumn ("Текущие", CellValue, RenderValueColumn);
            treeviewMeters.AppendColumn ("Расход", new Gtk.CellRendererText (), RenderDeltaColumn);

            treeviewMeters.Model = ReadingListStore;
            treeviewMeters.ShowAll ();

            //Child meters
            ChildListStore = new Gtk.ListStore (typeof (string), 	// 0 - meter name
                                                  typeof (string),	// 1 - date
                                                  typeof (int)		// 2 - value
                                                  );

            treeviewChilds.AppendColumn ("Тип счетчика/тариф", new Gtk.CellRendererText (), "text", 0);
            treeviewChilds.AppendColumn ("Дата", new Gtk.CellRendererText (), "text", 1);
            treeviewChilds.AppendColumn ("Расход", new Gtk.CellRendererText (), RenderChildValueColumn);
            treeviewChilds.Model = ChildListStore;
            treeviewChilds.ShowAll ();

            pendingReadings = new List<PendingMeterReading>();
        }
		public SmartScrolledWindow (Gtk.Widget vScrollBar = null)
		{
			GtkWorkarounds.FixContainerLeak (this);
			
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			this.vScrollBar = vScrollBar ?? new VScrollbar (vAdjustment);
			this.vScrollBar.Parent = this;
			this.vScrollBar.Show ();
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			hScrollBar.Parent = this;
			hScrollBar.Show ();
		}
示例#20
0
        public Basis()
        {
            this.Build();
            drawBasis.SetSizeRequest(250, 250);
            //Создаем таблицу номенклатур
            NomenclatureStore = new ListStore(typeof(long), typeof(bool), typeof(int), typeof(string), typeof(int));

            CellRendererToggle CellSelected = new CellRendererToggle();
            CellSelected.Activatable = true;
            CellSelected.Toggled += onCellSelectToggled;

            Gtk.CellRendererSpin CellCount = new CellRendererSpin();
            CellCount.Editable = true;

            Adjustment adjCost = new Adjustment(0,0,100,1,5,0);
            CellCount.Adjustment = adjCost;
            CellCount.Edited += OnCountSpinEdited;

            treeviewNomenclature.AppendColumn("", CellSelected, "active", (int)NomenclatureCol.selected);
            treeviewNomenclature.AppendColumn("Название", new CellRendererText(), "text", (int)NomenclatureCol.nomenclature);
            treeviewNomenclature.AppendColumn("Количество", CellCount, "text", (int)NomenclatureCol.count);

            treeviewNomenclature.Model = NomenclatureStore;
            treeviewNomenclature.ShowAll();

            //Загрузка списка номенклатур
            string sql = "SELECT id, name FROM nomenclature WHERE type = 'construct'";
            SqliteCommand cmd = new SqliteCommand(sql, (SqliteConnection)QSMain.ConnectionDB);
            using (SqliteDataReader rdr = cmd.ExecuteReader())
            {
                while(rdr.Read())
                {
                    NomenclatureStore.AppendValues((long) -1,
                        false,
                        DBWorks.GetInt(rdr, "id", -1),
                        DBWorks.GetString(rdr, "name", ""),
                        1
                    );
                }
            }
        }
示例#21
0
    private Gtk.Widget CreateTileList()
    {
        Gtk.VBox box = new Gtk.VBox();
        box.Homogeneous = false;

        Gtk.Adjustment vadjustment = new Gtk.Adjustment(0, 0, 100, 1, 10, 10);

        tileList = new TileListWidget(this, selection, vadjustment);
        TilegroupSelector selector = new TilegroupSelector(this, tileList);

        Gtk.HBox hbox = new Gtk.HBox(false, 0);

        Gtk.VScrollbar scrollbar = new Gtk.VScrollbar(vadjustment);

        hbox.PackStart(tileList, true, true, 0);
        hbox.PackEnd(scrollbar, false, true, 0);

        box.PackStart(selector, false, true, 0);
        box.PackStart(hbox, true, true, 0);

        return(box);
    }
示例#22
0
        ///<summary>Create a DataViewDisplay</summary>
        public DataViewDisplay(DataView dv)
        {
            dataView = dv;

            // load the default layout from the data directory
            layout = new Layout(FileResourcePath.GetDataPath("bless-default.layout"));

            // initialize scrollbar
            Gtk.Adjustment
                adj = new Gtk.Adjustment(0.0, 0.0, 1.0, 1.0, 10.0, 0.0);
            vscroll = new Gtk.VScrollbar(adj);

            adj.ValueChanged += OnScrolled;

            // initialize drawing area
            drawingArea                 = new Gtk.DrawingArea();
            drawingArea.Realized       += OnRealized;
            drawingArea.ExposeEvent    += OnExposed;
            drawingArea.ConfigureEvent += OnConfigured;
            drawingArea.ModifyBg(StateType.Normal, new Gdk.Color(0xff, 0xff, 0xff));

            // add events that we want to handle
            drawingArea.AddEvents((int)Gdk.EventMask.ButtonPressMask);
            drawingArea.AddEvents((int)Gdk.EventMask.ButtonReleaseMask);
            drawingArea.AddEvents((int)Gdk.EventMask.PointerMotionMask);
            drawingArea.AddEvents((int)Gdk.EventMask.PointerMotionHintMask);
            drawingArea.AddEvents((int)Gdk.EventMask.KeyPressMask);
            drawingArea.AddEvents((int)Gdk.EventMask.KeyReleaseMask);

            drawingArea.CanFocus = true;     // needed to catch key events

            hbox = new Gtk.HBox();

            hbox.PackStart(drawingArea, true, true, 0);
            hbox.PackStart(vscroll, false, false, 0);

            this.PackStart(hbox);
        }
示例#23
0
        protected override void OnSetScrollAdjustments(Gtk.Adjustment hadj, Gtk.Adjustment vadj)
        {
            if (hAdjustement != null)
            {
                hAdjustement.ValueChanged -= HandleHorValueChanged;
            }
            if (vAdjustement != null)
            {
                vAdjustement.ValueChanged -= HandleVerValueChanged;
            }

            hAdjustement = hadj;
            vAdjustement = vadj;

            if (hAdjustement == null || vAdjustement == null)
            {
                return;
            }

            UpdateAdjustments();

            hAdjustement.ValueChanged += HandleHorValueChanged;
            vAdjustement.ValueChanged += HandleVerValueChanged;
        }
示例#24
0
文件: ImageView.cs 项目: hbons/f-spot
        protected override void OnSetScrollAdjustments(Gtk.Adjustment hadjustment, Gtk.Adjustment vadjustment)
        {
            if (hadjustment == null)
                hadjustment = new Gtk.Adjustment (0, 0, 0, 0, 0, 0);
            if (vadjustment == null)
                vadjustment = new Gtk.Adjustment (0, 0, 0, 0, 0, 0);

            bool need_change = false;

            if (Hadjustment != hadjustment) {
                Hadjustment = hadjustment;
                Hadjustment.Upper = scaled_width;
                Hadjustment.ValueChanged += HandleAdjustmentsValueChanged;
                need_change = true;
            }
            if (Vadjustment != vadjustment) {
                Vadjustment = vadjustment;
                Vadjustment.Upper = scaled_height;
                Vadjustment.ValueChanged += HandleAdjustmentsValueChanged;
                need_change = true;
            }

            if (need_change)
                HandleAdjustmentsValueChanged (this, EventArgs.Empty);
        }
示例#25
0
 protected override void OnSetScrollAdjustments(Gtk.Adjustment hadj, Gtk.Adjustment vadj)
 {
     left.SetScrollAdjustments(null, vadj);
     right.SetScrollAdjustments(null, vadj);
 }
示例#26
0
		protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
		{
			if (this.vadj != null)
				this.vadj.ValueChanged -= HandleValueChanged;
			this.vadj = vadj;
			base.OnSetScrollAdjustments (hadj, vadj);
			if (this.vadj != null) {
				this.vadj.ValueChanged += HandleValueChanged;
				SetAdjustments ();
			}
		}
			protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
			{
				hAdjustment = hadj;
				vAdjustment = vadj;
				if (vAdjustment != null)
					vAdjustment.ValueChanged += delegate {
						if (selection > -1)
							Selection = GetRowByPosition (curMouseY);
						QueueDraw ();
					};
				base.OnSetScrollAdjustments (hadj, vadj);
			}
示例#28
0
		protected override void OnDestroyed ()
		{
			base.OnDestroyed ();
			adj = null;
			textEditor = null;
			providerTasks = null;
			PropertyService.RemovePropertyHandler ("ScrollBar.Mode", ScrollBarModeChanged);
			EnableFancyFeatures.Changed -= HandleChanged;
		}
		void UnregisterAdjustments ()
		{
			if (cachedHAdjustment != null)
				cachedHAdjustment.ValueChanged -= HAdjustment_ValueChanged;
			if (cachedVAdjustment != null)
				cachedVAdjustment.ValueChanged -= VAdjustment_ValueChanged;
			cachedHAdjustment = null;
			cachedVAdjustment = null;
		}
示例#30
0
        public LocationsBox (Locations locations, UIManager uiManager)
		: this(new Builder("locations_box.ui"))
        {
			Locations = locations;
			
			// create the actions
			Gtk.Action create = new Gtk.Action("createLocation","Create Location","",Stock.Add);
			create.Activated += OnCreateLocation;
			Gtk.Action delete = new Gtk.Action("deleteLocation","Delete Location","",Stock.Remove);
			delete.Activated += OnDeleteLocation;
			Gtk.Action gotoItem = new Gtk.Action("gotoLocationItem","Goto Item","",Stock.GoForward);
			gotoItem.Activated += OnGotoLocationItem;
			Gtk.Action action = new Gtk.Action("location","Location");
			
			ActionGroup group = new ActionGroup("location");
			group.Add(create);
			group.Add(delete);
			group.Add(gotoItem);
			group.Add(action);
			uiManager.InsertActionGroup(group,0);
			
			// create item column with id
			TreeViewColumn col = new TreeViewColumn ();
			locationsItemColumn = col;
			col.Title = "Item";
			col.Expand = true;
			CellRenderer render;
			render = new CellRendererPixbuf ();
			col.PackStart (render, false);
			col.AddAttribute (render, "pixbuf", 1);
			render = new CellRendererText ();
			(render as CellRendererText).Editable = true;
			render.EditingStarted += OnStartLocationItemEdit;
			col.PackStart (render, true);
			col.AddAttribute (render, "text", 2);
			locationsView.AppendColumn(col);
			locationsView.AppendColumn ("ID", new Gtk.CellRendererText (), "text", 3);
			
			// create the labeled column
			col = new TreeViewColumn ();
			col.Title = "Labeled";
			render = new CellRendererToggle ();
			(render as CellRendererToggle).Toggled += OnLabeledToggle;
			col.PackStart (render, false);
			col.AddAttribute (render, "active", 4);
			col.AddAttribute (render, "activatable", 5);
			locationsView.AppendColumn(col);
			
			// create the amount column
			col    = new TreeViewColumn ();
			col.Title = "Amount";
			render = new CellRendererSpin ();
			(render as CellRendererText).Editable = true;
			(render as CellRendererText).Edited += OnAmountEdited;		
			Adjustment adj = new Adjustment(0, 0, 0, 0, 0, 0);  //set all limits etc to 0
			adj.Upper = 1000000000;  // assign some special values, that aren't 0
			adj.PageIncrement = 10;
			adj.StepIncrement = 1;
			(render as CellRendererSpin).Adjustment = adj;
			col.PackStart (render, false);
			col.AddAttribute (render, "text", 6);
			locationsView.AppendColumn (col);
			
			//set model etc
			locations.CollectionChanged += OnLocationCreation;
			TreeModelFilter filter = new LocationsFilter ( new LocationsModel( locations ));
			filter.Model.RowInserted += OnRowInserted;
			filter.VisibleFunc = new TreeModelFilterVisibleFunc (FilterLocations);
	 		locationsView.Model = filter;
			locationsView.Reorderable = true;
			
			// create the items chooser completion
			locationCompletion = new LocationItemChooser();
			TreeModel compModel = new TreeModelAdapter( new ItemsModel(locations.Inventory.Items));
			locationCompletion.Model = compModel;
			locationCompletion.MatchFunc = LocationItemCompletionMatch;
			locationCompletion.MinimumKeyLength = 0;
			// add the item info cell renderer to the completion	
			render = new CellRendererText ();
			locationCompletion.PackStart (render, true);
			locationCompletion.AddAttribute (render, "text", 2);
			
			// create the popups
			uiManager.AddUiFromResource("locations_box_menues.xml");
			locationPopup = (Menu) uiManager.GetWidget("/locationPopup");
	    }
		protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
		{
			// This is to satisfy the gtk_widget_set_scroll_adjustments
			// inside of GtkScrolledWindow so it doesn't complain about
			// its child not being scrollable.
		}
示例#32
0
 public static void AddValueClamped(this Gtk.Adjustment adj, double value)
 {
     adj.Value = System.Math.Max(adj.Lower, System.Math.Min(adj.Value + value, adj.Upper - adj.PageSize));
 }
示例#33
0
		public BlameWidget (VersionControlDocumentInfo info)
		{
			this.info = info;
			
			vAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			vAdjustment.Changed += HandleAdjustmentChanged;
			
			vScrollBar = new VScrollbar (vAdjustment);
			AddChild (vScrollBar);
			
			hAdjustment = new Adjustment (0, 0, 0, 0, 0, 0);
			hAdjustment.Changed += HandleAdjustmentChanged;
			
			hScrollBar = new HScrollbar (hAdjustment);
			AddChild (hScrollBar);
			
			editor = new TextEditor (info.Document.Editor.Document, info.Document.Editor.Options);
			AddChild (editor);
			editor.SetScrollAdjustments (hAdjustment, vAdjustment);
			
			overview = new BlameRenderer (this);
			AddChild (overview);
			
			this.DoubleBuffered = true;
			editor.Painted += HandleEditorExposeEvent;
			editor.EditorOptionsChanged += delegate {
				overview.OptionsChanged ();
			};
			editor.Caret.PositionChanged += ComparisonWidget.CaretPositionChanged;
			editor.FocusInEvent += ComparisonWidget.EditorFocusIn;
			editor.Document.Folded += delegate {
				QueueDraw ();
			};
			editor.Document.FoldTreeUpdated += delegate {
				QueueDraw ();
			};
			editor.ButtonPressEvent += OnPopupMenu;
			Show ();
		}
示例#34
0
		protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj) {
			Hadjustment = hadj;
			Vadjustment = vadj;
		}
		protected override void OnDestroyed ()
		{
			if (Child != null)
				Child.Destroy ();
			if (vAdjustment != null) {
				vAdjustment.Changed -= HandleAdjustmentChanged;
				vAdjustment.Destroy ();
				vAdjustment = null;
			}
			if (hAdjustment != null) {
				hAdjustment.Changed -= HandleAdjustmentChanged;
				hAdjustment.Destroy ();
				hAdjustment = null;
			}
			foreach (var c in children) {
				c.Child.Destroy ();
			}
			base.OnDestroyed ();
		}
		protected override void OnScrollAdjustmentsSet()
		{
			UnregisterAdjustments ();
			if (HAdjustment != null) {
				cachedHAdjustment = HAdjustment;
				HAdjustment.ValueChanged += HAdjustment_ValueChanged;
			}
			if (VAdjustment != null) {
				cachedVAdjustment = VAdjustment;
				VAdjustment.ValueChanged += VAdjustment_ValueChanged;
			}
		}
示例#37
0
        public DemoMain()
        {
            window = new Gtk.Window("TestForm1");
            Gtk.HBox hbox = new Gtk.HBox(false, 0);
            hbox1 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox2 = new Gtk.HBox(false, 0);
            Gtk.HBox hbox3 = new Gtk.HBox(false, 0);
            hbox.Add(hbox1);
            window.SetDefaultSize(600, 400);
            window.DeleteEvent += new DeleteEventHandler(WindowDelete);

            button1          = new Gtk.Button("button1");
            button1.Clicked += Button1Clicked;
            button2          = new Gtk.Button("button2");
            button3          = new Gtk.Button("button3");
            Gtk.Button button4 = new Gtk.Button("button4");
            button4.Clicked += Button4Clicked;
            Gtk.Button button5 = new Gtk.Button("button5");
            Gtk.Button button6 = new Gtk.Button("button6");
            Gtk.Button button7 = new Gtk.Button("button7");
            button7.Sensitive = false;

            scaleButton1 = new Gtk.ScaleButton(0, 0, 100, 10, new string [0]);

            hbox1.Add(hbox3);
            hbox1.Add(hbox2);
            hbox1.Add(button3);
            hbox1.Add(button2);

            button3.Accessible.Description = "help text 3";
            button3.Sensitive = false;

            label1 = new Gtk.Label("label1");

            textBox1 = new Gtk.Entry();
            Gtk.Entry textBox2 = new Gtk.Entry();
            textBox2.Visibility = false;
            textBox2.Sensitive  = false;
            textBox2.IsEditable = false;
            textBox3            = new Gtk.TextView();
            // TODO: scrollbars
            Gtk.CheckButton checkbox1 = new Gtk.CheckButton("checkbox1");
            Gtk.CheckButton checkbox2 = new Gtk.CheckButton("checkbox2");
            checkbox2.Sensitive = false;

            Gtk.TreeStore   store = new Gtk.TreeStore(typeof(string), typeof(string));
            Gtk.TreeIter [] iters = new Gtk.TreeIter [2];
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 1", "item 1 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 1a", "item 1a (2)");
            iters [0] = store.AppendNode();
            store.SetValues(iters [0], "item 2", "item 2 (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2a", "item 2a (2)");
            iters [1] = store.AppendNode(iters [0]);
            store.SetValues(iters [1], "item 2b", "item 2b (2)");
            treeView1 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView1, 0, "column 1");
            treeView1.CollapseAll();

            treeView2 = new Gtk.TreeView(store);
            AddTreeViewColumn(treeView2, 0, "column 1");
            AddTreeViewColumn(treeView2, 1, "column 2");
            treeView2.CollapseAll();
            treeView2.Accessible.Name = "treeView2";

            tableStore = new Gtk.TreeStore(typeof(string), typeof(string), typeof(string), typeof(string));
            iters [0]  = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "False", "Alice", "24", "");
            iters [0] = tableStore.AppendNode();
            tableStore.SetValues(iters [0], "True", "Bob", "28", "");
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            dataGridView1 = new Gtk.TreeView(tableStore);
            AddTreeViewColumn(dataGridView1, 0, "Gender");
            AddTreeViewColumn(dataGridView1, 1, "Name");
            AddTreeViewColumn(dataGridView1, 2, "Age");
            dataGridView1.Accessible.Name = "dataGridView1";

            hboxPanel = new Gtk.HBox();
            Gtk.Button btnRemoveTextBox = new Gtk.Button("Remove");
            btnRemoveTextBox.Clicked += RemoveTextBoxClicked;
            Gtk.Button btnAddTextBox = new Gtk.Button("Add");
            btnAddTextBox.Clicked     += AddTextBoxClicked;
            txtCommand                 = new Gtk.Entry();
            txtCommand.Accessible.Name = "txtCommand";
            Gtk.Button btnRun = new Gtk.Button("Run");
            btnRun.Clicked += btnRunClicked;
            hboxPanel.Add(btnRemoveTextBox);
            hboxPanel.Add(btnAddTextBox);

            Gtk.TreeStore treeStore = new Gtk.TreeStore(typeof(string));
            Gtk.TreeIter  iter      = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 0");
            iter = treeStore.AppendNode();
            treeStore.SetValue(iter, 0, "Item 1");
            listView1 = new Gtk.TreeView(treeStore);
            AddTreeViewColumn(listView1, 0, "items");
            listView1.Accessible.Name = "listView1";
            listView1.ExpandAll();

            hbox2.Add(button5);
            hbox2.Add(checkbox1);
            hbox2.Add(checkbox2);
            hbox2.Add(button4);
            hbox2.Accessible.Name = "groupBox2";

            hbox3.Add(button7);
            hbox3.Add(button6);
            hbox3.Sensitive       = false;
            hbox3.Accessible.Name = "groupBox3";

            hbox.Add(textBox3);
            hbox.Add(textBox2);
            hbox.Add(textBox1);
            hbox.Add(label1);
            hbox.Add(button1);
            hbox.Add(treeView1);
            hbox.Add(treeView2);
            hbox.Add(listView1);
            hbox.Add(dataGridView1);
            hbox.Add(txtCommand);
            hbox.Add(btnRun);
            hbox.Add(hboxPanel);
            hbox.Add(scaleButton1);

            Gtk.Menu file = new Gtk.Menu();
            file.Append(new Gtk.MenuItem("_New"));
            file.Append(new Gtk.MenuItem("_Open"));
            file.Append(new Gtk.CheckMenuItem("Check"));
            Gtk.MenuItem fileItem = new Gtk.MenuItem("File");
            fileItem.Submenu = file;
            Gtk.Menu edit = new Gtk.Menu();
            edit.Append(new Gtk.MenuItem("_Undo"));
            edit.Append(new Gtk.SeparatorMenuItem());
            edit.Append(new Gtk.MenuItem("_Cut"));
            edit.Append(new Gtk.MenuItem("Copy"));
            edit.Append(new Gtk.MenuItem("_Paste"));
            Gtk.MenuItem editItem = new Gtk.MenuItem("Edit");
            editItem.Submenu = edit;
            Gtk.MenuBar menuBar = new Gtk.MenuBar();
            menuBar.Append(fileItem);
            menuBar.Append(editItem);
            hbox.Add(menuBar);

            hbox.Add(new Gtk.SpinButton(0, 100, 1));
            hbox.Add(new Gtk.ToggleButton("ToggleButton"));
            Gtk.Adjustment adj = new Gtk.Adjustment(50, 0, 100,
                                                    1, 10, 10);
            hbox.Add(new Gtk.VScrollbar(adj));

            window.Add(hbox);
            window.ShowAll();
        }
示例#38
0
 public FormsSpinButton(Adjustment adjustment, double climb_rate, uint digits)
     : base(adjustment, climb_rate, digits)
 {
 }
			protected override void OnSetScrollAdjustments (Adjustment hadj, Adjustment vadj)
			{
				this.hadj = hadj;
				this.vadj = vadj;
				if (this.vadj != null)
					this.vadj.ValueChanged += (sender, e) => QueueDraw ();
				base.OnSetScrollAdjustments (hadj, vadj);
			}
		protected override void OnSetScrollAdjustments (Gtk.Adjustment hadj, Gtk.Adjustment vadj)
		{
			if (hAdjustement != null)
				hAdjustement.ValueChanged -= HandleHorValueChanged; 
			if (vAdjustement!= null)
				vAdjustement.ValueChanged -= HandleVerValueChanged;
			
			hAdjustement = hadj;
			vAdjustement = vadj;
			
			if (hAdjustement == null || vAdjustement == null)
				return;

			UpdateAdjustments ();
			
			hAdjustement.ValueChanged += HandleHorValueChanged;
			vAdjustement.ValueChanged += HandleVerValueChanged;
		}
示例#41
0
		void Connect (Adjustment fromAdj, Adjustment toAdj)
		{
			fromAdj.Changed += AdjustmentChanged;
			fromAdj.ValueChanged += delegate {
				if (toAdj.Value != fromAdj.Value)
					toAdj.Value = fromAdj.Value;
			};
			
			toAdj.ValueChanged += delegate {
				if (toAdj.Value != fromAdj.Value)
					fromAdj.Value = toAdj.Value;
			};
		}