예제 #1
0
        private void TM1638ButtonsMessageReader(IList <int> messageData)
        {
            int readPos = 1;

            for (int u = 1; u <= this.numberUnits; u++)
            {
                if (this.tm1640Units[u - 1])
                {
                    continue;
                }
                this.buttonsRead = messageData[readPos++];
                if (this.buttonsRead != -1)
                {
                    this.butByte[0] = Convert.ToByte(this.buttonsRead);
                    this.buttons    = new BitArray(this.butByte);
                    for (var i = 0; i < Constants.NumberButtonsOnTm1638; i++)
                    {
                        if (this.buttons[i])
                        {
                            if (this.ButtonPress == null)
                            {
                                throw new ArgumentNullException();
                            }
                            ButtonPressEventHandler temp = this.ButtonPress;
                            if (temp != null)
                            {
                                temp(u, i + 1);
                            }
                        }
                    }
                }
            }
        }
예제 #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
파일: DragNotebook.cs 프로젝트: moscrif/ide
        public DragNotebook()
        {
            ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
            ButtonReleaseEvent += new ButtonReleaseEventHandler (OnButtonRelease);
            ChangeCurrentPage += new ChangeCurrentPageHandler(OnPageChanged);

            AddEvents ((Int32) (EventMask.AllEventsMask));
        }
예제 #4
0
        public DragNotebook()
        {
            ButtonPressEvent   += new ButtonPressEventHandler(OnButtonPress);
            ButtonReleaseEvent += new ButtonReleaseEventHandler(OnButtonRelease);
            ChangeCurrentPage  += new ChangeCurrentPageHandler(OnPageChanged);

            AddEvents((Int32)(EventMask.AllEventsMask));
        }
		public DragNotebook () {
			ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
			ButtonReleaseEvent += new ButtonReleaseEventHandler (OnButtonRelease);
			AddEvents ((Int32) (EventMask.AllEventsMask));
			
			//FIXME: we make the tabs smaller by shrinking the border, but this looks ugly with the windows theme
			if (!MonoDevelop.Core.PropertyService.IsWindows)
				this.SetProperty ("tab-border", new GLib.Value (0));
		}
예제 #6
0
        public PlacementTool(Type type, params object [] properties)
            : base(gtype)
        {
            if (properties.Length % 2 == 1)
                throw new ArgumentException ("A property name does not have a value associated.");

            this.properties = properties;
            this.type = type;

            ButtonPressEvent += new ButtonPressEventHandler (ButtonPress);
        }
예제 #7
0
        public DragNotebook()
        {
            ButtonPressEvent   += new ButtonPressEventHandler(OnButtonPress);
            ButtonReleaseEvent += new ButtonReleaseEventHandler(OnButtonRelease);
            AddEvents((Int32)(EventMask.AllEventsMask));

            //FIXME: we make the tabs smaller by shrinking the border, but this looks ugly with the windows theme
            if (!MonoDevelop.Core.Platform.IsWindows)
            {
                this.SetProperty("tab-border", new GLib.Value(0));
            }
        }
예제 #8
0
        public ComboListWindow() : base("ComboListWindow")
        {
            WindowPosition = WindowPosition.CenterOnParent;
            Decorated      = false;
            this.sw        = new ScrolledWindow();
            sw.ShadowType  = ShadowType.In;
            this.list      = new SimpleList();
            this.sw.Add(this.list);
            Add(this.sw);
            Child.ShowAll();

            DefaultWidth  = 264;
            DefaultHeight = 242;
            Show();
            ButtonPressEvent += new ButtonPressEventHandler(this.OnButtonPressEvent);
        }
예제 #9
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;
        }
예제 #10
0
    public CurveWidget(Curve _curve)
        : base()
    {
        PixelsPerUnit = 300;

        CanvasRect rect = new CanvasRect(Root());
        rect.X1 = 0;
        rect.Y1 = 0;
        rect.X2 = 1;
        rect.Y2 = 1;
        rect.FillColor = "white";
        rect.OutlineColor = null;
        rect.WidthUnits = 0.0;

        CenterScrollRegion = true;
        SetScrollRegion(0.0, 0.0, 1.0, 1.0);

        curve = _curve;

        bpath = new MyBPath(Root());
        bpath.WidthPixels = 0;
        bpath.OutlineColor = "blue";

        MakeLine(0,0.25, 1,0.25);
        MakeLine(0,0.5, 1,0.5);
        MakeLine(0,0.75, 1,0.75);

        MakeLine(0.25,0, 0.25,1);
        MakeLine(0.5,0, 0.5,1);
        MakeLine(0.75,0, 0.75,1);

        points = new ArrayList();

        for (uint i = 0; i < curve.NumPoints(); ++i) {
            float x, y;
            curve.GetPoint (i, out x, out y);
            points.Add (new CurvePoint(x, y, this));
        }

        bpath.SetPathDef(MakePathDef());

        marker = new CurveMarker(0, 0, this, "dark grey");
        marker.Active = false;

        ButtonPressEvent += new ButtonPressEventHandler(OnButtonPress);
    }
예제 #11
0
        public EditorNotebook()
        {
            listEditor      = new List <IEditor>();
            this.Scrollable = true;

            ButtonPressEvent   += new ButtonPressEventHandler(OnButtonPress);
            ButtonReleaseEvent += new ButtonReleaseEventHandler(OnButtonRelease);
            this.CanFocus       = false;

            this.SwitchPage += new SwitchPageHandler(OnSwitchPage);

            /*	filllStartPageThread = new Thread(new ThreadStart(ExecEditorThread));
             *      //filllStartPageThread.Priority = ThreadPriority.Normal;
             *      filllStartPageThread.Name = "ExecEditorThread";
             *      filllStartPageThread.IsBackground = true;
             *      //filllStartPageThread.Start();*/
        }
예제 #12
0
        public EditorNotebook()
        {
            listEditor = new List<IEditor>();
            this.Scrollable = true;

            ButtonPressEvent += new ButtonPressEventHandler(OnButtonPress);
            ButtonReleaseEvent += new ButtonReleaseEventHandler(OnButtonRelease);
            this.CanFocus = false;

            this.SwitchPage += new SwitchPageHandler(OnSwitchPage);

            /*	filllStartPageThread = new Thread(new ThreadStart(ExecEditorThread));
            //filllStartPageThread.Priority = ThreadPriority.Normal;
            filllStartPageThread.Name = "ExecEditorThread";
            filllStartPageThread.IsBackground = true;
            //filllStartPageThread.Start();*/
        }
예제 #13
0
    public IconList() : base()
    {
        status   = new Gtk.Window("status");
        status_l = new Gtk.Label("Status");
        status.Add(status_l);
        //status.ShowAll ();

        SetSizeRequest(670, 370);
        CanFocus = true;

        Realized          += new EventHandler(RealizeHanlder);
        Unrealized        += new EventHandler(UnrealizeHandler);
        SizeAllocated     += new SizeAllocatedHandler(SizeAllocatedHandler);
        MotionNotifyEvent += new MotionNotifyEventHandler(MotionHandler);
        ButtonPressEvent  += new ButtonPressEventHandler(ButtonHandler);
        KeyPressEvent     += new KeyPressEventHandler(KeyPressHandler);
        KeyReleaseEvent   += new KeyReleaseEventHandler(KeyReleaseHandler);
        ScrollEvent       += new ScrollEventHandler(ScrollHandler);

        AddEvents((int)(EventMask.ExposureMask |
                        EventMask.LeaveNotifyMask |
                        EventMask.ButtonPressMask |
                        EventMask.PointerMotionMask |
                        EventMask.KeyPressMask |
                        EventMask.ScrollMask |
                        EventMask.KeyReleaseMask));

        zoom = 1.0f;

        SetPreviewSize(160, 120);

        adjustment = new Adjustment(0, 0, 0, 0, 0, 0);
        adjustment.ValueChanged += new EventHandler(ValueChangedHandler);

        image_count = 0;

        Gtk.Settings s = Gtk.Settings.Default;
        double_click_time = (uint)s.DoubleClickTime;

        last_click_time = 0;
    }
예제 #14
0
        private void BuildDatePickerWindow()
        {
            Title             = "DatePicker";
            TypeHint          = Gdk.WindowTypeHint.Desktop;
            WindowPosition    = WindowPosition.Mouse;
            BorderWidth       = 1;
            Resizable         = false;
            AllowGrow         = false;
            Decorated         = false;
            DestroyWithParent = true;
            SkipPagerHint     = true;
            SkipTaskbarHint   = true;

            _datebox             = new VBox();
            _datebox.Spacing     = 6;
            _datebox.BorderWidth = 3;

            _calendar                = new RangeCalendar();
            _calendar.CanFocus       = true;
            _calendar.DisplayOptions = CalendarDisplayOptions.ShowHeading;
            _datebox.Add(_calendar);
            Box.BoxChild dateBoxChild = ((Box.BoxChild)(_datebox[_calendar]));
            dateBoxChild.Position = 0;

            Add(_datebox);

            if ((Child != null))
            {
                Child.ShowAll();
            }

            Show();

            ButtonPressEvent                 += new ButtonPressEventHandler(OnButtonPressEvent);
            _calendar.ButtonPressEvent       += new ButtonPressEventHandler(OnCalendarButtonPressEvent);
            _calendar.DaySelected            += new EventHandler(OnCalendarDaySelected);
            _calendar.DaySelectedDoubleClick += new EventHandler(OnCalendarDaySelectedDoubleClick);
        }
예제 #15
0
        public KeybindingTreeView()
        {
            Model = new ListStore(typeof(string), typeof(string), typeof(string), typeof(KeyBinding));

            CellRendererText actionCell = new CellRendererText();

            actionCell.Width = 175;
            InsertColumn(-1, Catalog.GetString("Action"), actionCell, "text", (int)Column.Action);

            CellRendererAccel bindingCell = new CellRendererAccel();

            bindingCell.AccelMode     = CellRendererAccelMode.Other;
            bindingCell.Editable      = true;
            bindingCell.AccelEdited  += new AccelEditedHandler(OnAccelEdited);
            bindingCell.AccelCleared += new AccelClearedHandler(OnAccelCleared);
            InsertColumn(-1, Catalog.GetString("Shortcut"), bindingCell, "text", (int)Column.BoundKeyString);

            RowActivated     += new RowActivatedHandler(OnRowActivated);
            ButtonPressEvent += new ButtonPressEventHandler(OnButtonPress);

            AddBindings();
            Selection.SelectPath(TreePath.NewFirst());
        }
예제 #16
0
파일: IconList.cs 프로젝트: emtees/old-code
	public IconList () : base ()
	{
		status = new Gtk.Window ("status");
		status_l = new Gtk.Label ("Status");
		status.Add (status_l);
		//status.ShowAll ();
		
		SetSizeRequest (670, 370);
		CanFocus = true;
		
		Realized += new EventHandler (RealizeHanlder);
		Unrealized += new EventHandler (UnrealizeHandler);
		SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);
		MotionNotifyEvent += new MotionNotifyEventHandler (MotionHandler);
		ButtonPressEvent += new ButtonPressEventHandler (ButtonHandler);
		KeyPressEvent += new KeyPressEventHandler (KeyPressHandler);
		KeyReleaseEvent += new KeyReleaseEventHandler (KeyReleaseHandler);
		ScrollEvent += new ScrollEventHandler (ScrollHandler);
		
		AddEvents ((int) (EventMask.ExposureMask |
				  EventMask.LeaveNotifyMask |
				  EventMask.ButtonPressMask |
				  EventMask.PointerMotionMask |
				  EventMask.KeyPressMask |
				  EventMask.ScrollMask |
				  EventMask.KeyReleaseMask));

                zoom = 1.0f;

		SetPreviewSize (160, 120);
		
		adjustment = new Adjustment (0, 0, 0, 0, 0, 0);
		adjustment.ValueChanged += new EventHandler (ValueChangedHandler);

                image_count = 0;

		Gtk.Settings s = Gtk.Settings.Default;
		double_click_time = (uint) s.DoubleClickTime;

		last_click_time = 0;
	}
예제 #17
0
 public void RegisterPressEventHandler(ButtonPressEventHandler eventHandler)
 {
     UIEventListener.Get(base.gameObject).onPress = new UIEventListener.BoolDelegate(this.OnButtonPressed);
     this.m_buttonPressEventHandler = eventHandler;
 }
예제 #18
0
	protected IconView () : base (null, null)
	{
		cache = new FSpot.PixbufCache ();
		cache.OnPixbufLoaded += HandlePixbufLoaded;

		ScrollAdjustmentsSet += new ScrollAdjustmentsSetHandler (HandleScrollAdjustmentsSet);
		
		ButtonPressEvent += new ButtonPressEventHandler (HandleButtonPressEvent);
		ButtonReleaseEvent += new ButtonReleaseEventHandler (HandleButtonReleaseEvent);
		KeyPressEvent += new KeyPressEventHandler (HandleKeyPressEvent);
		ScrollEvent += new ScrollEventHandler(HandleScrollEvent);

		Destroyed += HandleDestroyed;

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

		//FSpot.Global.ModifyColors (this);
	}
예제 #19
0
        public ImageCheckBox()
        {
            BuildImageCheckBox();

            ButtonPressEvent += new ButtonPressEventHandler(OnButtonPress);
        }
예제 #20
0
 internal static ButtonPressEventHandler Wrap(ButtonPressEventHandler h)
 {
     return(delegate(object o, ButtonPressEventArgs e) {
         h(o, e);
     });
 }
예제 #21
0
 private void AddItemToMenu(string text, ButtonPressEventHandler buttonPress)
 {
     var menuItem = new MenuItem(text);
     menuItem.ButtonPressEvent += buttonPress;
     ContextMenu.Add(menuItem);
 }
 public ButtonMonitor(CTRE.Phoenix.Controller.GameController gameCntrlr, int btnIdx, ButtonPressEventHandler handler)
 {
     _gameCntrlr = gameCntrlr;
     _btnIdx     = btnIdx;
     ButtonPress = handler;
 }
예제 #23
0
        public MainWindow() : base("Main Window")
        {
            SetDefaultSize(800, 650);
            DeleteEvent += new DeleteEventHandler(delete_cb);
            bool isUniform = false;
            int  margin    = 5;

            VBox topPanel = new VBox(isUniform, margin);
            HBox layCan   = new HBox(isUniform, margin);
            VBox layout   = new VBox(isUniform, margin);
            VBox layBtn   = new VBox(isUniform, margin);

            ButtonPressEvent   += new ButtonPressEventHandler(ButtonPressHandler);
            MotionNotifyEvent  += new MotionNotifyEventHandler(MotionNotifyHandler);
            ButtonReleaseEvent += new ButtonReleaseEventHandler(ButtonReleaseHandler);

            // menu bar

            MenuBar  mb        = new MenuBar();
            Menu     file_menu = new Menu();
            MenuItem exit_item = new MenuItem("Exit");
            MenuItem save_item = new MenuItem("Save");
            MenuItem open_item = new MenuItem("Open");

            exit_item.Activated += new EventHandler(on_exit_item_activate);
            open_item.Activated += new EventHandler(OnOpenCallback);
            save_item.Activated += new EventHandler(onSaveCallback);
            file_menu.Append(open_item);
            file_menu.Append(save_item);
            file_menu.Append(exit_item);
            MenuItem file_item = new MenuItem("File");

            file_item.Submenu = file_menu;
            mb.Append(file_item);


            layout.Add(Align(mb, 0, 0.5f, 1, 1));

            // toolbar

            Toolbar toolbar = new Toolbar();

            ToolButton buttonMove = new ToggleToolButton();

            buttonMove.IconWidget = new Gtk.Image("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/ops/move.png");
            buttonMove.Clicked   += new EventHandler(OnMoveClick);

            ToolButton buttonSelect = new ToggleToolButton();

            buttonSelect.IconWidget = new Gtk.Image("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/ops/scale.png");
            buttonSelect.Clicked   += new EventHandler(OnSelectClick);

            ToolButton buttonStar = new ToggleToolButton();
            var        pixbufStar = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/star.png");

            buttonStar.IconWidget = new Gtk.Image(pixbufStar.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonStar.Clicked   += new EventHandler(OnStarClick);

            ToolButton buttonAviator = new ToggleToolButton();
            var        pixbufAv      = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/aviator.png");

            buttonAviator.IconWidget = new Gtk.Image(pixbufAv.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonAviator.Clicked   += new EventHandler(OnAviatorClick);

            ToolButton buttonHeart = new ToggleToolButton();
            var        pixbufH     = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/heart.png");

            buttonHeart.IconWidget = new Gtk.Image(pixbufH.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonHeart.Clicked   += new EventHandler(OnHeartClick);

            ToolButton buttonNerd = new ToggleToolButton();
            var        pixbufN    = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/nerd.png");

            buttonNerd.IconWidget = new Gtk.Image(pixbufN.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonNerd.Clicked   += new EventHandler(OnNerdClick);

            ToolButton buttonHorns = new ToggleToolButton();
            var        pixbufHorns = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/horns.png");

            buttonHorns.IconWidget = new Gtk.Image(pixbufHorns.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonHorns.Clicked   += new EventHandler(OnHornsClick);

            ToolButton buttonHalo = new ToggleToolButton();
            var        pixbufHalo = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/halo.png");

            buttonHalo.IconWidget = new Gtk.Image(pixbufHalo.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonHalo.Clicked   += new EventHandler(OnHaloClick);

            ToolButton buttonTiara = new ToggleToolButton();
            var        pixbufT     = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/tiara.png");

            buttonTiara.IconWidget = new Gtk.Image(pixbufT.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonTiara.Clicked   += new EventHandler(OnTiaraClick);

            ToolButton buttonMous = new ToggleToolButton();
            var        pixbufM    = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/moustache.png");

            buttonMous.IconWidget = new Gtk.Image(pixbufM.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonMous.Clicked   += new EventHandler(OnMousClick);

            ToolButton buttonLib = new ToggleToolButton();
            var        pixbufL   = new Gdk.Pixbuf("/Users/eliaanagnostou/Documents/cs71/03-photobooth-eanagno1-zbatool1/accessories/librarian.png");

            buttonLib.IconWidget = new Gtk.Image(pixbufL.ScaleSimple(30, 30, Gdk.InterpType.Bilinear));
            buttonLib.Clicked   += new EventHandler(OnLibClick);


            SeparatorToolItem sep = new SeparatorToolItem();

            toolbar.Insert(buttonMove, -1);
            toolbar.Insert(buttonSelect, -1);
            toolbar.Insert(sep, -1);
            toolbar.Insert(buttonStar, -1);
            toolbar.Insert(buttonAviator, -1);
            toolbar.Insert(buttonHeart, -1);
            toolbar.Insert(buttonNerd, -1);
            toolbar.Insert(buttonHorns, -1);
            toolbar.Insert(buttonHalo, -1);
            toolbar.Insert(buttonTiara, -1);
            toolbar.Insert(buttonMous, -1);
            toolbar.Insert(buttonLib, -1);

            toolbar.ToolbarStyle = ToolbarStyle.BothHoriz;
            toolbar.ShowArrow    = false;
            layout.Add(Align(toolbar, 0, 0.25f, 1, 0));


            layBtn.Add(Align(_list, 1, 0, 0, 1));


            Button btn = new Button("Delete layer");

            btn.Clicked += new EventHandler(btn_click);
            layBtn.Add(Align(btn, 0, 0, 1, 1));
            layCan.Add(Align(layBtn, 1, 0, 0, 1));


            layCan.Add(Align(_canv, 1, 0, 1, 1));


            topPanel.Add(Align(layout, 1, 0, 1, 1));
            topPanel.Add(Align(layCan, 1, 0, 0, 1));
            Add(topPanel);
            ShowAll();
        }
예제 #24
0
        public MainWindow()
        {
            pressed_keys = new HashSet <Gdk.Key>();

            // Build our window
            CreateWindow();

            // Set up the Command Map window.
            cmd_map = new CommandMapWindow();

            // Move the tool toolbar into the command map window.
            //PintaCore.Chrome.ToolToolBar.Reparent (cmd_map.ToolToolbarBox);

            // Initialize interface things
            window_shell.AddAccelGroup(PintaCore.Actions.AccelGroup);
            dialog_handlers = new ActionHandlers();

            PintaCore.Chrome.InitializeProgessDialog(new ProgressDialog());
            PintaCore.Chrome.InitializeErrorDialogHandler((parent, message, details) => {
                System.Console.Error.WriteLine("Pinta: {0}", details);
                ErrorDialog errorDialog = new ErrorDialog(parent);
                try {
                    errorDialog.SetMessage(message);
                    errorDialog.AddDetails(details);
                    errorDialog.Run();
                } finally {
                    errorDialog.Destroy();
                }
            }
                                                          );

            PintaCore.Initialize();

            // Initialize extensions
            AddinManager.Initialize();
            AddinManager.Registry.Update();

            //Look out for any changes in extensions
            AddinManager.AddExtensionNodeHandler(typeof(IExtension), OnExtensionChanged);

            // Try to set the default tool to the PaintBrush
            PintaCore.Tools.SetCurrentTool(Catalog.GetString("Paintbrush"));

            // Load the user's previous settings
            LoadUserSettings();

            // Give the canvas focus
            PintaCore.Chrome.Canvas.GrabFocus();

            // We support drag and drop for URIs
            window_shell.AddDragDropSupport(new Gtk.TargetEntry("text/uri-list", 0, 100));

            // Handle a few main window specific actions
            PintaCore.Actions.File.BeforeQuit += delegate { SaveUserSettings(); };

            window_shell.DeleteEvent      += MainWindow_DeleteEvent;
            window_shell.DragDataReceived += MainWindow_DragDataReceived;

            window_shell.KeyPressEvent   += MainWindow_KeyPressEvent;
            window_shell.KeyReleaseEvent += MainWindow_KeyReleaseEvent;

            window_shell.FocusOutEvent += MainWindow_FocusOutEvent;

            // TODO: These need to be [re]moved when we redo zoom support
            PintaCore.Actions.View.ZoomToWindow.Activated    += new EventHandler(ZoomToWindow_Activated);
            PintaCore.Actions.View.ZoomToSelection.Activated += new EventHandler(ZoomToSelection_Activated);
            PintaCore.Workspace.ActiveDocumentChanged        += ActiveDocumentChanged;

            ButtonPressEventHandler close_cmd_map = delegate(object sender, ButtonPressEventArgs e) {
                cmd_map.Off(false);
            };

            // Tell some background stuff to close the CM when it is clicked.
            PintaCore.Chrome.Canvas.ButtonPressEvent += close_cmd_map;
            dock.ButtonPressEvent += close_cmd_map;
        }
예제 #25
0
        public GridView()
        {
            CanFocus     = true;
            WidgetFlags |= WidgetFlags.NoWindow;

            selection   = new GridSelection(this);
            orientation = Orientation.Vertical;

            StyleSet         += new StyleSetHandler(OnStyleSet);
            StateChanged     += new StateChangedHandler(OnStateChanged);
            FocusInEvent     += new FocusInEventHandler(OnFocusInEvent);
            FocusOutEvent    += new FocusOutEventHandler(OnFocusOutEvent);
            ButtonPressEvent +=
                new ButtonPressEventHandler(OnButtonPressEvent);
            KeyPressEvent     += new KeyPressEventHandler(OnKeyPressEvent);
            selection.Changed += new EventHandler(OnSelectionChanged);

            cda              = new DrawingArea();
            cda.ExposeEvent += new ExposeEventHandler(OnCDAExposeEvent);
            cda.AddEvents((int)EventMask.PointerMotionMask);
            cda.MotionNotifyEvent +=
                new MotionNotifyEventHandler(OnYHeaderMotionNotifyEvent);
            cda.AddEvents((int)EventMask.ButtonPressMask);
            cda.ButtonPressEvent +=
                new ButtonPressEventHandler(OnYHeaderButtonPressEvent);
            cda.AddEvents((int)EventMask.ButtonReleaseMask);
            cda.ButtonReleaseEvent +=
                new ButtonReleaseEventHandler(OnYHeaderButtonReleaseEvent);
            cda.AddEvents((int)EventMask.ScrollMask);
            Add(cda);

            tda              = new DrawingArea();
            tda.ExposeEvent += new ExposeEventHandler(OnTDAExposeEvent);
            tda.AddEvents((int)EventMask.PointerMotionMask);
            tda.MotionNotifyEvent +=
                new MotionNotifyEventHandler(OnYHeaderMotionNotifyEvent);
            tda.AddEvents((int)EventMask.ButtonPressMask);
            tda.ButtonPressEvent +=
                new ButtonPressEventHandler(OnYHeaderButtonPressEvent);
            tda.AddEvents((int)EventMask.ButtonReleaseMask);
            tda.ButtonReleaseEvent +=
                new ButtonReleaseEventHandler(OnYHeaderButtonReleaseEvent);
            tda.AddEvents((int)EventMask.ScrollMask);

            lda              = new DrawingArea();
            lda.ExposeEvent += new ExposeEventHandler(OnLDAExposeEvent);
            lda.AddEvents((int)EventMask.ScrollMask);
            lda.ButtonPressEvent +=
                new ButtonPressEventHandler(OnLDAButtonPressEvent);

            fvp            = new Viewport();
            fvp.ShadowType = ShadowType.None;

            fda              = new DrawingArea();
            fda.StyleSet    += new StyleSetHandler(OnFDAStyleSet);
            fda.Realized    += new EventHandler(OnFDARealized);
            fda.ExposeEvent += new ExposeEventHandler(OnFDAExposeEvent);
            fda.AddEvents((int)EventMask.ButtonPressMask);
            fda.ButtonPressEvent +=
                new ButtonPressEventHandler(OnFDAButtonPressEvent);
            fda.AddEvents((int)EventMask.ScrollMask);
            fvp.Add(fda);
            Add(fvp);

            tvp            = new Viewport(fvp.Hadjustment, null);
            tvp.ShadowType = ShadowType.None;
            tvp.Add(tda);
            Add(tvp);

            lvp            = new Viewport(null, fvp.Vadjustment);
            lvp.ShadowType = ShadowType.None;
            lvp.Add(lda);
            Add(lvp);

            hbar = new HScrollbar(fvp.Hadjustment);
            new LinkedScrollbar(hbar, tda, fda);
            Add(hbar);

            vbar = new VScrollbar(fvp.Vadjustment);
            new LinkedScrollbar(vbar, lda, fda);
            Add(vbar);
        }
예제 #26
0
        public ShapesArea(Config config)
        {
            m_gl = new GlWidget (this, config);

            AddEvents (	(int)(Gdk.EventMask.Button1MotionMask |
                        Gdk.EventMask.Button2MotionMask |
                        Gdk.EventMask.ButtonPressMask |
                        Gdk.EventMask.ButtonReleaseMask |
                        Gdk.EventMask.VisibilityNotifyMask) );
            Realized += new EventHandler (OnRealize);
            ConfigureEvent += new ConfigureEventHandler (OnConfigure);
            ExposeEvent += new ExposeEventHandler (OnExpose);

            ButtonPressEvent += new ButtonPressEventHandler (OnButtonPress);
            ButtonReleaseEvent += new ButtonReleaseEventHandler (OnButtonRelease);
            MotionNotifyEvent += new MotionNotifyEventHandler (OnMotionNotify);

            MapEvent += new MapEventHandler (OnMap);
            UnmapEvent += new UnmapEventHandler (OnUnmap);
            VisibilityNotifyEvent += new VisibilityNotifyEventHandler (OnVisibilityNotify);
            KeyPressEvent += new KeyPressEventHandler (OnKeyPress);

            int i = 0;
            shapeArray = new ShapeProp [9];
            shapeArray[i++] = new ShapeProp ("Cube");
            shapeArray[i++] = new ShapeProp ("Sphere");
            shapeArray[i++] = new ShapeProp ("Cone");
            shapeArray[i++] = new ShapeProp ("Torus");
            shapeArray[i++] = new ShapeProp ("Tetrahedron");
            shapeArray[i++] = new ShapeProp ("Octahedron");
            shapeArray[i++] = new ShapeProp ("Dodecahedron");
            shapeArray[i++] = new ShapeProp ("Icosahedron");
            shapeArray[i  ] = new ShapeProp ("Teapot");
            shape_current = i;
            mat_current = (MaterialProp)materialList[0];

            /*
            * Popup menu.
            */
            CreatePopupMenu ();
            ButtonPressEvent += new ButtonPressEventHandler (OnButtonPressPopupMenu);
        }