Esempio n. 1
0
        protected override void OnSizeAllocated(Gdk.Rectangle allocation)
        {
            base.OnSizeAllocated(allocation);

            if (!_lastAllocation.Equals(allocation))
            {
                _lastAllocation = allocation;

                _image.SetSizeRequest(allocation.Width, allocation.Height);
                _wrapperBox.SetSizeRequest(allocation.Width, allocation.Height);
            }
        }
Esempio n. 2
0
        private void CreateStatusbar()
        {
            statusBar              = new Toolbar();
            statusBar.ShowArrow    = false;
            statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
            statusBar.ExposeEvent += StatusBarExposeEvent;

            statusLabel        = new Label();
            statusLabel.Xalign = 0;
            statusLabel.Xpad   = 6;

            ToolItem  statusLabelItem = new ToolItem();
            Alignment statusAlign     = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);

            statusLabelItem.Add(statusLabel);
            statusLabelItem.Expand = true;
            statusBar.Insert(statusLabelItem, -1);
            statusLabelItem.ShowAll();

            taskStatusIcon             = new AnimatedImage();
            taskStatusIcon.Pixbuf      = Gui.LoadIcon(22, "process-working");
            taskStatusIcon.FrameHeight = 22;
            taskStatusIcon.FrameWidth  = 22;
            taskStatusIcon.Load();

            EventBox taskStatusIconBox = new EventBox();

            taskStatusIconBox.MotionNotifyEvent += delegate {
                UpdateTaskStatusIcon();
            };
            taskStatusIconBox.ButtonReleaseEvent += delegate {
                IndexingStatusWindow.Instance.Show();
            };
            taskStatusIconBox.SizeAllocated += delegate(object o, SizeAllocatedArgs args) {
                statusAlign.LeftPadding = (uint)args.Allocation.Width;
            };
            taskStatusIconBox.SetSizeRequest(22, 22);
            taskStatusIconBox.Add(taskStatusIcon);
            taskStatusIconBox.Show();

            ToolItem taskStatusIconItem = new ToolItem();

            taskStatusIconItem.Add(taskStatusIconBox);
            statusBar.Insert(taskStatusIconItem, -1);
            taskStatusIconItem.Show();

            mainVBox.PackStart(statusBar, false, false, 0);

            UpdateTaskStatusIcon();
            UpdateStatusText();
        }
Esempio n. 3
0
        void CalcVisibleRows()
        {
            var icon = ImageService.GetIcon(Ide.TypeSystem.Stock.Namespace, IconSize.Menu);

            rowHeight = Math.Max(1, (int)icon.Height + 2);

            int newHeight = rowHeight * rows;

            if (Allocation.Width != listWidth || Allocation.Height != newHeight)
            {
                box.SetSizeRequest(listWidth, newHeight);
            }
            SetAdjustments();
        }
        private void buildWindow()
        {
            //prevent resize on home screen
            this.Resizable = false;

            EventBox labelContainer = new EventBox ();
            Label confirmLoadLabel = new Label (Constants.Constants.confirmFileReloadText);
            //set the style of the label
            Style labelStyle = confirmLoadLabel.Style.Copy();
            labelStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            labelStyle.FontDescription.Size = Constants.Constants.CONFIRM_RELOAD_MESSAGE_SIZE;
            confirmLoadLabel.Style = labelStyle.Copy();

            labelContainer.Add (confirmLoadLabel);
            labelContainer.WidthRequest = 100;

            Button yesButton = new Button (Constants.Constants.YES);
            yesButton.Clicked += new EventHandler (LoadFile);

            Button noButton = new Button (Constants.Constants.NO);
            noButton.Clicked += new EventHandler (CancelRequest);

            //set the style of buttons
            Style buttonStyle = yesButton.Style.Copy ();
            buttonStyle.FontDescription.Family = Constants.Constants.welcomeWindowFontFamily;
            buttonStyle.FontDescription.Size = Constants.Constants.WELCOME_BUTTON_FONT_SIZE;

            yesButton.Style = buttonStyle.Copy();
            noButton.Style = buttonStyle.Copy();

            labelContainer.SetSizeRequest (100, 100);
            yesButton.SetSizeRequest (50, 50);
            noButton.SetSizeRequest (50, 50);

            HBox masterContainer = new HBox ();
            VBox mainContainer = new VBox ();

            HBox buttonContainer = new HBox ();

            buttonContainer.PackStart (yesButton, false, false, 50);
            buttonContainer.PackStart (noButton, false, false, 50);

            mainContainer.PackStart (labelContainer, false, false, 50);
            mainContainer.PackStart (buttonContainer, false, false, 50);

            masterContainer.PackStart (mainContainer, true, true, 100);

            this.Add (masterContainer);
        }
Esempio n. 5
0
 protected override void OnShown()
 {
     if (touchArea == null)
     {
         touchArea = new EventBox();
         touchArea.VisibleWindow = false;
         touchArea.SetSizeRequest(WidthRequest, HeightRequest);
         touchArea.ButtonPressEvent   += OnTouchAreaButtonPress;
         touchArea.ButtonReleaseEvent += OnTouchAreaButtonRelease;
         touchArea.ExposeEvent        += OnTouchAreaExpose;
         Put(touchArea, 0, 0);
         touchArea.Show();
     }
     base.OnShown();
 }
Esempio n. 6
0
        private void CreateStatusbar()
        {
            statusBar = new Toolbar();
            statusBar.ShowArrow = false;
            statusBar.ToolbarStyle = ToolbarStyle.BothHoriz;
            statusBar.ExposeEvent +=  StatusBarExposeEvent;

            statusLabel = new Label();
            statusLabel.Xalign = 0;
            statusLabel.Xpad = 6;

            ToolItem statusLabelItem = new ToolItem();
            Alignment statusAlign = new Alignment(0.5f, 0.5f, 1.0f, 1.0f);
            statusLabelItem.Add(statusLabel);
            statusLabelItem.Expand = true;
            statusBar.Insert(statusLabelItem, -1);
            statusLabelItem.ShowAll();

            taskStatusIcon = new Hyena.Widgets.AnimatedImage();
            taskStatusIcon.Pixbuf = Gui.LoadIcon(22, "process-working");
            taskStatusIcon.FrameHeight = 22;
            taskStatusIcon.FrameWidth = 22;
            taskStatusIcon.Load();

            EventBox taskStatusIconBox = new EventBox();
            taskStatusIconBox.MotionNotifyEvent += delegate {
                UpdateTaskStatusIcon();
            };
            taskStatusIconBox.ButtonReleaseEvent += delegate {
                IndexingStatusWindow.Instance.Show();
            };
            taskStatusIconBox.SizeAllocated += delegate (object o, SizeAllocatedArgs args) {
                statusAlign.LeftPadding = (uint)args.Allocation.Width;
            };
            taskStatusIconBox.SetSizeRequest(22, 22);
            taskStatusIconBox.Add(taskStatusIcon);
            taskStatusIconBox.Show();

            ToolItem taskStatusIconItem = new ToolItem();
            taskStatusIconItem.Add(taskStatusIconBox);
            statusBar.Insert(taskStatusIconItem, -1);
            taskStatusIconItem.Show();

            mainVBox.PackStart(statusBar, false, false, 0);

            UpdateTaskStatusIcon();
            UpdateStatusText();
        }
Esempio n. 7
0
    private EventBox MakeOccupiedColorContainer()
    {
        EventBox occupiedColorContainer = new EventBox ();
        occupiedColorContainer.ModifyBg (StateType.Normal, BLACK_COLOR);
        occupiedColorContainer.SetSizeRequest (Constants.Constants.SQUARE_DIMENSIONS, Constants.Constants.SQUARE_DIMENSIONS);

        return occupiedColorContainer;
    }
Esempio n. 8
0
    private EventBox MakeFreeColorContainer()
    {
        EventBox freeColorContainer = new EventBox ();
        freeColorContainer.ModifyBg (StateType.Normal, GRAY_COLOR);
        freeColorContainer.SetSizeRequest (Constants.Constants.SQUARE_DIMENSIONS, Constants.Constants.SQUARE_DIMENSIONS);

        return freeColorContainer;
    }
Esempio n. 9
0
    /**
     *  Adds in header to window
     *  Header contains title = "Explicit Free List Visualizer Tool"
     *  Second line then is "mm/dd/yy - hh:mm:ss(am/pm)
     *
     * */
    private void addHeader()
    {
        //init the top menu pain
        topHeader = new VBox ();

        //make button container and buttons
        HBox buttonPane = new HBox ();
        quitButton = new Button ("Quit");
        quitButton.Style = buttonStyle;
        quitButton.Clicked += new EventHandler(ExitApplication);

        loadFileButton = new Button("Load File");
        loadFileButton.Style = buttonStyle;
        loadFileButton.Clicked += new EventHandler(LoadNewFile);

        buttonPane.PackStart (quitButton, false, false, 10);
        buttonPane.PackStart (loadFileButton, false, false, 10);

        //make the labels for the title and date time
        //construct date time
        string dateTimeString;
        buildTimeString (out dateTimeString);

        //create labels for date and title
        //create containers for them
        EventBox titleContainer = new EventBox ();
        Label titleLabel = new Label (Constants.Constants.MainScreenHeaderText);
        titleLabel.Style = labelStyle.Copy ();
        titleContainer.Add (titleLabel);

        EventBox dateContainer = new EventBox ();
        Label dateLabel = new Label (dateTimeString);
        dateLabel.Style = labelStyle.Copy ();
        dateContainer.Add (dateLabel);

        //set their sizes
        titleContainer.SetSizeRequest (Constants.Constants.APPLICATION_WIDTH, Constants.Constants.TITLE_HEIGHT);
        titleContainer.SetSizeRequest (Constants.Constants.APPLICATION_WIDTH, Constants.Constants.TITLE_HEIGHT);

        //add them into top header and then the main contianers
        topHeader.PackStart (titleContainer, false, true, 0);
        topHeader.PackStart (dateContainer, false, true, 0);
        topHeader.PackStart (buttonPane, false, true, 10);

        masterContainer.PackStart (topHeader, false, true, 0);
    }
Esempio n. 10
0
 /// <summary>
 /// See SwitchContentView.
 /// This is an awkward solution and should be refactored.
 /// The only other way I can think if is creating two different
 /// EventHandlers, and they call with different parameters which
 /// Label and TextView to switch (Content or Title).
 /// </summary>
 /// <param name='edit'>
 /// If true, paint a TextView that can be edited.
 /// If false, paint a Label that displays memo.
 /// </param>
 public void SwitchTitleView(bool edit)
 {
     if (edit) {
         // Removing the label
         _titleLabelListener.Destroy();
         // Setting up the textview
         _titleTextView = new TextView ();
         _titleTextView.FocusInEvent += new FocusInEventHandler(MemoTextViewGotFocus);
         _titleTextView.FocusOutEvent += new FocusOutEventHandler(MemoTitleTextViewLostFocus);
         TextBuffer contentBuffer = _titleTextView.Buffer;
         contentBuffer.Text = this._item.GetTitle();
         _titleTextView.SetSizeRequest (200, 140);
         _titleTextView.Justification = Justification.Fill;
         _titleTextView.WrapMode = WrapMode.Word;
         _titleAlignment.Add (_titleTextView);
         _titleTextView.GrabFocus();
     } else {
         // Saving information from textview and removing it
         this._item.SetTitle(_titleTextView.Buffer.Text);
         Console.WriteLine ("Setting memo title to " + _titleTextView.Buffer.Text);
         _titleTextView.Destroy();
         // Creating label
         _titleLabel = new Label();
         _titleLabel.Text = this._item.GetTitle ();
         _titleLabel.SetSizeRequest (200, 80);
         _titleLabel.SetAlignment (0, 0);
         _titleLabel.LineWrap = true;
         _titleLabel.Justify = Justification.Fill;
         // Label listener
         _titleLabelListener = new EventBox ();
         _titleLabelListener.ButtonPressEvent += new ButtonPressEventHandler (MemoTitlePressHandler);
         _titleLabelListener.Add (_titleLabel);
         _titleLabelListener.SetSizeRequest(200, 80);
         _titleAlignment.Add (_titleLabelListener);
     }
     this._container.ShowAll();
 }