void WidgetTable::button_cb(Fl_Widget *w, void * p) { fprintf(stderr, "BUTTON: %s\n", (const char*)w->label()); WidgetTable * myTable = static_cast<WidgetTable*>(p); //WidgetTable * myTable = (WidgetTable*)(p); UserInterface * myUserInterface = static_cast<UserInterface*>(myTable->ptr_to_UserInterface); //UserInterface * myUserInterface = (UserInterface*)(myTable->ptr_to_UserInterface); int myRow = 8, myColumn = 8; //std::stringstream buffer; Fl_Widget * myWidget = myTable->GetElement(myRow, myColumn); Fl_Input * myCell = dynamic_cast<Fl_Input*>(myWidget); myWidget = myTable->GetElement(myRow, myColumn); My_fl_button * myFlButton = (My_fl_button*)w; std::cout << std::endl << myFlButton->x_pos << std::endl; std::cout << myFlButton->y_pos << std::endl; myCell = dynamic_cast<Fl_Input*>(myWidget); myCell->value("try"); myUserInterface->textDisplayString << "button pressed" << std::endl; myUserInterface->textBuffer->text((myUserInterface->textDisplayString).str().c_str()); myTable->printInTable(6, 6, "text", myTable); }
void onelabGroup::updateParameter(onelab::string &p) { Fl_Tree_Item *n = _tree->find_item(p.getName().c_str()); if(!n) { addParameter(p); return; } Fl_Group *grp = (Fl_Group *)n->widget(); // macro button if(p.getAttribute("Macro") == "Gmsh"){ return; } // non-editable value FIXME if(p.getReadOnly()){ Fl_Output *but = (Fl_Output *)grp->child(0); but->value(p.getValue().c_str()); return; } // simple string (no menu) if(p.getChoices().empty() && p.getKind() != "file"){ Fl_Input *but = (Fl_Input *)grp->child(0); but->value(p.getValue().c_str()); return; } // general string input TODO Fl_Input_Choice *but = (Fl_Input_Choice *)grp->child(0); but->value(p.getValue().c_str()); }
void ImpressionistUI::cb_setFilterKernalSize(Fl_Widget *o, void *v) { ImpressionistUI *pUI = (ImpressionistUI*)o->user_data(); int width = atoi(pUI->m_filterWidthInput->value()); int height = atoi(pUI->m_filterHeightInput->value()); if (width <= 0 || height <= 0) { fl_message("Width or Height cannot be less than 0"); return; } else { pUI->m_filterSizeDialog->hide(); pUI->m_nFilterWidth = width; pUI->m_nFilterHeight = height; pUI->m_filterKernalDialog = new Fl_Window(60 + 30 * width + 10 * (width - 1), 60 + 30 * width + 10 * (width - 1) + 50, "Filter Kernal"); pUI->m_filterKernalEntries.clear(); for (int j = 0; j < height; j++) { for (int i = 0; i < width; i++) { Fl_Input *filterEntry = new Fl_Input(60 + 30 * i + 10 * i, 30 * j + 10 * j, 30, 30, ""); filterEntry->value("1.0"); pUI->m_filterKernalEntries.push_back(filterEntry); } } pUI->m_applyFilterKernalButton = new Fl_Button(0, 60 + 30 * width + 10 * (width - 1) + 20, 50, 20, "Apply"); pUI->m_applyFilterKernalButton->user_data((void *)(pUI)); pUI->m_applyFilterKernalButton->callback(cb_applyFilterKernal); pUI->m_filterKernalDialog->end(); pUI->m_filterKernalDialog->show(); } }
static void BrowseColors(Fl_Widget *wdg, void *arg) { ProjectOptionsDlg* dlg = (ProjectOptionsDlg*)arg; Fl_Input *inp = dlg->GetColors(); const char *dir = fl_file_chooser("Colors File", NULL, inp->value()); if (dir) inp->value(dir); }
static void field_select_file_cb(Fl_Widget *w, void *data) { Fl_Input *input = (Fl_Input*)data; int ret = fileChooser(FILE_CHOOSER_SINGLE, "Choose", "", input->value()); if(ret){ input->value(fileChooserGetName(0).c_str()); input->set_changed(); } }
void button_callback(Fl_Widget* widget, void* data) { Pair* pair = (Pair *)data; Fl_Button* button = pair->button; Fl_Input* input = pair->input; button->label(input->value()); printf(input->value()); }
static void curframe_cb(Fl_Widget *w, void *v) { Fl_Input *inp = (Fl_Input *)w; VMDApp *app = (VMDApp *)v; int val = atoi(inp->value()); int max = app->molecule_numframes(app->molecule_top()); if (val < 0) val = 0; if (val >= max) val = max-1; app->animation_set_frame(val); }
void WidgetTable::printInTable(int row, int col, std::string text, WidgetTable * myWidgetPointer)//this causes trouble { WidgetTable * myTable = myWidgetPointer; Fl_Widget * myWidget = (Fl_Widget*) (myTable->GetElement(row, col)); Fl_Input * myCell = (Fl_Input*)(myWidget); std::stringstream buffer; buffer << text; myCell->value(buffer.str().c_str()); }
void DirectoryChooser(Fl_Widget *widget, void *text){ Fl_Input *dirfield = (Fl_Input *)text; char *dir = fl_dir_chooser("Select a directory to use as the startup directory", dirfield->value(), 1); if(dir==NULL){ return; } dirfield->value(dir); dirfield->do_callback(); }
static void ClickedAddWP(Fl_Widget * w, void * userdata) { WaypointClient* anInstance = (WaypointClient*) userdata; Fl_Input_Choice * fromWPChoice = anInstance->frWps; Fl_Input_Choice * toWPChoice = anInstance->toWps; Fl_Input * theLat = anInstance->latIn; Fl_Input * theLon = anInstance->lonIn; Fl_Input * theEle = anInstance->eleIn; Fl_Input * theName = anInstance->nameIn; string lat(theLat->value()); string lon(theLon->value()); string ele(theEle->value()); string name(theName->value()); Json::Value wp; wp["name"] = name; wp["lat"] = atof(lat.c_str()); wp["lon"] = atof(lon.c_str()); wp["ele"] = atof(ele.c_str()); if (anInstance->addWaypoint(wp) == true) { cout << "Added: Waypoint(" << name << "); \n" << endl; } else { cout << "Error: Waypoint(" << name << ") could not be added! \n" << endl; } buildWaypointList(anInstance); }
static void ClickedModifyWP(Fl_Widget * w, void * userdata) { WaypointClient* anInstance = (WaypointClient*) userdata; Fl_Input * theLat = anInstance->latIn; Fl_Input * theLon = anInstance->lonIn; Fl_Input * theEle = anInstance->eleIn; Fl_Input * theName = anInstance->nameIn; string lat(theLat->value()); string lon(theLon->value()); string ele(theEle->value()); string name(theName->value()); Json::Value wp; wp["name"] = name.c_str(); wp["lat"] = atof(lat.c_str()); wp["lon"] = atof(lon.c_str()); wp["ele"] = atof(ele.c_str()); anInstance->removeWaypoint(name); anInstance->addWaypoint(wp); cout << "Modified: " << name << "(" << lat << ", " << lon << ", " << ele << ", " << name << "); \n" << endl; buildWaypointList(anInstance); }
void onelab_connect_remote_server_cb(Fl_Widget *w, void *data) { Fl_Input *serverAddr = (Fl_Input *)data; std::string address = serverAddr->value(); std::size_t colon = address.find(":"); GmshNetworkClient *c = OnelabDatabase::instance()->useAsNetworkClient( ip4_inet_pton(address.substr(0, colon).c_str()), atoi(address.substr(colon+1, address.size()-colon-1).c_str()), "GUI"); if(c == NULL) { Msg::Error("Unable to connect ONELAB server (%s)", address.c_str()); Msg::Exit(1); } else if(FlGui::available()) // FIXME c->setCallback(FlGui::instance()->onelab); }
void onelab_listen_unix_cb(Fl_Widget *w, void *data) { Fl_Check_Button *checkbutton = (Fl_Check_Button *)w; Fl_Input *sockUNIX = (Fl_Input *)data; if(checkbutton->value() == 1) { sockUNIX->deactivate(); CTX::instance()->onelab.unixSock = sockUNIX->value(); std::size_t colon = CTX::instance()->onelab.unixSock.find(":"); std::ostringstream tmp; tmp << CTX::instance()->homeDir << CTX::instance()->onelab.unixSock; OnelabServer::instance()->listenOnUnix(tmp.str().c_str()); } else { sockUNIX->activate(); OnelabServer::instance()->stopUnix(); } }
void onelab_listen_udt_cb(Fl_Widget *w, void *data) { Fl_Check_Button *checkbutton = (Fl_Check_Button *)w; Fl_Input *sockUDT = (Fl_Input *)data; if(checkbutton->value() == 1) { sockUDT->deactivate(); CTX::instance()->onelab.udtSock = sockUDT->value(); std::size_t colon = CTX::instance()->onelab.udtSock.find(":"); OnelabServer::instance()->listenOnTcp( ip4_inet_pton(CTX::instance()->onelab.udtSock.substr(0, colon).c_str()), atoi(CTX::instance()->onelab.udtSock.substr(colon+1, CTX::instance()->onelab.udtSock.size()-colon-1).c_str())); } else { sockUDT->activate(); OnelabServer::instance()->stopUdt(); } }
int main( int argc, char **argv ) { Fl_Double_Window *win = new Fl_Double_Window( 100, 100, 400, 300, "Flu_Chat_Buffer_Try" ); Flu_Chat_Buffer *b = new Flu_Chat_Buffer( 0, 0, 400, 200 ); Fl_Input *in = new Fl_Input( 80, 210, 100, 30, "Send:" ); in->when( FL_WHEN_ENTER_KEY_ALWAYS ); in->callback( sendMsg, b ); win->end(); win->resizable( win ); b->addSystemMessage( "System message" ); b->addRemoteMessage( "<Remote User> ", "Remote user's message" ); b->addLocalMessage( "<Local User> ", "Local user's message" ); win->show(); return( Fl::run() ); }
void IconChooser::load(const char* dir) { /* copy directory name to input box and internal String so it can be reused later */ path->value(dir); start = dir; list<String> lst; if(!dir_list(dir, lst, true)) return; load_from_list(lst); }
//==== Create & Init Text Input ====// void GroupLayout::AddInput( StringInput& text_input, const char* label ) { assert( m_Group && m_Screen ); //==== Button ====// AddParmButton( label ); //==== Add Text Input ====// int iw = FitWidth( m_ButtonWidth, m_InputWidth ); Fl_Input* input = new Fl_Input( m_X, m_Y, iw, m_StdHeight ); input->box( FL_THIN_DOWN_BOX ); input->textsize( 12 ); input->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( input ); AddX( iw ); AddY( m_StdHeight ); NewLineX(); text_input.Init( m_Screen, input ); }
static void ClickedDistBear(Fl_Widget * w, void * userdata) { WaypointClient* anInstance = (WaypointClient*) userdata; Fl_Input_Choice * fromWPChoice = anInstance->frWps; Fl_Input_Choice * toWPChoice = anInstance->toWps; Fl_Input * distBearOutput = anInstance->distBearIn; double dist = anInstance->getDistanceGCTo(fromWPChoice->value(), toWPChoice->value()); double bear = anInstance->getBearingGCInitTo(fromWPChoice->value(), toWPChoice->value()); stringstream ss; ss.precision(5); ss << dist << "/" << bear; string result = ss.str(); distBearOutput->value(result.c_str()); cout << "Calculated distance/bearing: " << result << "; \n"<< endl; buildWaypointList(anInstance); }
//==== Create & Init Float Input ====// void GroupLayout::AddInput( Input& input, const char* label, const char* format ) { assert( m_Group && m_Screen ); //==== Parm Button ====// VspButton* button = AddParmButton( label ); //==== Add Text Input ====// int iw = FitWidth( m_ButtonWidth, m_InputWidth ); Fl_Input* flinput = new Fl_Input( m_X, m_Y, iw, m_StdHeight ); flinput->type( 1 ); flinput->box( FL_THIN_DOWN_BOX ); flinput->textsize( 12 ); flinput->when( FL_WHEN_ENTER_KEY | FL_WHEN_RELEASE ); m_Group->add( flinput ); AddX( iw ); AddY( m_StdHeight ); NewLineX(); input.Init( m_Screen, flinput, format, button ); }
//----------------------------------------------------------------------------- void CropDlg::create_dlg() { wnd = new Fl_Double_Window(230, 155, mgl_gettext("Crop data")); x1 = new Fl_Input(45, 25, 80, 25, mgl_gettext("Lower bound")); x1->align(FL_ALIGN_TOP); x2 = new Fl_Input(140, 25, 80, 25, mgl_gettext("Upper bound")); x2->align(FL_ALIGN_TOP); y1 = new Fl_Input(45, 55, 80, 25); y2 = new Fl_Input(140, 55, 80, 25); z1 = new Fl_Input(45, 85, 80, 25); z2 = new Fl_Input(140, 85, 80, 25); new Fl_Box(15, 25, 25, 25, "X"); new Fl_Box(15, 55, 25, 25, "Y"); new Fl_Box(15, 85, 25, 25, "Z"); Fl_Button *o; o = new Fl_Button(45, 120, 75, 25, mgl_gettext("Cancel")); o->callback(close_dlg_cb,wnd); o->box(UDAV_UP_BOX); o->down_box(UDAV_DOWN_BOX); o->tooltip(mgl_gettext("Do nothing and close this window")); o = new Fl_Return_Button(145, 120, 75, 25, mgl_gettext("Crop")); o->callback(crop_dlg_cb,wnd); o->box(UDAV_UP_BOX); o->down_box(UDAV_DOWN_BOX); o->tooltip(mgl_gettext("Change data values and close this window")); wnd->end(); }
//----------------------------------------------------------------------------- void NwdtDlg::create_dlg() { Fl_Menu_Item k[]={{mgl_gettext("Summation of")}, {mgl_gettext("Maximum of")}, { mgl_gettext("Minimum of")}, {0}}; wnd = new Fl_Double_Window(165, 215, mgl_gettext("Extract data")); kind = new Fl_Choice(10, 25, 145, 25, mgl_gettext("Type of operation")); kind->align(FL_ALIGN_TOP_LEFT); kind->copy(k); dx = new Fl_Check_Button(10, 55, 140, 25, mgl_gettext("apply in x direction")); dy = new Fl_Check_Button(10, 80, 140, 25, mgl_gettext("apply in y direction")); dz = new Fl_Check_Button(10, 105, 140, 25, mgl_gettext("apply in z direction")); name = new Fl_Input(10, 145, 145, 25, mgl_gettext("Name for output")); name->align(FL_ALIGN_TOP_LEFT); Fl_Button *o; o = new Fl_Button(10, 180, 65, 25, mgl_gettext("Cancel")); o->callback(close_dlg_cb,wnd); o->box(UDAV_UP_BOX); o->down_box(UDAV_DOWN_BOX); o = new Fl_Return_Button(90, 180, 65, 25, mgl_gettext("Do"));o->callback(chng_dlg_cb,wnd); o->box(UDAV_UP_BOX); o->down_box(UDAV_DOWN_BOX); wnd->end(); }
int main(int argc, char **argv) { Fl_Window *window = new Fl_Window(300,150); Fl_Button *btn = new Fl_Button(20,80,120,25,"Simple dialog"); btn->image(&dialog_pixmap_1); // using auto-layout input1 = new Fl_Input("First Name"); input2 = new Fl_Input("Last Name"); btn->callback(cb_test); input1->value("Jonh"); input2->value("Doe"); btn = new Fl_Button(170,80,120,25,"Config dialog"); btn->image(&dialog_pixmap_2); btn->callback(cb_test2); window->end(); window->show(argc, argv); dlg = new Fl_Dialog(400,300,"Demo dialog"); dlg->new_group("default"); // Using auto-layout Fl_Input *firstNameInput = new Fl_Input("First Name:"); firstNameInput->field_name("first_name"); Fl_Input *lastNameInput = new Fl_Input("Last Name:"); lastNameInput->field_name("last_name"); dlg->end(); dlg->buttons(FL_DLG_OK|FL_DLG_CANCEL|FL_DLG_HELP,FL_DLG_OK); // User may add his own buttons. The button bitmap is optional, // and it should 20x20 or less if presented. The button id should // be unique inside the dialog. dlg->user_button(1024,"User Button",&smile_pixmap); // This is the callback for the whole dialog. In this test, // we process the user buttons in this callback function. dlg->callback(dialog_callback); // This part of the test illustrates the usage of the Dialog // as a 'preferences' dialog box. All the widgets with the defined // field names will be stored/restored in the defined config file // section. // First, define a config file Fl_Config my_config("dialog.ini"); // Second, define a config datasource as a config file and a section Fl_Config_Dialog_DS my_config_ds(&my_config); // Third, create the dialog with the datasource config_dlg = new Fl_Dialog(400,300,"Config dialog",&my_config_ds); config_dlg->new_group("default"); // Using auto-layout firstNameInput = new Fl_Input("First Name:"); firstNameInput->field_name("first_name"); lastNameInput = new Fl_Input("Last Name:"); lastNameInput->field_name("last_name"); Fl_Input *inp; inp = new Fl_Float_Input("Age:"); inp->field_name("age"); inp->maximum_size(5); inp = new Fl_Int_Input("Children:"); inp->field_name("children"); inp->maximum_size(3); Fl_Date_Input *dinp = new Fl_Date_Input("Date:"); dinp->field_name("date"); config_dlg->end(); config_dlg->buttons(FL_DLG_OK|FL_DLG_CANCEL,FL_DLG_OK); return Fl::run(); }
// add parameter string to tree Fl_Widget *onelabGroup::_addParameterWidget(onelab::string &p, int ww, int hh, Fl_Tree_Item *n, bool highlight, Fl_Color c) { char *path = strdup(getPath(n).c_str()); _treeStrings.push_back(path); // macro button if(p.getAttribute("Macro") == "Gmsh"){ Fl_Button *but = new Fl_Button(1, 1, ww / _widgetLabelRatio, hh); but->box(FL_FLAT_BOX); but->color(_tree->color()); but->selection_color(_tree->color()); but->align(FL_ALIGN_LEFT | FL_ALIGN_INSIDE | FL_ALIGN_CLIP); //TODO but->callback(onelab_string_button_cb, (void*)path); if(highlight) but->color(c); return but; } // non-editable value if(p.getReadOnly()){ Fl_Output *but = new Fl_Output(1, 1, ww, hh); but->value(p.getValue().c_str()); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } // simple string (no menu) if(p.getChoices().empty() && p.getKind() != "file"){ Fl_Input *but = new Fl_Input(1, 1, ww, hh); but->value(p.getValue().c_str()); //TODO but->callback(onelab_string_input_cb, (void*)path); but->when(FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT); if(highlight) but->color(c); return but; } // general string input Fl_Input_Choice *but = new Fl_Input_Choice(1, 1, ww, hh); std::string multipleSelection = p.getAttribute("MultipleSelection"); if(multipleSelection.size()) ;//but->menubutton()->callback(multiple_selection_menu_cb, but); std::vector<Fl_Menu_Item> menu; for(unsigned int j = 0; j < p.getChoices().size(); j++){ char *str = strdup(p.getChoices()[j].c_str()); _treeStrings.push_back(str); bool divider = (p.getKind() == "file" && j == p.getChoices().size() - 1); int choice = multipleSelection.size() ? FL_MENU_TOGGLE : 0; if(multipleSelection.size() > j && multipleSelection[j] == '1') choice |= FL_MENU_VALUE; Fl_Menu_Item it = {str, 0, 0, 0, divider ? FL_MENU_DIVIDER : choice}; menu.push_back(it); } //if(p.getKind() == "file"){ // Fl_Menu_Item it = {"Choose...", 0, onelab_input_choice_file_chooser_cb, (void*)n}; // menu.push_back(it); // Fl_Menu_Item it2 = {"Edit...", 0, onelab_input_choice_file_edit_cb, (void*)n}; // menu.push_back(it2); // if(GuessFileFormatFromFileName(p.getValue()) >= 0){ // Fl_Menu_Item it3 = {"Merge...", 0, onelab_input_choice_file_merge_cb, (void*)n}; // menu.push_back(it3); // } //} Fl_Menu_Item it = {0}; menu.push_back(it); but->menubutton()->copy(&menu[0]); but->value(p.getValue().c_str()); but->callback(onelab_string_input_choice_cb, (void*)path); but->input()->when(FL_WHEN_ENTER_KEY); but->align(FL_ALIGN_RIGHT); if(highlight) but->input()->color(c); return but; }
void mainfuncCallback(Fl_Widget *widget, void *unused){ Fl_Input *inp = (Fl_Input *)widget; tsconf::GetGameConfig()->gamefunc = inp->value(); }
void tsgmnameCallback(Fl_Widget *widget, void *unused){ Fl_Input *inp = (Fl_Input *)widget; tsconf::GetGameConfig()->tsgmname = inp->value(); }
void startupCallback(Fl_Widget *widget, void *unused){ Fl_Input *inp = (Fl_Input *)widget; tsconf::GetGameConfig()->startupdir = inp->value(); }
void TextCallback(Fl_Widget *widget, void *toSet){ Fl_Input *inp = (Fl_Input *)widget; void **val = (void **)toSet; *val = (void *)inp->value(); }
void createSystemArea(int32_t x, int32_t y, int32_t w, int32_t h){ tsconf::GameConfig *conf = tsconf::GetGameConfig(); int curH_L = y; if((x+(tsconf::smallPadding<<1)+tsconf::largeWidgetWidth)>w){ //Enter no-space mode } else{ //We got space. curH_L+=tsconf::smallPadding; Fl_Group *startupGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "Startup Directory"); startupGroup->box(FL_EMBOSSED_BOX); startupGroup->begin(); Fl_Input *startupInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-76, tsconf::smallWidgetHeight); startupInput->value(conf->startupdir); startupInput->when(FL_WHEN_CHANGED); startupInput->callback(startupCallback); int newX = static_cast<Fl_Widget *>(startupInput)->x()+static_cast<Fl_Widget *>(startupInput)->w(); Fl_Button *chooseStartupButton = new Fl_Button(newX+12, curH_L+12, 40, tsconf::smallWidgetHeight, "..."); chooseStartupButton->callback(DirectoryChooser, startupInput); startupGroup->end(); curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight; Fl_Group *sgmnameGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "SGM File Name"); sgmnameGroup->box(FL_EMBOSSED_BOX); sgmnameGroup->begin(); Fl_Input *sgmnameInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight); sgmnameInput->value(conf->sgmname); sgmnameInput->when(FL_WHEN_CHANGED); sgmnameInput->callback(sgmnameCallback); sgmnameGroup->end(); curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight; Fl_Group *tsgmnameGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "TSGM File Name"); tsgmnameGroup->box(FL_EMBOSSED_BOX); tsgmnameGroup->begin(); Fl_Input *tsgmnameInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight); tsgmnameInput->value(conf->tsgmname); tsgmnameInput->when(FL_WHEN_CHANGED); tsgmnameInput->callback(tsgmnameCallback); tsgmnameGroup->end(); curH_L+=tsconf::smallPadding+tsconf::largeWidgetHeight; Fl_Group *mainfuncGroup = new Fl_Group(x+tsconf::smallPadding, curH_L, w-(tsconf::smallPadding*2), tsconf::largeWidgetHeight, "Main Function"); mainfuncGroup->box(FL_EMBOSSED_BOX); mainfuncGroup->begin(); Fl_Input *mainfuncInput = new Fl_Input(x+tsconf::smallPadding+12, curH_L+12, (w-(tsconf::smallPadding*2))-24, tsconf::smallWidgetHeight); mainfuncInput->value(conf->gamefunc); mainfuncInput->when(FL_WHEN_CHANGED); mainfuncInput->callback(mainfuncCallback); mainfuncGroup->end(); } }
void edit_formula_cb( Fl_Widget* w, void* ) { const int heightInput = 28; const int heightText = 18; const int wideLabel = 50; const int wideInput = 450; const int Ybetween = 3; const int YbetweenMore = 6; const int alignStyle = FL_ALIGN_INSIDE | FL_ALIGN_RIGHT; const int textStyle = FL_ALIGN_INSIDE | FL_ALIGN_LEFT; const Fl_Boxtype inputStyle = FL_PLASTIC_DOWN_BOX; int x = 10; int y = 10; const int wide = x+wideLabel+wideInput+x; const int height = y + 3*heightText + Ybetween + 3*(heightInput+Ybetween) - Ybetween + YbetweenMore + y; Fl_Window* win = new Fl_Window( wide, height, _("Formulas editor") ); Fl_Group* win2 = new Fl_Group( 0, 0, wide, height ); win->resizable(win2); { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Enter the formulas of x(n+1) and y(n+1) using prefix notation.") ); o->align( textStyle ); } y += heightText; { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Variables: x y x1 x2 y1 y2 xc yc rand, and any number.") ); o->align( textStyle ); } y += heightText; { Fl_Box* o = new Fl_Box( x, y, wideLabel+wideInput, heightText, _("Functions: ") ); o->align( textStyle ); } { Fl_Box* o = new Fl_Box( x + (int)( fl_width(_("Functions: ")) ), y, wideLabel+wideInput, heightText, "+ - * / < pow abs atan2 sin cos tan atan ln sign square sqrt." ); o->align( textStyle ); } y += heightText + Ybetween; { Fl_Box* o = new Fl_Box( x, y, wideLabel, heightInput, "x <- " ); o->align( alignStyle ); } { Fl_Input* o = new Fl_Input( x+wideLabel, y, wideInput, heightInput ); o->box(inputStyle); o->value( Function::formulaPoint.getStringX().c_str() ); } y += heightInput + Ybetween; { Fl_Box* o = new Fl_Box( x, y, wideLabel, heightInput, "y <- " ); o->align( alignStyle ); } { Fl_Input* o = new Fl_Input( x+wideLabel, y, wideInput, heightInput ); o->box(inputStyle); o->value( Function::formulaPoint.getStringY().c_str() ); } y += heightInput + Ybetween + YbetweenMore; { Fl_Return_Button* o = new Fl_Return_Button( wide - x - 150, y, 150, heightInput, _("Set formulas") ); o->box(FL_PLASTIC_UP_BOX); o->callback( (Fl_Callback*)set_formula, glito ); } win2->end(); win->end(); win->show(); }
int main (int argc, char **argv) { Fl_Window* w; fl_init_locale_support("ewmconf", PREFIX"/share/locale"); readConfiguration(); {Fl_Window* o = new Fl_Window(320, 370, _("Window manager settings")); w = o; {Fl_Tabs* o = new Fl_Tabs(2, 5, 318, 325); o->color((Fl_Color)16); {Fl_Group* o = new Fl_Group(1, 29, 316, 295, _("&Titlebar")); o->align(FL_ALIGN_TOP | FL_ALIGN_LEFT); {Fl_Choice* o = new Fl_Choice(83, 13, 105, 22, _("Text align:")); o->begin(); o->callback((Fl_Callback*)cb_Text); new Fl_Item(_("Left")); new Fl_Item(_("Right")); new Fl_Item(_("Center")); o->value(title_align); o->end(); } {Fl_Value_Input* o = new Fl_Value_Input(243, 13, 60, 22, _("Height:")); o->minimum(10); o->maximum(50); o->step(1); o->value(20); o->callback((Fl_Callback*)cb_Height); o->value(title_height); } {Fl_Button* o = titlebarLabelColorButton = new Fl_Button(85, 55, 60, 20, _("Titlebar label color: ")); o->box(FL_DOWN_BOX); o->callback((Fl_Callback*)cb_titlebarLabelColorButton); o->align(132); o->color((Fl_Color)title_normal_color_text); } {Fl_Button* o = titlebarColorButton = new Fl_Button(85, 120, 60, 20, _("Titlebar color: ")); o->box(FL_DOWN_BOX); o->callback((Fl_Callback*)cb_titlebarColorButton); o->align(132); o->color((Fl_Color) title_normal_color); } {Fl_Group* o = new Fl_Group(153, 45, 160, 110); {Fl_Button* o = titlebarActiveLabelColorButton = new Fl_Button(90, 10, 60, 20, _("Titlebar active label color: ")); o->box(FL_DOWN_BOX); o->callback((Fl_Callback*)cb_titlebarActiveLabelColorButton); o->align(132); o->color((Fl_Color) title_active_color_text); } {Fl_Button* o = titlebarActiveColorButton = new Fl_Button(90, 75, 60, 20, _("Titlebar active color: ")); o->box(FL_DOWN_BOX); o->callback((Fl_Callback*)cb_titlebarActiveColorButton); o->align(132); o->color((Fl_Color)title_active_color); } o->end(); } {Fl_Choice* o = titlebarDrawGrad = new Fl_Choice(85, 157, 163, 23, _("Box type:")); o->begin(); o->callback((Fl_Callback*)cb_titlebarDrawGrad); o->align(132); new Fl_Item(_("Flat")); new Fl_Item(_("Horizontal shade")); new Fl_Item(_("Thin down")); new Fl_Item(_("Up box")); new Fl_Item(_("Down box")); new Fl_Item(_("Plastic")); o->value(title_draw_grad); o->end(); } {Fl_Check_Button* o = useThemeButton = new Fl_Check_Button(8, 220, 300, 20, _("&Use theme")); o->callback((Fl_Callback*)cb_useThemeButton); o->value(use_theme); } {Fl_Input* o = themePathInput = new Fl_Input(65, 247, 210, 23, _("Path:")); o->callback((Fl_Callback*)cb_themePathInput); o->deactivate(); themePathInput->value(theme_path); } {Fl_Button* o = browse_btn = new Fl_Button(280, 247, 25, 23, _("...")); o->callback((Fl_Callback*)cb_browse_btn); o->deactivate(); } {Fl_Divider* o = new Fl_Divider(8, 190, 300, 25, _("label")); o->color((Fl_Color)16); } {Fl_Divider* o = new Fl_Divider(8, 85, 297, 25, _("label")); o->color((Fl_Color)16); } o->end(); } {Fl_Group* o = new Fl_Group(3, 20, 310, 305, _("&Resizing")); o->align(FL_ALIGN_TOP | FL_ALIGN_LEFT); o->hide(); {Fl_Check_Button* o = animateButton = new Fl_Check_Button(10, 10, 300, 20, _("Animate size changes")); o->value(1); o->callback((Fl_Callback*)cb_animateButton); o->value(animate); } {Fl_Value_Slider* o = animateSlider = new Fl_Value_Slider(70, 35, 235, 20, _("Speed:")); o->type(Fl_Value_Slider::HORIZONTAL|Fl_Slider::TICK_ABOVE); o->box(FL_DOWN_BOX); o->text_size(10); o->minimum(5); o->maximum(20); o->step(2); o->value(14); o->slider_size(8); o->callback((Fl_Callback*)cb_animateSlider); o->align(FL_ALIGN_LEFT); o->value(animate_speed); if(animate) o->activate(); else o->deactivate(); } new Fl_Divider(0, 60, 300, 25, _("label")); {Fl_Check_Button* o = opaqueResize = new Fl_Check_Button(10, 85, 290, 20, _("Show window content while resizing")); o->callback((Fl_Callback*)cb_opaqueResize); o->value(opaque_resize); } o->end(); } o->end(); } {Fl_Button* o = new Fl_Button(67, 337, 80, 25, _("&OK")); o->shortcut(0xff0d); o->callback((Fl_Callback*)cb_OK); } {Fl_Button* o = new Fl_Button(152, 337, 80, 25, _("&Apply")); o->callback((Fl_Callback*)cb_Apply); } {Fl_Button* o = new Fl_Button(237, 337, 80, 25, _("&Cancel")); o->shortcut(0xff1b); o->callback((Fl_Callback*)cb_Cancel); } o->end(); } useThemeButton->do_callback(); w->show(argc, argv); return Fl::run(); }