stamen

Stamen - static menu generator
git clone git://git.dimitrijedobrota.com/stamen.git
Log | Files | Refs | README | LICENSE

dynamic.cpp (739B)


      1 #include <iostream>
      2 
      3 #include "menu.hpp"
      4 
      5 int finish(int) { exit(1); }
      6 
      7 int operation1(int) {
      8     std::cout << "1" << std::endl;
      9     return 1;
     10 }
     11 
     12 int operation2(int) {
     13     std::cout << "2" << std::endl;
     14     return 1;
     15 }
     16 
     17 int operation3(int) {
     18     std::cout << "3" << std::endl;
     19     return 1;
     20 }
     21 
     22 int main() {
     23     // read the configuration
     24     stamen::menu::read("./bin/demo_menu.conf");
     25 
     26     // register free functions
     27     stamen::menu::insert("finish", finish);
     28     stamen::menu::insert("operation1", operation1);
     29     stamen::menu::insert("operation2", operation2);
     30     stamen::menu::insert("operation3", operation3);
     31 
     32     // start the menu on specific panel
     33     stamen::menu::dynamic("menu_main", stamen::builtin_display);
     34     return 0;
     35 }