RE: [gtkmm] Gtk::Image



Citerar "" <Murray Cumming Comneon com>:
> > From: Silviu D Minut [mailto:minutsil cse msu edu] 
> > Do you have an example?
> 
> If there isn't one in the examples directory, then there is certainly one in
> the demo.

Well, I made one anyway. As you can see, it's really not that hard.

/Fredrik Arnerup

-----------------------
// Gtk::Image example by Fredrik Arnerup (e97_far e kth se)
// build with
// g++ -o imageexample imageexample.cc $(pkg-config --cflags --libs gtkmm-2.0)
#include <gtkmm.h>
#include <iostream>

class Window: public Gtk::Window {
public:
  Window(const std::string &filename) {
    set_title(filename);
    add(*manage(new Gtk::Image(filename)));
    show_all();
  }
};

int main(int argc, char **argv) {
  if(argc == 2) {
    Gtk::Main kit(argc, argv);
    Window window(argv[1]);
    Gtk::Main::run(window);
  } else std::cerr << "usage: " << argv[0] << " imagefile" << std::endl;
  return 0;
}



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