void initStart() { //add event box so we can track clicking toCropBox = new EventBox(); mainWindowTracker.Add(toCropBox); //set rectangle color toCropBox.ModifyBase(StateType.Normal, RectangleColor); //window decoration mainWindowTracker.Decorated = false; mainWindowTracker.Opacity = .5; mainWindowTracker.Fullscreen(); mainWindowTracker.GdkWindow.Cursor = new Gdk.Cursor(CursorType.Plus); //add our key events mainWindowTracker.KeyPressEvent += EntryKeyPressEvent; mainWindowTracker.DeleteEvent += delete_event; toCropBox.ButtonPressEvent += DragStart; toCropBox.ButtonReleaseEvent += DragEnd; toCropBox.MotionNotifyEvent += Dragging; mainWindowTracker.ShowAll(); }
///<summary> /// InitWindow /// Sets up the widgets and events in the chat window ///</summary> void InitWindow() { this.Icon = Utilities.GetIcon("giver-48", 48); // Update the window title Title = string.Format("Giver Recipients"); this.DefaultSize = new Gdk.Size(300, 500); // Start with an event box to paint the background white EventBox eb = new EventBox(); eb.BorderWidth = 0; eb.ModifyBg(StateType.Normal, new Gdk.Color(255, 255, 255)); eb.ModifyBase(StateType.Normal, new Gdk.Color(255, 255, 255)); VBox mainVBox = new VBox(); mainVBox.BorderWidth = 0; mainVBox.Show(); eb.Add(mainVBox); this.Add(eb); scrolledWindow = new ScrolledWindow(); scrolledWindow.VscrollbarPolicy = PolicyType.Automatic; scrolledWindow.HscrollbarPolicy = PolicyType.Never; //scrolledWindow.ShadowType = ShadowType.None; scrolledWindow.BorderWidth = 0; scrolledWindow.CanFocus = true; scrolledWindow.Show(); mainVBox.PackStart(scrolledWindow, true, true, 0); // Add a second Event box in the scrolled window so it will also be white EventBox innerEb = new EventBox(); innerEb.BorderWidth = 0; innerEb.ModifyBg(StateType.Normal, new Gdk.Color(255, 255, 255)); innerEb.ModifyBase(StateType.Normal, new Gdk.Color(255, 255, 255)); targetVBox = new VBox(); targetVBox.BorderWidth = 0; targetVBox.Show(); innerEb.Add(targetVBox); scrolledWindow.AddWithViewport(innerEb); //mainVBox.PackStart (targetVBox, false, false, 0); manualTarget = new TargetService(); manualTarget.Show(); mainVBox.PackStart(manualTarget, false, false, 0); Shown += OnWindowShown; DeleteEvent += WindowDeleted; Application.Instance.TransferStarted += TransferStartedHandler; }
private void Init() { Logger.Debug("Called Init"); this.Icon = Utilities.GetIcon ("giver-48", 48); // Update the window title this.Title = string.Format ("Giver Preferences"); //this.DefaultSize = new Gdk.Size (300, 500); this.VBox.Spacing = 0; this.VBox.BorderWidth = 0; this.SetDefaultSize (450, 100); this.AddButton(Stock.Close, Gtk.ResponseType.Ok); this.DefaultResponse = ResponseType.Ok; // Start with an event box to paint the background white EventBox eb = new EventBox(); eb.Show(); eb.BorderWidth = 0; eb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255)); eb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255)); VBox mainVBox = new VBox(); mainVBox.BorderWidth = 10; mainVBox.Spacing = 5; mainVBox.Show (); eb.Add(mainVBox); this.VBox.PackStart(eb); Label label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Your Name</span>"; mainVBox.PackStart(label, true, true, 0); // Name Box at the top of the Widget HBox nameBox = new HBox(); nameBox.Show(); nameEntry = new Entry(); nameEntry.Show(); nameBox.PackStart(nameEntry, true, true, 0); nameBox.Spacing = 10; mainVBox.PackStart(nameBox, false, false, 0); label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Your Picture</span>"; mainVBox.PackStart(label, true, true, 0); Gtk.Table table = new Table(4, 3, false); table.Show(); // None Entry noneButton = new RadioButton((Gtk.RadioButton)null); noneButton.Show(); table.Attach(noneButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); VBox vbox = new VBox(); vbox.Show(); Gtk.Image image = new Image(Utilities.GetIcon("computer", 48)); image.Show(); vbox.PackStart(image, false, false, 0); label = new Label("None"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 0 ,1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); table.Attach(vbox, 2,3,1,2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); // Local Entry localButton = new RadioButton(noneButton); localButton.Show(); table.Attach(localButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); localImage = new Image(Utilities.GetIcon("stock_person", 48)); localImage.Show(); vbox.PackStart(localImage, false, false, 0); label = new Label("File"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 1 ,2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); photoButton = new Button("Change Photo"); photoButton.Show(); table.Attach(photoButton, 2,3,1,2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); // Web Entry webButton = new RadioButton(noneButton); webButton.Show(); table.Attach(webButton, 0, 1, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); image = new Image(Utilities.GetIcon("web-browser", 48)); image.Show(); vbox.PackStart(image, false, false, 0); label = new Label("Web Link"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 2 ,3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); webEntry = new Entry(); webEntry.Show(); table.Attach(webEntry, 2,3,2,3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); // Gravatar Entry gravatarButton = new RadioButton(noneButton); gravatarButton.Show(); table.Attach(gravatarButton, 0, 1, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); image = new Image(Utilities.GetIcon("gravatar", 48)); image.Show(); vbox.PackStart(image, false, false, 0); label = new Label("Gravatar"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 3 ,4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); gravatarEntry = new Entry(); gravatarEntry.Show(); table.Attach(gravatarEntry, 2,3,3,4, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); mainVBox.PackStart(table, true, true, 0); label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Your File Location</span>"; mainVBox.PackStart(label, true, true, 0); fileLocationButton = new FileChooserButton("Select storage location", FileChooserAction.SelectFolder); fileLocationButton.Show(); mainVBox.PackStart(fileLocationButton, true, true, 0); table = new Table(2, 3, false); table.Show(); // Port number section label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Port Number</span>"; mainVBox.PackStart(label, true, true, 0); // any port Entry anyPortButton = new RadioButton((Gtk.RadioButton)null); anyPortButton.Show(); table.Attach(anyPortButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); label = new Label (); label.Show (); label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "Any available port"; vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); // fixed port Entry fixedPortButton = new RadioButton(anyPortButton); fixedPortButton.Show(); table.Attach(fixedPortButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); label = new Label (); label.Show (); label.Justify = Gtk.Justification.Left; label.SetAlignment (0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "Use a fixed port"; table.Attach(label, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); portNumberEntry = new Entry(); portNumberEntry.Show(); table.Attach(portNumberEntry, 2, 3, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); mainVBox.PackStart(table, true, true, 0); DeleteEvent += WindowDeleted; }
public RtmPreferencesWidget(RtmBackend backend, IPreferences preferences) : base() { if (backend == null) { throw new ArgumentNullException("backend"); } if (preferences == null) { throw new ArgumentNullException("preferences"); } this.backend = backend; this.preferences = preferences; LoadPreferences(); BorderWidth = 0; // We're using an event box so we can paint the background white EventBox imageEb = new EventBox(); imageEb.BorderWidth = 0; imageEb.ModifyBg(StateType.Normal, new Gdk.Color(255, 255, 255)); imageEb.ModifyBase(StateType.Normal, new Gdk.Color(255, 255, 255)); imageEb.Show(); VBox mainVBox = new VBox(false, 0); mainVBox.BorderWidth = 10; mainVBox.Show(); Add(mainVBox); // Add the rtm logo image = new Gtk.Image(normalPixbuf); image.Show(); //make the dialog box look pretty without hard coding total size and //therefore clipping displays with large fonts. Alignment spacer = new Alignment((float)0.5, 0, 0, 0); spacer.SetPadding(0, 0, 125, 125); spacer.Add(image); spacer.Show(); imageEb.Add(spacer); mainVBox.PackStart(imageEb, true, true, 0); // Status message label statusLabel = new Label(); statusLabel.Justify = Gtk.Justification.Center; statusLabel.Wrap = true; statusLabel.LineWrap = true; statusLabel.Show(); statusLabel.UseMarkup = true; statusLabel.UseUnderline = false; authButton = new LinkButton(Catalog.GetString("Click Here to Connect")); authButton.Clicked += OnAuthButtonClicked; if (isAuthorized) { statusLabel.Text = "\n\n" + Catalog.GetString("You are currently connected"); string userName = preferences.Get(PreferencesKeys.UserNameKey); if (userName != null && userName.Trim() != string.Empty) { statusLabel.Text = "\n\n" + Catalog.GetString("You are currently connected as") + "\n" + userName.Trim(); } } else { statusLabel.Text = "\n\n" + Catalog.GetString("You are not connected"); authButton.Show(); } mainVBox.PackStart(statusLabel, false, false, 0); mainVBox.PackStart(authButton, false, false, 0); Label blankLabel = new Label("\n"); blankLabel.Show(); mainVBox.PackStart(blankLabel, false, false, 0); }
private void Init() { Logger.Debug("Called Init"); this.Icon = Utilities.GetIcon("giver-48", 48); // Update the window title this.Title = string.Format("Giver Preferences"); //this.DefaultSize = new Gdk.Size (300, 500); this.VBox.Spacing = 0; this.VBox.BorderWidth = 0; this.SetDefaultSize(450, 100); this.AddButton(Stock.Close, Gtk.ResponseType.Ok); this.DefaultResponse = ResponseType.Ok; // Start with an event box to paint the background white EventBox eb = new EventBox(); eb.Show(); eb.BorderWidth = 0; eb.ModifyBg(StateType.Normal, new Gdk.Color(255, 255, 255)); eb.ModifyBase(StateType.Normal, new Gdk.Color(255, 255, 255)); VBox mainVBox = new VBox(); mainVBox.BorderWidth = 10; mainVBox.Spacing = 5; mainVBox.Show(); eb.Add(mainVBox); this.VBox.PackStart(eb); Label label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Your Name</span>"; mainVBox.PackStart(label, true, true, 0); // Name Box at the top of the Widget HBox nameBox = new HBox(); nameBox.Show(); nameEntry = new Entry(); nameEntry.Show(); nameBox.PackStart(nameEntry, true, true, 0); nameBox.Spacing = 10; mainVBox.PackStart(nameBox, false, false, 0); label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Your Picture</span>"; mainVBox.PackStart(label, true, true, 0); Gtk.Table table = new Table(4, 3, false); table.Show(); // None Entry noneButton = new RadioButton((Gtk.RadioButton)null); noneButton.Show(); table.Attach(noneButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); VBox vbox = new VBox(); vbox.Show(); Gtk.Image image = new Image(Utilities.GetIcon("computer", 48)); image.Show(); vbox.PackStart(image, false, false, 0); label = new Label("None"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); table.Attach(vbox, 2, 3, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); // Local Entry localButton = new RadioButton(noneButton); localButton.Show(); table.Attach(localButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); localImage = new Image(Utilities.GetIcon("stock_person", 48)); localImage.Show(); vbox.PackStart(localImage, false, false, 0); label = new Label("File"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); photoButton = new Button("Change Photo"); photoButton.Show(); table.Attach(photoButton, 2, 3, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 0); // Web Entry webButton = new RadioButton(noneButton); webButton.Show(); table.Attach(webButton, 0, 1, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); image = new Image(Utilities.GetIcon("web-browser", 48)); image.Show(); vbox.PackStart(image, false, false, 0); label = new Label("Web Link"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); webEntry = new Entry(); webEntry.Show(); table.Attach(webEntry, 2, 3, 2, 3, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); // Gravatar Entry gravatarButton = new RadioButton(noneButton); gravatarButton.Show(); table.Attach(gravatarButton, 0, 1, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); image = new Image(Utilities.GetIcon("gravatar", 48)); image.Show(); vbox.PackStart(image, false, false, 0); label = new Label("Gravatar"); label.Show(); vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); gravatarEntry = new Entry(); gravatarEntry.Show(); table.Attach(gravatarEntry, 2, 3, 3, 4, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); mainVBox.PackStart(table, true, true, 0); label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Your File Location</span>"; mainVBox.PackStart(label, true, true, 0); fileLocationButton = new FileChooserButton("Select storage location", FileChooserAction.SelectFolder); fileLocationButton.Show(); mainVBox.PackStart(fileLocationButton, true, true, 0); table = new Table(2, 3, false); table.Show(); // Port number section label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "<span weight=\"bold\" size=\"large\">Port Number</span>"; mainVBox.PackStart(label, true, true, 0); // any port Entry anyPortButton = new RadioButton((Gtk.RadioButton)null); anyPortButton.Show(); table.Attach(anyPortButton, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); vbox = new VBox(); vbox.Show(); label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "Any available port"; vbox.PackStart(label, false, false, 0); table.Attach(vbox, 1, 2, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); // fixed port Entry fixedPortButton = new RadioButton(anyPortButton); fixedPortButton.Show(); table.Attach(fixedPortButton, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0); label = new Label(); label.Show(); label.Justify = Gtk.Justification.Left; label.SetAlignment(0.0f, 0.5f); label.LineWrap = false; label.UseMarkup = true; label.UseUnderline = false; label.Markup = "Use a fixed port"; table.Attach(label, 1, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); portNumberEntry = new Entry(); portNumberEntry.Show(); table.Attach(portNumberEntry, 2, 3, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Expand | AttachOptions.Fill, 0, 0); mainVBox.PackStart(table, true, true, 0); DeleteEvent += WindowDeleted; }
public RtmPreferencesWidget(RtmBackend backend, IPreferences preferences) : base() { if (backend == null) throw new ArgumentNullException ("backend"); if (preferences == null) throw new ArgumentNullException ("preferences"); this.backend = backend; this.preferences = preferences; LoadPreferences (); BorderWidth = 0; // We're using an event box so we can paint the background white EventBox imageEb = new EventBox (); imageEb.BorderWidth = 0; imageEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255)); imageEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255)); imageEb.Show (); VBox mainVBox = new VBox(false, 0); mainVBox.BorderWidth = 10; mainVBox.Show(); Add(mainVBox); // Add the rtm logo image = new Gtk.Image (normalPixbuf); image.Show(); //make the dialog box look pretty without hard coding total size and //therefore clipping displays with large fonts. Alignment spacer = new Alignment((float)0.5, 0, 0, 0); spacer.SetPadding(0, 0, 125, 125); spacer.Add(image); spacer.Show(); imageEb.Add (spacer); mainVBox.PackStart(imageEb, true, true, 0); // Status message label statusLabel = new Label(); statusLabel.Justify = Gtk.Justification.Center; statusLabel.Wrap = true; statusLabel.LineWrap = true; statusLabel.Show(); statusLabel.UseMarkup = true; statusLabel.UseUnderline = false; authButton = new LinkButton ( #if GETTEXT Catalog.GetString ("Click Here to Connect")); #elif ANDROID #endif authButton.Clicked += OnAuthButtonClicked; if ( isAuthorized ) { statusLabel.Text = "\n\n" + #if GETTEXT Catalog.GetString ("You are currently connected"); #elif ANDROID #endif string userName = preferences.Get (PreferencesKeys.UserNameKey); if (userName != null && userName.Trim () != string.Empty) statusLabel.Text = "\n\n" + #if GETTEXT Catalog.GetString ("You are currently connected as") + #elif ANDROID #endif "\n" + userName.Trim(); } else { statusLabel.Text = "\n\n" + #if GETTEXT Catalog.GetString ("You are not connected"); #elif ANDROID #endif authButton.Show(); } mainVBox.PackStart(statusLabel, false, false, 0); mainVBox.PackStart(authButton, false, false, 0); Label blankLabel = new Label("\n"); blankLabel.Show(); mainVBox.PackStart(blankLabel, false, false, 0); }
///<summary> /// InitWindow /// Sets up the widgets and events in the chat window ///</summary> void InitWindow() { this.Icon = Utilities.GetIcon ("giver-48", 48); // Update the window title Title = string.Format ("Giver Recipients"); this.DefaultSize = new Gdk.Size (300, 500); // Start with an event box to paint the background white EventBox eb = new EventBox(); eb.BorderWidth = 0; eb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255)); eb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255)); VBox mainVBox = new VBox(); mainVBox.BorderWidth = 0; mainVBox.Show (); eb.Add(mainVBox); this.Add (eb); scrolledWindow = new ScrolledWindow (); scrolledWindow.VscrollbarPolicy = PolicyType.Automatic; scrolledWindow.HscrollbarPolicy = PolicyType.Never; //scrolledWindow.ShadowType = ShadowType.None; scrolledWindow.BorderWidth = 0; scrolledWindow.CanFocus = true; scrolledWindow.Show (); mainVBox.PackStart (scrolledWindow, true, true, 0); // Add a second Event box in the scrolled window so it will also be white EventBox innerEb = new EventBox(); innerEb.BorderWidth = 0; innerEb.ModifyBg(StateType.Normal, new Gdk.Color(255,255,255)); innerEb.ModifyBase(StateType.Normal, new Gdk.Color(255,255,255)); targetVBox = new VBox(); targetVBox.BorderWidth = 0; targetVBox.Show (); innerEb.Add(targetVBox); scrolledWindow.AddWithViewport(innerEb); //mainVBox.PackStart (targetVBox, false, false, 0); manualTarget = new TargetService(); manualTarget.Show (); mainVBox.PackStart(manualTarget, false, false, 0); Shown += OnWindowShown; DeleteEvent += WindowDeleted; Application.Instance.TransferStarted += TransferStartedHandler; }
void InitWindow() { int height; int width; this.Icon = Utilities.GetIcon ("tasque-48", 48); // Update the window title Title = string.Format ("Tasque"); width = GtkApplication.Instance.Preferences.GetInt("MainWindowWidth"); height = GtkApplication.Instance.Preferences.GetInt("MainWindowHeight"); if(width == -1) width = 600; if(height == -1) height = 600; this.DefaultSize = new Gdk.Size( width, height); accelGroup = new AccelGroup (); AddAccelGroup (accelGroup); globalKeys = new GlobalKeybinder (accelGroup); VBox mainVBox = new VBox(); mainVBox.BorderWidth = 0; mainVBox.Show (); this.Add (mainVBox); HBox topHBox = new HBox (false, 0); topHBox.BorderWidth = 4; categoryComboBox = new ComboBox (); categoryComboBox.Accessible.Description = "Category Selection"; categoryComboBox.WidthRequest = 150; categoryComboBox.WrapWidth = 1; categoryComboBox.Sensitive = false; CellRendererText comboBoxRenderer = new Gtk.CellRendererText (); comboBoxRenderer.WidthChars = 20; comboBoxRenderer.Ellipsize = Pango.EllipsizeMode.End; categoryComboBox.PackStart (comboBoxRenderer, true); categoryComboBox.SetCellDataFunc (comboBoxRenderer, new Gtk.CellLayoutDataFunc (CategoryComboBoxDataFunc)); categoryComboBox.Show (); topHBox.PackStart (categoryComboBox, false, false, 0); // Space the addTaskButton and the categoryComboBox // far apart by using a blank label that expands Label spacer = new Label (string.Empty); spacer.Show (); topHBox.PackStart (spacer, true, true, 0); // The new task entry widget addTaskEntry = new Entry (Catalog.GetString ("New task...")); addTaskEntry.Sensitive = false; addTaskEntry.Focused += OnAddTaskEntryFocused; addTaskEntry.Changed += OnAddTaskEntryChanged; addTaskEntry.Activated += OnAddTaskEntryActivated; addTaskEntry.FocusInEvent += OnAddTaskEntryFocused; addTaskEntry.FocusOutEvent += OnAddTaskEntryUnfocused; addTaskEntry.DragDataReceived += OnAddTaskEntryDragDataReceived; addTaskEntry.Show (); topHBox.PackStart (addTaskEntry, true, true, 0); // Use a small add icon so the button isn't mammoth-sized HBox buttonHBox = new HBox (false, 6); Gtk.Image addImage = new Gtk.Image (Gtk.Stock.Add, IconSize.Menu); addImage.Show (); buttonHBox.PackStart (addImage, false, false, 0); Label l = new Label (Catalog.GetString ("_Add")); l.Show (); buttonHBox.PackStart (l, true, true, 0); buttonHBox.Show (); addTaskButton = new MenuToolButton (buttonHBox, Catalog.GetString ("_Add Task")); addTaskButton.UseUnderline = true; // Disactivate the button until the backend is initialized addTaskButton.Sensitive = false; Gtk.Menu addTaskMenu = new Gtk.Menu (); addTaskButton.Menu = addTaskMenu; addTaskButton.Clicked += OnAddTask; addTaskButton.Show (); topHBox.PackStart (addTaskButton, false, false, 0); globalKeys.AddAccelerator (OnGrabEntryFocus, (uint) Gdk.Key.n, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); globalKeys.AddAccelerator (delegate (object sender, EventArgs e) { GtkApplication.Instance.Quit (); }, (uint) Gdk.Key.q, Gdk.ModifierType.ControlMask, Gtk.AccelFlags.Visible); this.KeyPressEvent += KeyPressed; topHBox.Show (); mainVBox.PackStart (topHBox, false, false, 0); scrolledWindow = new ScrolledWindow (); scrolledWindow.VscrollbarPolicy = PolicyType.Automatic; scrolledWindow.HscrollbarPolicy = PolicyType.Never; scrolledWindow.BorderWidth = 0; scrolledWindow.CanFocus = true; scrolledWindow.Show (); mainVBox.PackStart (scrolledWindow, true, true, 0); innerEb = new EventBox(); innerEb.BorderWidth = 0; Gdk.Color backgroundColor = GetBackgroundColor (); innerEb.ModifyBg (StateType.Normal, backgroundColor); innerEb.ModifyBase (StateType.Normal, backgroundColor); targetVBox = new VBox(); targetVBox.BorderWidth = 5; targetVBox.Show (); innerEb.Add(targetVBox); scrolledWindow.AddWithViewport(innerEb); statusbar = new Gtk.Statusbar (); statusbar.HasResizeGrip = true; statusbar.Show (); mainVBox.PackEnd (statusbar, false, false, 0); // // Delay adding in the TaskGroups until the backend is initialized // Shown += OnWindowShown; DeleteEvent += WindowDeleted; backend.BackendInitialized += OnBackendInitialized; backend.BackendSyncStarted += OnBackendSyncStarted; backend.BackendSyncFinished += OnBackendSyncFinished; // if the backend is already initialized, go ahead... initialize if(backend.Initialized) { OnBackendInitialized(null, null); } GtkApplication.Instance.Preferences.SettingChanged += OnSettingChanged; }
public ForumView(Forum site, String forum) { this.site = site; this.forum = forum; this.Destroyed += delegate(object sender, EventArgs e) { if (iconThread != null) if (iconThread.IsAlive) iconThread.Abort (); }; topicWindow = new ScrolledWindow (); topicWindow.ShadowType = ShadowType.EtchedIn; topicWindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); treeviewTopics = new TreeView (); treeviewTopics.BorderWidth = 0; treeviewTopics.AppendColumn ("", new CellRendererPixbuf (), "pixbuf", 5); CellRendererText cellTopic = new CellRendererText (); TreeViewColumn topicCol = treeviewTopics.AppendColumn ("Topic", cellTopic, "text", 1); topicCol.SetCellDataFunc (cellTopic, new Gtk.TreeCellDataFunc (renderTopic)); topicCol.Resizable = true; treeviewTopics.AppendColumn ("Author", new CellRendererText (), "text", 2).Resizable = true; ; treeviewTopics.AppendColumn ("Replies", new CellRendererText (), "text", 3).Resizable = true; ; treeviewTopics.AppendColumn ("Last Reply", new CellRendererText (), "text", 4).Resizable = true; ; // Use treeView.Selection.Changed? treeviewTopics.RowActivated += treeviewTopics_RowActivated; treeviewTopics.ButtonPressEvent += treeviewTopics_ButtonPress; topicWindow.Add (treeviewTopics); this.Add1 (topicWindow); contentBox = new VBox (false, 0); Toolbar toolbar = new Toolbar (); toolbar.HeightRequest = 38; toolbar.ToolbarStyle = ToolbarStyle.Icons; toolbar.BorderWidth = 0; firstbtn = new ToolButton (Stock.GotoFirst); firstbtn.TooltipText = "First page"; firstbtn.Sensitive = false; firstbtn.Clicked += firstbtn_Clicked; prevbtn = new ToolButton (Stock.GoBack); prevbtn.TooltipText = "Previous page"; prevbtn.Sensitive = false; prevbtn.Clicked += prevbtn_Clicked; nextbtn = new ToolButton (Stock.GoForward); nextbtn.TooltipText = "Next page"; nextbtn.Sensitive = false; nextbtn.Clicked += nextbtn_Clicked; lastbtn = new ToolButton (Stock.GotoLast); lastbtn.TooltipText = "Last page"; lastbtn.Sensitive = false; lastbtn.Clicked += lastbtn_Clicked; Image tmpimage = new Image (); tmpimage.Pixbuf = new Gdk.Pixbuf (".images/icon_up.png"); upbtn = new ToolButton (tmpimage, ""); upbtn.TooltipText = "Expand view to top"; upbtn.Clicked += upbtn_Clicked; Image tmpimage2 = new Image (); tmpimage2.Pixbuf = new Gdk.Pixbuf (".images/icon_down.png"); downbtn = new ToolButton (tmpimage2, ""); downbtn.TooltipText = "Split view"; downbtn.Clicked += downbtn_Clicked; closebtn = new ToolButton (Stock.Close); closebtn.TooltipText = "Close image view"; closebtn.Clicked += closebtn_Clicked; Image tmpimage3 = new Image (); tmpimage3.Pixbuf = new Gdk.Pixbuf (".images/rotate_16.png"); rotatebtn = new ToolButton (tmpimage3, ""); rotatebtn.TooltipText = "Rotate image clockwise"; rotatebtn.Clicked += rotatebtn_Clicked; Image tmpimage4 = new Image (); tmpimage4.Pixbuf = new Gdk.Pixbuf (".images/icon_save.png"); savebtn = new ToolButton (tmpimage4, ""); savebtn.TooltipText = "Download image"; savebtn.Clicked += savebtn_Clicked; pageLabel = new Label (""); ToolItem textItem = new ToolItem (); textItem.Expand = false; textItem.Add (pageLabel); imageviewbtn = new ToggleToolButton (Stock.ZoomFit); imageviewbtn.TooltipText = "Image view"; imageviewbtn.Toggled += imageviewbtn_Toggled; textviewbtn = new ToggleToolButton (Stock.Properties); textviewbtn.TooltipText = "Thread view"; textviewbtn.Active = true; textviewbtn.Toggled += textviewbtn_Toggled; SeparatorToolItem sepSpacer = new SeparatorToolItem (); sepSpacer.Expand = true; sepSpacer.Draw = false; sepFullsize = new SeparatorToolItem (); imageSortAscending = new ToggleToolButton (Stock.SortAscending); imageSortAscending.TooltipText = "Show earliest images first"; imageSortAscending.Active = true; imageSortAscending.Toggled += imageSortAscending_Toggled; imageSortDescending = new ToggleToolButton (Stock.SortDescending); imageSortDescending.TooltipText = "Show latest images first"; imageSortDescending.Toggled += imageSortDescending_Toggled; imageLoadingProgress = new ProgressBar (); ToolItem progressItem = new ToolItem (); progressItem.Expand = false; progressItem.Add (imageLoadingProgress); imageLoadingProgress.Fraction = 0; toolbar.Add (imageSortAscending); toolbar.Add (imageSortDescending); toolbar.Add (progressItem); toolbar.Add (firstbtn); toolbar.Add (prevbtn); toolbar.Add (textItem); toolbar.Add (nextbtn); toolbar.Add (lastbtn); toolbar.Add (sepFullsize); toolbar.Add (savebtn); toolbar.Add (rotatebtn); toolbar.Add (sepSpacer); toolbar.Add (imageviewbtn); toolbar.Add (textviewbtn); toolbar.Add (closebtn); toolbar.Add (upbtn); toolbar.Add (downbtn); threadwindow = new ScrolledWindow (); threadbrowser = new WebView (); threadbrowser.Editable = false; threadbrowser.NavigationRequested += threadbrowser_NavigationRequested; threadwindow.Add (threadbrowser); iconStore = new ListStore (typeof(string), typeof(Gdk.Pixbuf), typeof(string), typeof(string), typeof(int), typeof(int)); iconview = new IconView (iconStore); iconview.Margin = 1; iconview.Spacing = 1; iconview.BorderWidth = 0; iconview.ColumnSpacing = 1; iconview.RowSpacing = 1; iconview.PixbufColumn = 1; iconview.TooltipColumn = 2; iconview.SelectionMode = SelectionMode.Multiple; iconview.ItemActivated += iconview_ItemActivated; iconview.ButtonPressEvent += iconView_ButtonPress; iconview.Model = iconStore; iconview.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66)); iconwindow = new ScrolledWindow (); iconwindow.ShadowType = ShadowType.EtchedIn; iconwindow.SetPolicy (PolicyType.Automatic, PolicyType.Automatic); iconwindow.Add (iconview); imagewindow = new EventBox (); fullSizeImage = new Image (); // JICE TEST fullsizeLayout = new Layout (null, null); fullsizeLayout.Add (fullSizeImage); fullsizeLayout.SizeRequested += fullsizeLayout_SizeRequested; imagewindow.ModifyBase (StateType.Normal, new Gdk.Color (0x66, 0x66, 0x66)); imagewindow.Add (fullsizeLayout); imagewindow.CanFocus = true; imagewindow.KeyPressEvent += imagewindow_keyPressEvent; imagewindow.SizeRequested += imagewindow_sizeAllocated; // imagewindow.Add(fullSizeImage); contentBox.PackStart (toolbar, false, false, 0); contentBox.PackStart (iconwindow); contentBox.PackStart (imagewindow); contentBox.PackStart (threadwindow); this.Add2 (contentBox); this.ShowAll (); imageSortAscending.Hide (); imageSortDescending.Hide (); iconwindow.Hide (); imagewindow.Hide (); closebtn.Hide (); rotatebtn.Hide (); savebtn.Hide (); sepFullsize.Hide (); downbtn.Hide (); imageLoadingProgress.Hide (); String favouriteThreads = UserSettings.getValue ("Site" + site.forumName + ".Forum" + forum + ".Favourites"); favThreads = favouriteThreads.Split (';'); treestoreTopics = new TreeStore (typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(Gdk.Pixbuf)); topicsLoaded = 0; loadTopics (); treeviewTopics.Model = treestoreTopics; }