Widget arrangement

IC-7410 Rig Control Program (C++ version)_043

If you prefer to keep your code simple, it might be difficult to arrange the widgets optimally.

int main(int argc, char *argv[]) {
	vector <Sound*> slist;
	SoundIC7410 s1{argv[1]};
	SoundSoft66 s2{argv[2]};
	slist.push_back(&s1);
	slist.push_back(&s2);

	vector <Rig*> rlist;
	RigIC7410 r1{argv[3]};
	RigSoft66 r2{nullptr};
	rlist.push_back(&r1);
	rlist.push_back(&r2);

	int argc_dummy = 1; /* to ignore argv[>=1] */
	auto app = Gtk::Application::create(argc_dummy, argv, "app.id");
	MyWindow win(slist, rlist);
	return app->run(win);
}
MyWindow::MyWindow(const vector <Sound*> &slist, const vector <Rig*> &rlist) {

	set_title("IC-7410 Rig Control Program (C++ version)");
	set_size_request(1610, 900);

	for(auto r : rlist) {
		myvbox.pack_start( *(new MyDrawingAreaR{r}), FALSE, FALSE, 0);
	}

	for(auto s : slist) {
		myvbox.pack_start( *(new MyDrawingAreaS{s}), FALSE, FALSE, 0);
	}

	add(myvbox);
	show_all();
}

The code looks nice and simple, but the obtained graphical user interface is not very elegant.

Leave a Reply

Your email address will not be published. Required fields are marked *