Add() public method

public Add ( Widget w ) : void
w Widget
return void
Ejemplo n.º 1
0
	static Frame SetupStatus ()
	{
		Frame fstatus = new Frame ("Status");
		int y = 0;
		int x = 13;
		string init = "<init>";
		
		fstatus.Add (status_progress = new Label (x, y, "0%"));
		status_progress.Color = status_progress.ColorHotNormal;
		fstatus.Add (new Label (1, y++, "Progress:"));
		
		fstatus.Add (status_state = new Label (x, y, init));
		fstatus.Add (new Label (1, y++, "State:"));

		fstatus.Add (status_peers = new Label (x, y, init));
		fstatus.Add (new Label (1, y++, "Peers:"));

		fstatus.Add (status_tracker = new Label (x, y, init));
		fstatus.Add (new Label (1, y++, "Tracker: "));
		y++;

		fstatus.Add (new Label (1, y++, "Upload:"));
		fstatus.Add (new Label (16, y, "KB   Speed: "));
		fstatus.Add (status_up = new Label (1, y, init));
		fstatus.Add (status_up_speed = new Label (28, y, init));
		y++;
		fstatus.Add (new Label (1, y++, "Download:"));
		fstatus.Add (new Label (16, y, "KB   Speed: "));
		fstatus.Add (status_down = new Label (1, y, init));
		fstatus.Add (status_down_speed = new Label (28, y, init));
		y += 2;
		fstatus.Add (status_warnings = new Label (11, y, init));
		fstatus.Add (new Label (1, y++, "Warnings: "));
		fstatus.Add (status_failures = new Label (11, y, init));
		fstatus.Add (new Label (1, y++, "Failures: "));
		y += 2;

		return fstatus;
	}
Ejemplo n.º 2
0
	static void RunGui ()
	{
		Container a = new Container (0, 0, Application.Cols, Application.Lines);

		Frame ftorrents = new Frame (0,  0, 0, 0, "Torrents");
		a.Add (ftorrents);

		// Add
		Button badd = new Button (1, 1, "Add");
		badd.Clicked += delegate { AddDialog (); };
		ftorrents.Add (badd);

		// Options
		Button boptions = new Button (9, 1, "Options");
		boptions.Clicked += delegate { OptionsDialog (); };
		ftorrents.Add (boptions);

		// Quit
		Button bquit = new Button (21, 1, "Quit");
		bquit.Clicked += delegate {
			// FIXME: shut down torrent here
			a.Running = false;
		};
		ftorrents.Add (bquit);
		
		// Random widget tests
		//f.Add (new Label (7,  3, "Name:"));
		//f.Add (new Entry (13, 3, 20, "First"));
		
		//f.Add (new Label (4,  5, "Address:"));
		//f.Add (new Entry (13, 5, 20, "Second"));

		ListView ltorrents = new ListView (1, 5, 0, 0, torrent_list);
		ltorrents.Fill = Fill.Horizontal | Fill.Vertical;
		ftorrents.Add (ltorrents);
		
		Frame fprogress = new Frame ("Messages");
		fprogress.Add (log_widget = new LogWidget (0, 0));
		a.Add (fprogress);

		// For testing focus, not ready
		//f.Add (new Label (0, 0, "->0<-"));
		//f.Add (new Entry  (7, 0, 20, "Another"));


		// Details
		Frame fdetails = new Frame ("Details");
		fdetails.Add (new Label (1, 1, "Files for: "));
		torrent_name = new TrimLabel (12, 1, 10, "");
		torrent_name.Fill = Fill.Horizontal;
		fdetails.Add (torrent_name);
			      
		details_list = new TorrentDetailsList ();
		list_details = new ListView (1, 3, 0, 0, details_list);
		list_details.Fill = Fill.Horizontal | Fill.Vertical;
		fdetails.Add (list_details);
		
		a.Add (fdetails);

		// Status
		Frame fstatus = SetupStatus ();
		a.Add (fstatus);

		iteration = new Label (35, 0, "0");
		fstatus.Add (iteration);
		
		Application.Timeout = 1000;

		Application.Iteration += delegate {
			iteration.Text = (it++).ToString ();
			UpdateStatus ();
			lock (queue){
				if (queue.Count > 0){
					foreach (string s in queue){
						log_widget.AddText (s);
					}
					queue.Clear ();
				}
			}
			Application.Refresh ();
		};
		
		LayoutDialogs (ftorrents, fstatus, fdetails, fprogress);
		a.SizeChangedEvent += delegate {
			LayoutDialogs (ftorrents, fstatus, fdetails, fprogress);
		};

		UpdateStatus ();
		Application.Run (a);
	}
Ejemplo n.º 3
0
    static void RunCUI()
    {
        Container a = new Container (0, 0, Application.Cols, Application.Lines);

        Frame fMain = new Frame(0, 0, 0, 0, "zerob0t");
        Frame fHighA = new Frame(0, 0, 0, 0, "fHighA");
        Frame fHighB = new Frame(0, 0, 0, 0, "fHighB");
        Frame fHighLR = new Frame(0, 0, 0, 0, "Info");
        Frame fHighSR = new Frame(0, 0, 0, 0, "fHighSR");

        a.Add(fMain);
        a.Add(fHighA);
        a.Add(fHighB);
        a.Add(fHighLR);
        a.Add(fHighSR);

        Button bQuit = new Button(1, 1, "Quit");
        bQuit.Clicked += delegate {
            a.Running = false;
        };
        fMain.Add(bQuit);

        // Final setup details
        // GUI.cs Colors:
        // 0:	Black
        // 1:
        // 2:
        // 3:
        // 4:
        // 5:
        // 6:
        // 7:
        // 8:
        // 9:
        // 10:
        // 11:
        // 12:
        // 13:
        // 14:
        // 15:

        // ColorBasic is
        //	Application.ColorBasic = 3585;

        // ColorDialogFocus is
        //	Application.ColorDialogFocus = 0;

        // ColorDialogHotFocus is
        //	Application.ColorDialogHotFocus = 0;

        //	Application.ColorDialogHotNormal = 0;

        // ColorDialogNormal is label background color
        //	Application.ColorDialogNormal = 0;

        //	Application.ColorError = 0;

        // ColorFocus is background of whatever widget has focus
        //	Application.ColorFocus = 0;

        //	Application.ColorNormal = 0;

        LayoutDialogs(fMain, fHighA, fHighB, fHighLR, fHighSR);

        Application.Timeout = 1000;
        Application.Iteration += delegate {
            Application.Refresh();
        };

        a.SizeChangedEvent += delegate {
            LayoutDialogs(fMain, fHighA, fHighB, fHighLR, fHighSR);
        };
        Application.Run(a);
    }