public UMLEditableField(UMLEntry entry, bool resizable) : base((CanvasGroup) entry) { _textwidget = new CanvasWidget ((CanvasGroup) entry); _entry = entry; _is_resizable = resizable; _textview = new TextView (); TextBuffer tb = _textview.Buffer; tb.Text = _entry.Text; double x = entry.TextX, y = entry.TextY; _textwidget.W2i (ref x, ref y); X = x + entry.X; Y = y + entry.Y; _textwidget.Widget = _textview; _textwidget.Width = entry.TextWidth + 10;//FIXME? _textwidget.Height = entry.TextHeight + 10; //FIXME? _textview.KeyReleaseEvent += LookingEsc; _textview.Show (); Width = _textwidget.Width; Height = _textwidget.Height; //TODO: Dejar esto como estaba //CreateUMLControlPointGroup (); Resized += ElementResized; _entry.Root.CanvasEvent += ClickCanvasEvent; }
void ShowEditPage() { // Set the initial text textView.Buffer.Text = text; // Hide all the widgets on the view page textLabel.Hide(); deleteButton.Hide(); editButton.Hide(); // Show all the widgets on the edit page textView.Show(); cancelButton.Show(); saveButton.Show(); // TODO: Grab the keyboard focus so the cursor is in the textView. // Gtk.Widget aParent = this.Parent; // while (aParent != null) { // // Get our parent Gtk.Window // if (aParent is Gtk.Dialog) { // (aParent as Gtk.Dialog).Focus = textView; // break; // } // // aParent = aParent.Parent; // } // Switch to the Edit Page Page = editPageId; }
public StatusView(string filepath, VersionControlSystem vc) : base(Path.GetFileName(filepath) + " Status") { this.vc = vc; this.filepath = filepath; main = new VBox(false, 5); widget = main; main.Show(); commandbar = new HBox(false, 5); main.PackStart(commandbar, false, false, 5); showRemoteStatus = new Button("Show Remote Status"); commandbar.PackEnd(showRemoteStatus, false, false, 0); showRemoteStatus.Clicked += new EventHandler(OnShowRemoteStatusClicked); buttonCommit = new Button("Commit..."); commandbar.PackEnd(buttonCommit, false, false, 0); buttonCommit.Clicked += new EventHandler(OnCommitClicked); boxCommit = new VBox(false, 2); textCommitMessage = new TextView(); HBox boxCommitButtons = new HBox(false, 2); buttonCommitCancel = new Button("Cancel"); buttonCommitCommit = new Button("Commit"); textCommitMessage.Show(); buttonCommitCancel.Show(); buttonCommitCommit.Show(); boxCommit.PackStart(textCommitMessage, true, true, 0); boxCommit.PackStart(boxCommitButtons, false, false, 0); boxCommitButtons.PackEnd(buttonCommitCancel, false, false, 0); boxCommitButtons.PackEnd(buttonCommitCommit, false, false, 0); buttonCommitCancel.Clicked += new EventHandler(OnCommitCancelClicked); buttonCommitCommit.Clicked += new EventHandler(OnCommitCommitClicked); ScrolledWindow scroller = new ScrolledWindow(); Viewport viewport = new Viewport(); box = new VBox(false, 5); main.Add(scroller); viewport.Add(box); scroller.Add(viewport); main.ShowAll(); StartUpdate(); }
public TaskOptionsDialog(Gtk.Window parent, Gtk.DialogFlags flags, Task task) : base (Catalog.GetString ("Task Options"), parent, flags) { HasSeparator = false; //BorderWidth = 0; Resizable = false; //Decorated = false; this.SetDefaultSize (400, 300); this.task = task; // Frame frame = new Frame(); // frame.Shadow = ShadowType.Out; // frame.Show(); // VBox.PackStart (frame, true, true, 0); VBox vbox = new VBox (false, 6); vbox.BorderWidth = 6; vbox.Show (); VBox.PackStart (vbox, true, true, 0); // frame.Add (vbox); ActionArea.Layout = Gtk.ButtonBoxStyle.End; accel_group = new Gtk.AccelGroup (); AddAccelGroup (accel_group); // Gtk.Label l = new Gtk.Label ( // string.Format ( // "<span weight=\"bold\">{0}</span>", // Catalog.GetString ("Task Options"))); // l.UseMarkup = true; // l.Show (); // vbox.PackStart (l, false, false, 0); /// /// Summary /// Gtk.Label l = new Label (Catalog.GetString ("_Summary:")); l.Xalign = 0; l.Show (); vbox.PackStart (l, false, false, 0); summary_entry = new Gtk.Entry (); l.MnemonicWidget = summary_entry; summary_entry.Text = task.Summary; summary_entry.Show (); vbox.PackStart (summary_entry, false, false, 0); /// /// Details /// l = new Label (Catalog.GetString ("_Details:")); l.Xalign = 0; l.Show (); vbox.PackStart (l, false, false, 0); details_text_view = new TextView (); l.MnemonicWidget = details_text_view; details_text_view.WrapMode = WrapMode.Word; details_text_view.Show (); ScrolledWindow sw = new ScrolledWindow (); sw.ShadowType = Gtk.ShadowType.EtchedIn; sw.Add (details_text_view); sw.Show (); vbox.PackStart (sw, true, true, 0); /// /// Completion Checkbox /// HBox hbox = new Gtk.HBox (false, 4); completed_check_button = new Gtk.CheckButton ( task.IsComplete ? Catalog.GetString ("_Completed:") : Catalog.GetString ("_Complete")); if (task.IsComplete) completed_check_button.Active = true; completed_check_button.UseUnderline = true; completed_check_button.Toggled += OnCompletedCheckButtonToggled; completed_check_button.Show (); hbox.PackStart (completed_check_button, false, false, 0); completed_label = new Gtk.Label ( task.IsComplete ? GuiUtils.GetPrettyPrintDate (task.CompletionDate, true) : string.Empty); completed_label.Xalign = 0; completed_label.Show (); hbox.PackStart (completed_label, true, true, 0); hbox.Show (); vbox.PackStart (hbox, false, false, 0); /// /// Due Date /// hbox = new HBox (false, 4); due_date_check_button = new CheckButton (Catalog.GetString ("Due Date:")); if (task.DueDate != DateTime.MinValue) due_date_check_button.Active = true; due_date_check_button.Toggled += OnDueDateCheckButtonToggled; due_date_check_button.Show (); hbox.PackStart (due_date_check_button, false, false, 0); due_date_button = new Gtk.Extras.DateButton (task.DueDate, false); if (task.DueDate == DateTime.MinValue) due_date_button.Sensitive = false; due_date_button.Show (); hbox.PackStart (due_date_button, false, false, 0); // Spacer hbox.PackStart (new Gtk.Label (string.Empty), true, true, 0); hbox.Show (); vbox.PackStart (hbox, false, false, 0); /// /// Priority /// hbox = new HBox (false, 4); priority_check_button = new CheckButton (Catalog.GetString ("Priority:")); if (task.Priority != TaskPriority.Undefined) priority_check_button.Active = true; priority_check_button.Toggled += OnPriorityCheckButtonToggled; priority_check_button.Show (); hbox.PackStart (priority_check_button, false, false, 0); priority_combo_box = ComboBox.NewText (); priority_combo_box.AppendText (Catalog.GetString ("None")); priority_combo_box.AppendText (Catalog.GetString ("Low")); priority_combo_box.AppendText (Catalog.GetString ("Normal")); priority_combo_box.AppendText (Catalog.GetString ("High")); if (task.Priority == TaskPriority.Undefined) priority_combo_box.Sensitive = false; priority_combo_box.Active = (int) task.Priority; priority_combo_box.Changed += OnPriorityComboBoxChanged; priority_combo_box.Show (); hbox.PackStart (priority_combo_box, false, false, 0); // Spacer hbox.PackStart (new Gtk.Label (string.Empty), true, true, 0); hbox.Show (); vbox.PackStart (hbox, false, false, 0); AddButton (Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false); AddButton (Gtk.Stock.Save, Gtk.ResponseType.Ok, true); // if (parent != null) // TransientFor = parent; // if ((int) (flags & Gtk.DialogFlags.Modal) != 0) // Modal = true; // if ((int) (flags & Gtk.DialogFlags.DestroyWithParent) != 0) // DestroyWithParent = true; }
// // Construct a window to display a note // // Currently a toolbar with Link, Search, Text, Delete buttons // and a Gtk.TextView as the body. // public NoteWindow (Note note) : base (note.Title) { this.note = note; this.IconName = "tomboy"; this.SetDefaultSize (450, 360); Resizable = true; accel_group = new Gtk.AccelGroup (); AddAccelGroup (accel_group); text_menu = new NoteTextMenu (accel_group, note.Buffer, note.Buffer.Undoer); // Add the Find menu item to the toolbar Text menu. It // should only show up in the toplevel Text menu, since // the context menu already has a Find submenu. Gtk.SeparatorMenuItem spacer = new Gtk.SeparatorMenuItem (); spacer.Show (); text_menu.Append (spacer); Gtk.ImageMenuItem find_item = new Gtk.ImageMenuItem (Catalog.GetString("Find in This Note")); find_item.Image = new Gtk.Image (Gtk.Stock.Find, Gtk.IconSize.Menu); find_item.Activated += FindActivate; find_item.AddAccelerator ("activate", accel_group, (uint) Gdk.Key.f, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); find_item.Show (); text_menu.Append (find_item); plugin_menu = MakePluginMenu (); toolbar = MakeToolbar (); toolbar.Show (); template_widget = MakeTemplateBar (); // The main editor widget editor = new NoteEditor (note.Buffer); editor.PopulatePopup += OnPopulatePopup; editor.Show (); // Sensitize the Link toolbar button on text selection mark_set_timeout = new InterruptableTimeout(); mark_set_timeout.Timeout += UpdateLinkButtonSensitivity; note.Buffer.MarkSet += OnSelectionMarkSet; // FIXME: I think it would be really nice to let the // window get bigger up till it grows more than // 60% of the screen, and then show scrollbars. editor_window = new Gtk.ScrolledWindow (); editor_window.HscrollbarPolicy = Gtk.PolicyType.Automatic; editor_window.VscrollbarPolicy = Gtk.PolicyType.Automatic; editor_window.Add (editor); editor_window.Show (); FocusChild = editor; find_bar = new NoteFindBar (note); find_bar.Visible = false; find_bar.NoShowAll = true; find_bar.Hidden += FindBarHidden; Gtk.VBox box = new Gtk.VBox (false, 2); box.PackStart (toolbar, false, false, 0); box.PackStart (template_widget, false, false, 0); box.PackStart (editor_window, true, true, 0); box.PackStart (find_bar, false, false, 0); box.Show (); // Don't set up Ctrl-W or Ctrl-N if Emacs is in use bool using_emacs = false; string gtk_key_theme = (string) Preferences.Get ("/desktop/gnome/interface/gtk_key_theme"); if (gtk_key_theme != null && gtk_key_theme.CompareTo ("Emacs") == 0) using_emacs = true; // NOTE: Since some of our keybindings are only // available in the context menu, and the context menu // is created on demand, register them with the // global keybinder global_keys = new GlobalKeybinder (accel_group); // Close window (Ctrl-W) if (!using_emacs) global_keys.AddAccelerator (new EventHandler (CloseWindowHandler), (uint) Gdk.Key.w, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Escape has been moved to be handled by a KeyPress Handler so that // Escape can be used to close the FindBar. // Close all windows on current Desktop (Ctrl-Q) global_keys.AddAccelerator (new EventHandler (CloseAllWindowsHandler), (uint) Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Find Next (Ctrl-G) global_keys.AddAccelerator (new EventHandler (FindNextActivate), (uint) Gdk.Key.g, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Find Previous (Ctrl-Shift-G) global_keys.AddAccelerator (new EventHandler (FindPreviousActivate), (uint) Gdk.Key.g, (Gdk.ModifierType.ControlMask | Gdk.ModifierType.ShiftMask), Gtk.AccelFlags.Visible); // Open Help (F1) global_keys.AddAccelerator (new EventHandler (OpenHelpActivate), (uint) Gdk.Key.F1, 0, 0); // Create a new note if (!using_emacs) global_keys.AddAccelerator (new EventHandler (CreateNewNote), (uint) Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); // Have Esc key close the find bar or note window KeyPressEvent += KeyPressed; // Increase Indent global_keys.AddAccelerator (new EventHandler (ChangeDepthRightHandler), (uint) Gdk.Key.Right, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); // Decrease Indent global_keys.AddAccelerator (new EventHandler (ChangeDepthLeftHandler), (uint) Gdk.Key.Left, Gdk.ModifierType.Mod1Mask, Gtk.AccelFlags.Visible); this.Add (box); }