// generated by Extended Fast Light User Interface Designer (eFluid) version 2.0003

#ifndef _SCICALC_H_
#define _SCICALC_H_

#include <efltk/Fl.h>
#include <efltk/Fl_Window.h>
#include <efltk/Fl_Box.h>
#include <efltk/Fl_Group.h>
#include <efltk/Fl_Button.h>


class SciCalc  {
  enum {MaxNumBrkts=10};
  enum Operator {PLUS,MINUS,MULT,DIV,POW,INVPOW,EVAL};
  enum mode {NONE=0,DOT=-1,NORM=-2,EXP=-3};
  double value[4*(MaxNumBrkts+1)];
  int priority[6];
  int oper[3*(MaxNumBrkts+1)];
  int top;
  int startbrkt[(MaxNumBrkts+1)];
  int currentbrkt;
  double mem;
  int ready;
  int dot;
  double diver;
  int behind;
  int inv;
  int emode;
  int exponent;
  double mantissa;
  int base;
  int drgmode;
public:
  SciCalc();
private:
  Fl_Window *win;
    Fl_Box *leddisplay;
    inline void cb_leddisplay_i(Fl_Box*, void*);
    static void cb_leddisplay(Fl_Box*, void*);
    Fl_Box *box_DEGRAD;
    inline void cb_box_DEGRAD_i(Fl_Box*, void*);
    static void cb_box_DEGRAD(Fl_Box*, void*);
    Fl_Box *box_bracket;
    Fl_Box *box_M;
    inline void cb_box_M_i(Fl_Box*, void*);
    static void cb_box_M(Fl_Box*, void*);
      Fl_Button *radio_2;
      inline void cb_radio_2_i(Fl_Button*, void*);
      static void cb_radio_2(Fl_Button*, void*);
      Fl_Button *radio_8;
      inline void cb_radio_8_i(Fl_Button*, void*);
      static void cb_radio_8(Fl_Button*, void*);
      Fl_Button *radio_10;
      inline void cb_radio_10_i(Fl_Button*, void*);
      static void cb_radio_10(Fl_Button*, void*);
      Fl_Button *radio_16;
      inline void cb_radio_16_i(Fl_Button*, void*);
      static void cb_radio_16(Fl_Button*, void*);
      Fl_Button *but_7;
      inline void cb_but_7_i(Fl_Button*, void*);
      static void cb_but_7(Fl_Button*, void*);
      Fl_Button *but_8;
      inline void cb_but_8_i(Fl_Button*, void*);
      static void cb_but_8(Fl_Button*, void*);
      Fl_Button *but_9;
      inline void cb_but_9_i(Fl_Button*, void*);
      static void cb_but_9(Fl_Button*, void*);
      Fl_Button *but_4;
      inline void cb_but_4_i(Fl_Button*, void*);
      static void cb_but_4(Fl_Button*, void*);
      Fl_Button *but_5;
      inline void cb_but_5_i(Fl_Button*, void*);
      static void cb_but_5(Fl_Button*, void*);
      Fl_Button *but_6;
      inline void cb_but_6_i(Fl_Button*, void*);
      static void cb_but_6(Fl_Button*, void*);
      Fl_Button *but_1;
      inline void cb_but_1_i(Fl_Button*, void*);
      static void cb_but_1(Fl_Button*, void*);
      Fl_Button *but_2;
      inline void cb_but_2_i(Fl_Button*, void*);
      static void cb_but_2(Fl_Button*, void*);
      Fl_Button *but_3;
      inline void cb_but_3_i(Fl_Button*, void*);
      static void cb_but_3(Fl_Button*, void*);
      Fl_Button *but_0;
      inline void cb_but_0_i(Fl_Button*, void*);
      static void cb_but_0(Fl_Button*, void*);
      Fl_Button *but_dot;
      inline void cb_but_dot_i(Fl_Button*, void*);
      static void cb_but_dot(Fl_Button*, void*);
public:
      Fl_Button *but_sign;
private:
      inline void cb_but_sign_i(Fl_Button*, void*);
      static void cb_but_sign(Fl_Button*, void*);
    Fl_Button *but_C;
    inline void cb_but_C_i(Fl_Button*, void*);
    static void cb_but_C(Fl_Button*, void*);
    Fl_Button *but_AC;
    inline void cb_but_AC_i(Fl_Button*, void*);
    static void cb_but_AC(Fl_Button*, void*);
    Fl_Button *but_X;
    inline void cb_but_X_i(Fl_Button*, void*);
    static void cb_but_X(Fl_Button*, void*);
    Fl_Button *but_div;
    inline void cb_but_div_i(Fl_Button*, void*);
    static void cb_but_div(Fl_Button*, void*);
    Fl_Button *but_plus;
    inline void cb_but_plus_i(Fl_Button*, void*);
    static void cb_but_plus(Fl_Button*, void*);
    Fl_Button *but_minus;
    inline void cb_but_minus_i(Fl_Button*, void*);
    static void cb_but_minus(Fl_Button*, void*);
    Fl_Button *but_pi;
    inline void cb_but_pi_i(Fl_Button*, void*);
    static void cb_but_pi(Fl_Button*, void*);
    Fl_Button *but_eval;
    inline void cb_but_eval_i(Fl_Button*, void*);
    static void cb_but_eval(Fl_Button*, void*);
    Fl_Button *but_eval_hidden;
    inline void cb_but_eval_hidden_i(Fl_Button*, void*);
    static void cb_but_eval_hidden(Fl_Button*, void*);
    Fl_Button *but_eval_hidden2;
    inline void cb_but_eval_hidden2_i(Fl_Button*, void*);
    static void cb_but_eval_hidden2(Fl_Button*, void*);
    Fl_Button *but_sqrt;
    inline void cb_but_sqrt_i(Fl_Button*, void*);
    static void cb_but_sqrt(Fl_Button*, void*);
    Fl_Button *but_pow;
    inline void cb_but_pow_i(Fl_Button*, void*);
    static void cb_but_pow(Fl_Button*, void*);
    Fl_Button *but_sin;
    inline void cb_but_sin_i(Fl_Button*, void*);
    static void cb_but_sin(Fl_Button*, void*);
    Fl_Button *but_cos;
    inline void cb_but_cos_i(Fl_Button*, void*);
    static void cb_but_cos(Fl_Button*, void*);
    Fl_Button *but_tan;
    inline void cb_but_tan_i(Fl_Button*, void*);
    static void cb_but_tan(Fl_Button*, void*);
    Fl_Button *but_log;
    inline void cb_but_log_i(Fl_Button*, void*);
    static void cb_but_log(Fl_Button*, void*);
    Fl_Button *but_ln;
    inline void cb_but_ln_i(Fl_Button*, void*);
    static void cb_but_ln(Fl_Button*, void*);
    Fl_Button *but_int;
    inline void cb_but_int_i(Fl_Button*, void*);
    static void cb_but_int(Fl_Button*, void*);
    Fl_Button *but_dr;
    inline void cb_but_dr_i(Fl_Button*, void*);
    static void cb_but_dr(Fl_Button*, void*);
    Fl_Button *but_drg;
    inline void cb_but_drg_i(Fl_Button*, void*);
    static void cb_but_drg(Fl_Button*, void*);
    Fl_Button *but_leftbr;
    inline void cb_but_leftbr_i(Fl_Button*, void*);
    static void cb_but_leftbr(Fl_Button*, void*);
    Fl_Button *but_rightbr;
    inline void cb_but_rightbr_i(Fl_Button*, void*);
    static void cb_but_rightbr(Fl_Button*, void*);
    Fl_Button *but_exch;
    inline void cb_but_exch_i(Fl_Button*, void*);
    static void cb_but_exch(Fl_Button*, void*);
    Fl_Button *but_invx;
    inline void cb_but_invx_i(Fl_Button*, void*);
    static void cb_but_invx(Fl_Button*, void*);
    Fl_Button *but_fact;
    inline void cb_but_fact_i(Fl_Button*, void*);
    static void cb_but_fact(Fl_Button*, void*);
    Fl_Button *but_Mplus;
    inline void cb_but_Mplus_i(Fl_Button*, void*);
    static void cb_but_Mplus(Fl_Button*, void*);
    Fl_Button *but_Mmult;
    inline void cb_but_Mmult_i(Fl_Button*, void*);
    static void cb_but_Mmult(Fl_Button*, void*);
    Fl_Button *but_Mclear;
    inline void cb_but_Mclear_i(Fl_Button*, void*);
    static void cb_but_Mclear(Fl_Button*, void*);
    Fl_Button *but_Mst;
    inline void cb_but_Mst_i(Fl_Button*, void*);
    static void cb_but_Mst(Fl_Button*, void*);
    Fl_Button *but_Mrc;
    inline void cb_but_Mrc_i(Fl_Button*, void*);
    static void cb_but_Mrc(Fl_Button*, void*);
    Fl_Button *check_inv;
    inline void cb_check_inv_i(Fl_Button*, void*);
    static void cb_check_inv(Fl_Button*, void*);
    Fl_Button *but_quit;
    inline void cb_but_quit_i(Fl_Button*, void*);
    static void cb_but_quit(Fl_Button*, void*);
public:
  ~SciCalc();
  void run(int px=-1,int py=-1);
private:
  void handle_number(double numb);
  void handle_operator(Operator op);
  void change_base(int newbase);
  void set_display(double val,mode behind);
  void set_memdisp();
  void set_drgdisp();
  void set_brktdisp();
  void add_left_bracket();
  void add_right_bracket();
public:
  void factorial();
  void exchange();
  void exponent_pi();
  void calc(int i);
private:
  void init_value(int lev);
  void cvttobase(double num,int base,mode behind,char *str);
  void setnormlabels();
  void setinvlabels();
  void mem_exchange();
  double to_drg(double angle);
  double from_drg(double angle);
public:
  void memexch();
};

#endif
