Re: gtkmm : program without a main window



В Чтв, 13/03/2008 в 06:54 +0100, Helfer Thomas пишет:
> gtkmm seems to require a call to Gtk::Main::run.
> 
> I am coding a little gnuplot-like program. The main interface will be <<
> text based >> using readline. My (probably very basic) question is how
> to make a call to Gtk::Main::run and still be able to enter some command
> interactively.
> 
> To make my question clearer, the following code does nothing because
> Gtk::Main::run is blocking.
> 
> #include<iostream>
> #include<cstdlib>
> #include<limits>
> 
> #include<gtkmm.h>
> 
> int
> main(int argc,
>      char** argv)
> {
>   using namespace std;
>   Gtk::Main kit(argc, argv);
>   Gtk::Main::run(); //< This is blocking !
>   std::string line;
>   getline(cin,line);
>   while(1){
>     if(line=="plot"){
>     //      doplot()
>     }
>     if(line=="quit"){
>       exit(-1);
>     }
>     getline(cin,line);
>   }
>   return EXIT_SUCCESS;
> }
> 
> I am seeking the most appropriate way to do this. Any help would be
> appreciated.

1) You should not use Gtk::Main::run(), but organize MAIN LOOP yourself.

2) Use Gtk widget (Gtk::Entry, Gtk::TextView) or terminal emulation to
enter commands.

-andrew




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]