summaryrefslogtreecommitdiffstats
path: root/vmchooser/inc/SWindow.h
blob: 845e72d068a89a1d00a46b04a05b64206fe8fae3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

#ifndef SWindow_h
#define SWindow_h

#include <fltk/Window.h>
#include <fltk/ReturnButton.h>
#include <fltk/Browser.h>
#include <fltk/Font.h>
//#include <fltk/TextDisplay.h>
#include <fltk/ItemGroup.h>
#include <fltk/Item.h>
#include <fltk/SharedImage.h>
#include <fltk/Image.h>
#include <fltk/xpmImage.h>


#include "DataEntry.h"
#include "functions.h"
#include <map>
#include <unistd.h>
#include <iostream>

class SWindow : public fltk::Window {

private:
  // ReturnButton to start the session
  fltk::ReturnButton go;

  // Button to exit
  fltk::Button exit_btn;

  // Browser to select sessions
  fltk::Browser sel;

  // currently selected Browser-Item
  fltk::Item* curr;
  fltk::Item* oldcurr;

  // Two groups - Linux and VMWare
  fltk::ItemGroup* entgroup;
  fltk::ItemGroup* lin_entgroup;

  // Arrays with data from .xml and .desktop files
  DataEntry** ent;
  DataEntry** lin_ent;


  int width;
  int height;




  /**
   * ctor with some reasonable default values
   */
  //SWindow(char* p = "Choose your session!");
  SWindow(int w, int h, char* p = (char *) "Choose your session!");

public:
  static SWindow* getInstance(int w, int h) {
    static SWindow instance(w,h);
    return &instance;
  }


  int pathsize;
  char* pname; /* Holds the current absolute path */

  ~SWindow() { };

  static void cb_return(fltk::Widget*, void* w) {
    ((SWindow*)w)->cb_return();
  };
  static void cb_select(fltk::Widget*, void* w) {
    ((SWindow*)w)->cb_select();
  };

  static void cb_exit(fltk::Widget*, void* w) {
    exit(0);
  }

  void cb_return();
  void cb_select();

  void set_entries(DataEntry** ent);
  void set_lin_entries(DataEntry** ent);

  const char** get_symbol(DataEntry* dat);

  void free_entries();
  void unfold_entries(bool,bool,char* defsession=0);

  void sort_entries();

};


#endif