Ejemplo n.º 1
0
		// Fallback to the original GNOME Print API.
		public static void Print (string html) 
		{
			string caption = "Monodoc Printing";

			Gnome.PrintJob pj = new Gnome.PrintJob (PrintConfig.Default ());
			PrintDialog dialog = new PrintDialog (pj, caption, 0);

			Gtk.HTML gtk_html = new Gtk.HTML (html);
			gtk_html.PrintSetMaster (pj);
			
			Gnome.PrintContext ctx = pj.Context;
			gtk_html.Print (ctx);

			pj.Close ();

			// hello user
			int response = dialog.Run ();
		
			if (response == (int) PrintButtons.Cancel) {
				dialog.Hide ();
				dialog.Destroy ();
				return;
			} else if (response == (int) PrintButtons.Print) {
				pj.Print ();
			} else if (response == (int) PrintButtons.Preview) {
				new PrintJobPreview (pj, caption).Show ();
			}
		
			ctx.Close ();
			dialog.Hide ();
			dialog.Destroy ();
		}
Ejemplo n.º 2
0
Archivo: GMan.cs Proyecto: pombreda/enh
    public GMan()
    {
        Application.Init();

        window = new Gtk.Window("GMan");
        window.SetDefaultSize(800, 600);
        window.DeleteEvent += new DeleteEventHandler(OnWindowDelete);
        // FIXME: we should remember where we were when we last ran.
        window.WindowPosition = WindowPosition.Center;

        VBox vbox = new VBox(false, 2);

        window.Add(vbox);

        vbox.PackStart(MakeMenuBar(), false, false, 1);

        HBox hbox = new HBox(false, 1);

        Label label = new Label("Search:");

        entry            = new Gtk.Entry("");
        entry.Activated += new EventHandler(OnEntryActivated);

        Button button = new Button("!");

        button.Clicked += new EventHandler(OnButtonClicked);

        Button backButton    = new Button(Stock.GoBack);
        Button forwardButton = new Button(Stock.GoForward);

        hbox.PackStart(backButton, false, false, 1);
        hbox.PackStart(forwardButton, false, false, 1);
        hbox.PackStart(label, false, false, 1);
        hbox.PackStart(entry, true, true, 1);
        hbox.PackStart(button, false, false, 1);

        vbox.PackStart(hbox, false, false, 1);

        ScrolledWindow sw = new ScrolledWindow();

        sw.VscrollbarPolicy = PolicyType.Always;
        sw.HscrollbarPolicy = PolicyType.Always;
        vbox.PackStart(sw, true, true, 1);

        statusBar = new Gtk.Statusbar();
        vbox.PackStart(statusBar, false, false, 1);

        html               = new HTML();
        html.LinkClicked  += new LinkClickedHandler(OnLinkClicked);
        html.OnUrl        += new OnUrlHandler(OnOnUrl);
        html.TitleChanged += new TitleChangedHandler(OnTitleChanged);
        sw.Add(html);

        window.ShowAll();
        entry.GrabFocus();
        Application.Run();
    }
Ejemplo n.º 3
0
        // Fallback to the original GNOME Print API.
        public static void Print(string html)
        {
            string caption = "Monodoc Printing";

            Gnome.PrintJob pj     = new Gnome.PrintJob(PrintConfig.Default());
            PrintDialog    dialog = new PrintDialog(pj, caption, 0);

            Gtk.HTML gtk_html = new Gtk.HTML(html);
            gtk_html.PrintSetMaster(pj);

            Gnome.PrintContext ctx = pj.Context;
            gtk_html.Print(ctx);

            pj.Close();

            // hello user
            int response = dialog.Run();

            if (response == (int)PrintButtons.Cancel)
            {
                dialog.Hide();
                dialog.Destroy();
                return;
            }
            else if (response == (int)PrintButtons.Print)
            {
                pj.Print();
            }
            else if (response == (int)PrintButtons.Preview)
            {
                new PrintJobPreview(pj, caption).Show();
            }

            ctx.Close();
            dialog.Hide();
            dialog.Destroy();
        }
Ejemplo n.º 4
0
    public GMan()
    {
        Application.Init();

        window = new Gtk.Window("GMan");
        window.SetDefaultSize(800, 600);
        window.DeleteEvent += new DeleteEventHandler(OnWindowDelete);
        // FIXME: we should remember where we were when we last ran.
        window.WindowPosition = WindowPosition.Center;

        VBox vbox = new VBox(false, 2);
        window.Add(vbox);

        vbox.PackStart(MakeMenuBar(), false, false, 1);

        HBox hbox = new HBox(false, 1);

        Label label = new Label("Search:");

        entry = new Gtk.Entry("");
        entry.Activated += new EventHandler(OnEntryActivated);

        Button button = new Button("!");
        button.Clicked += new EventHandler(OnButtonClicked);

        Button backButton = new Button(Stock.GoBack);
        Button forwardButton = new Button(Stock.GoForward);

        hbox.PackStart(backButton, false, false, 1);
        hbox.PackStart(forwardButton, false, false, 1);
        hbox.PackStart(label, false, false, 1);
        hbox.PackStart(entry, true, true, 1);
        hbox.PackStart(button, false, false, 1);

        vbox.PackStart(hbox, false, false, 1);

        ScrolledWindow sw = new ScrolledWindow();
        sw.VscrollbarPolicy = PolicyType.Always;
        sw.HscrollbarPolicy = PolicyType.Always;
        vbox.PackStart(sw, true, true, 1);

        statusBar = new Gtk.Statusbar();
        vbox.PackStart(statusBar, false, false, 1);

        html = new HTML();
        html.LinkClicked += new LinkClickedHandler(OnLinkClicked);
        html.OnUrl += new OnUrlHandler(OnOnUrl);
        html.TitleChanged += new TitleChangedHandler(OnTitleChanged);
        sw.Add(html);

        window.ShowAll();
        entry.GrabFocus();
        Application.Run();
    }