本文整理汇总了C++中Fl_Button类的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Button类的具体用法?C++ Fl_Button怎么用?C++ Fl_Button使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Fl_Button类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _get_fl_button
Scheme_Object*
spark_fltk_button::when(int argc, Scheme_Object** argv)
{
DEFAULT_RET_INIT;
Fl_Button* button = _get_fl_button(argc, argv, 0);
if (button)
{
if (argc == 1)
{
Fl_When w = button->when();
long i = static_cast<long>(w);
_ret_ = scheme_make_integer(i);
}
else
{
long i = 0;
Fl_When w;
if (spark::Utils::long_from_scheme_long(argv[1], i))
{
w = static_cast<Fl_When>(i);
button->when(w);
_ret_ = scheme_true;
}
}
}
DEFAULT_RET_FINISH;
}
示例2: cb_open_about
void cb_open_about() {
{ a_diag = new Fl_Double_Window(210, 165, "About");
a_diag->color((Fl_Color)29);
{ a_mess = new Fl_Group(5, 10, 200, 45, "Calc 80");
a_mess->box(FL_RFLAT_BOX);
a_mess->color((Fl_Color)206);
a_mess->labelsize(21);
a_mess->align(Fl_Align(FL_ALIGN_CENTER));
a_mess->end();
} // Fl_Group* a_mess
{ Fl_Group* o = new Fl_Group(5, 70, 205, 25, "Version 0.04");
o->align(Fl_Align(FL_ALIGN_CENTER));
o->end();
} // Fl_Group* o
{ Fl_Group* o = new Fl_Group(10, 95, 200, 25, "\302\251""2016, Patrik Wallander");
o->align(Fl_Align(FL_ALIGN_CENTER));
o->end();
} // Fl_Group* o
{ Fl_Button* o = new Fl_Button(70, 135, 70, 20, "Close");
o->box(FL_RFLAT_BOX);
o->color(FL_BACKGROUND2_COLOR);
o->callback((Fl_Callback*)cb_close_about);
} // Fl_Button* o
a_diag->show();
a_diag->position(m_win->x(), m_win->y());
a_diag->end();
} // Fl_Double_Window* a_diag
}
示例3: Calculator
void MainForm::BtnSigNDel0_Click(Fl_Widget *w, void *data)
{
try
{
Fl_Button *lpbtn = (Fl_Button *)w;
MainForm *lpwnd = (MainForm *)data;
string tmp = lpwnd->Output->value();
if(tmp == "0" && lpbtn->label() == "-")//特殊情况
{
lpwnd->Output->value("-");
return;
}
if(lpwnd->mode == 1)//单步模式
{
lpwnd->UpWnd->value((tmp + " =").c_str());
Calculator *calc = new Calculator(tmp + ";");
double val = calc->calculate();
stringstream ss;
ss.precision(10);
ss<<val;
ss>>tmp;
delete calc;
}
tmp += lpbtn->label();
lpwnd->Output->value(tmp.c_str());
}
示例4: OnStartClick
void OnStartClick(Fl_Widget * button, void * pVoid)
{
Price * pPrice = (Price *) pVoid;
//std::cout << pPrice->ask << " " << button->label() <<std::endl;
std::string strLbl = button->label();
//const char * strLbl = button->label();
//int nSize = strlen(strLbl);
(pPrice->bid);
Fl_Button *pButton = (Fl_Button *) button; // all FLTK objects are derived from class Fl_Widget.
// here, we are casting the pointer button of type Fl_Widget to
// a pointer of class Fl_Button
// button was pointing to the button that calls this function
/*
if (strcmp(pButton->label(),"Clicked") == 0)
{
pButton->label("again");
}
else
{
pButton->label("Clicked");
}
*/
pButton->label("mine!");
}
示例5: main
int main()
{
Fl_Window* w = new Fl_Window(width,height);
Widgets widgets;
w->begin();
widgets.img[0] = new Fl_JPEG_Image("f1.jpg");
widgets.img[1] = new Fl_JPEG_Image("f2.jpg");
widgets.img[2] = new Fl_JPEG_Image("f3.jpg");
widgets.box = new Fl_Box(100,100,100,100);
Fl_Button* button = new Fl_Button(300,400,50,30,"CHANGE");
w->end();
button->callback(button_clicked,&widgets);
w->show();
return(Fl::run());
}
示例6: Fl_Window
/*
Initial creation of ui components.
*/
void SelectorGUI::create(){
Fl_Window *window = new Fl_Window(400,460,"Stream Selector");
x = 80;
y = 10;
char* participantList[100];
test = "this is a member";
window->size_range(400, 400, 600, 600);
// Scroll window containing participants
swindow = new Fl_Scroll(0, y, 400, 380);
Fl_Group* o = new Fl_Group(x, y, 380, 280);
o->box(FL_THIN_UP_FRAME);
// Add buttons to scroll window
update();
// Apply and close button.
y = 400;
x = 150;
Fl_Button *applyButton = new Fl_Button(150, y, 60, 40, "Refresh");
Fl_Button *closeButton = new Fl_Button(x + 70, y, 60, 40, "Close");
// Callbacks.
applyButton->callback(static_applyCB, this);
closeButton->callback(static_closeCB, this);
window->end();
window->show();
// For some reason, the idle callback causes a segfault.
//Fl::add_idle(static_idleCB);
}
示例7: Synth_Window
Synth_Window(void)
:Fl_Double_Window(800,700, "RT-OSC Test Synth")
{
osc = &OSC_API;
pane_name = "/";
ADSR_Pane *ampl_env = new ADSR_Pane(0,0,400,200, "amp_env/");
ADSR_Pane *freq_env = new ADSR_Pane(0,200,400,200, "frq_env/");
ampl_env->box(FL_DOWN_BOX);
freq_env->box(FL_DOWN_BOX);
//Trigger
Fl_Button *b=new Fl_Osc_Button(0,400,400,50,"gate","");
b->type(FL_TOGGLE_BUTTON);
b->label("Gate Switch");
Fl_Osc_Slider *s = new Fl_Osc_Slider(0, 460, 400, 50,
"freq", Synth::ports["freq"]->metadata);
s->type(FL_HOR_SLIDER);
Fl_Button *save = new Fl_Osc_Button(0,550, 200, 600, "save","");
save->label("save");
Fl_Button *load = new Fl_Osc_Button(200,550, 400, 600, "load","");
load->label("load");
undo = new Fl_Undo_History(400,0,700,400);
undo->init(uh);
end();
resizable(new Fl_Box(0,0,400,400));
Fl::add_handler(undo_redo_handler);
uh.setCallback(undo_cb);
}
示例8: LOG_INFO
void ElevatorSimWindow::pauseSimCB(Fl_Widget* w, void* userData) {
if(isDebugBuild()) {
std::stringstream dbgSS;
dbgSS << "in pauseSimCB with widget ptr " << w
<< " and userData " << userData << std::endl;
LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) );
}
Fl_Button* pauseButton = (Fl_Button*)w;
if(pauseButton->value()) {
if(isDebugBuild()) {
std::stringstream dbgSS;
dbgSS << "pauseSimCB fired " << std::endl;
LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) );
}
if( SimulationState::acquire().togglePause() ) {
w->label("Resume");
} else {
w->label("Pause");
}
}
}
示例9: main
int main(int argc, char** argv) {
CrazyContainer *container = new CrazyContainer();
container->loadXML();
MyWindow *window = new MyWindow();
window->setCrazyContainer(container);
Fl_Button *b1 = new Fl_Button(20, 20, 80, 25, "Connect");
b1->callback(connect,(void *)container);
Fl_Button *b2 = new Fl_Button(100, 20, 80, 25, "Go 11000");
b2->callback(run,(void *)container);
FLContainer::thrustOutput = new Fl_Value_Slider(100,50,250,25,"Thrust meter");
FLContainer::thrustOutput->type(FL_HOR_FILL_SLIDER);
FLContainer::thrustOutput->scrollvalue(5000, 100, 5000, 100000);
FLContainer::thrustOutput->callback(runCustomThrust,(void *)container);
FLContainer::pitch = new Fl_Value_Slider(100,100,250,25,"Pitch");
FLContainer::pitch->type(FL_HORIZONTAL);
FLContainer::pitch->scrollvalue(0,10,-180,370);
FLContainer::pitch->precision(2);
FLContainer::roll = new Fl_Value_Slider(100,140,250,25,"Roll");
FLContainer::roll->type(FL_HORIZONTAL);
FLContainer::roll->scrollvalue(0,10,-180,370);
FLContainer::roll->precision(2);
FLContainer::yaw = new Fl_Value_Slider(100,180,250,25,"Yaw");
FLContainer::yaw->type(FL_HORIZONTAL);
FLContainer::yaw->scrollvalue(0,10,-180,370);
FLContainer::yaw->precision(2);
FLContainer::offsetPitch = new Fl_Value_Slider(100,220,250,25,"Offset Pitch");
FLContainer::offsetPitch->type(FL_HORIZONTAL);
FLContainer::offsetPitch->scrollvalue(container->getOffsetPitch(),10,-20,50);
FLContainer::offsetPitch->precision(2);
FLContainer::offsetPitch->callback(setOffsetPitch,(void *)container);
FLContainer::offsetRoll = new Fl_Value_Slider(100,260,250,25,"Offset Roll");
FLContainer::offsetRoll->type(FL_HORIZONTAL);
FLContainer::offsetRoll->scrollvalue(container->getOffsetRoll(),10,-20,50);
FLContainer::offsetRoll->precision(2);
FLContainer::offsetRoll->callback(setOffsetRoll,(void *)container);
Fl_Button *b3 = new Fl_Button(200, 20, 80, 25, "Stop");
b3->callback(stop,(void *)container);
Fl_Button *bfocus = new Fl_Button(20, 45, 80, 25, "Focus");
Fl_Button *b5 = new Fl_Button(400, 20, 80, 25, "Kill n' Exit");
b5->callback(killnstop,(void *)container);
Fl_Button *bsave = new Fl_Button(500, 20, 80, 25, "Plot");
bsave->callback(save,(void *)container);
Fl_Button *bload = new Fl_Button(500, 50, 80, 25, "Load");
bload->callback(load,(void *)container);
window->end();
window->show(argc,argv);
return Fl::run();
}
示例10: LOG_INFO
void ElevatorSimWindow::stopSimCB(Fl_Widget* w, void* userData) {
if(isDebugBuild()) {
std::stringstream dbgSS;
dbgSS << "in stopSimCB with widget ptr " << w
<< " and userData " << userData << std::endl;
LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) );
}
Fl_Button* stopButton = (Fl_Button*) w;
ElevatorSimWindow* thisWin = (ElevatorSimWindow*) userData;
if(stopButton->value()) {
if(isDebugBuild()) {
std::stringstream dbgSS;
dbgSS << "stopSimCB fired " << std::endl;
LOG_INFO( Logger::SUB_FLTK, sstreamToBuffer(dbgSS) );
}
SimulationState::acquire().stop();
thisWin -> resultsWin -> updateChartData();
thisWin -> resultsWin -> show();
}
}
示例11: assert
//==== Add Geom Picker ====//
void GroupLayout::AddGeomPicker( GeomPicker & geom_picker )
{
assert( m_Group && m_Screen );
//==== Geom Button ====//
Fl_Button* button = new Fl_Button( m_X, m_Y, m_ChoiceButtonWidth, m_StdHeight, "Geom" );
button->box( FL_THIN_UP_BOX );
button->labelfont( 1 );
button->labelsize( 12 );
button->labelcolor( FL_BLACK );
m_Group->add( button );
AddX( m_ChoiceButtonWidth );
//==== Geom Picker ====//
int choice_w = FitWidth( m_ChoiceButtonWidth, m_SliderWidth );
Fl_Choice* geom_choice = new Fl_Choice( m_X, m_Y, choice_w, m_StdHeight );
geom_choice->down_box( FL_BORDER_BOX );
geom_choice->textfont( 1 );
geom_choice->textsize( 12 );
geom_choice->textcolor( FL_DARK_BLUE );
m_Group->add( geom_choice );
AddX( choice_w );
AddY( m_StdHeight );
NewLineX();
geom_picker.Init( m_Screen, geom_choice );
}
示例12: start_dialog
static int start_dialog(int argc, char** argv) {
LaunchWindow* win = new LaunchWindow(370, 195, _("Run Command"));
win->begin();
Fl_Box* icon = new Fl_Box(10, 10, 55, 55);
icon->image(image_run);
Fl_Box* txt = new Fl_Box(70, 10, 290, 69, _("Enter the name of the application "
"you would like to run or the URL you would like to view"));
txt->align(132|FL_ALIGN_INSIDE);
dialog_input = new Fl_Input(70, 90, 290, 25, _("Open:"));
Resource rc;
char buf[128];
if(rc.load("ede-launch-history") && rc.get("History", "open", buf, sizeof(buf))) {
dialog_input->value(buf);
/* make text appear selected */
dialog_input->position(0, dialog_input->size());
}
in_term = new Fl_Check_Button(70, 125, 290, 25, _("Run in terminal"));
in_term->down_box(FL_DOWN_BOX);
Fl_Button* ok = new Fl_Button(175, 160, 90, 25, _("&OK"));
ok->callback(ok_cb, win);
Fl_Button* cancel = new Fl_Button(270, 160, 90, 25, _("&Cancel"));
cancel->callback(cancel_cb, win);
win->end();
win->window_icon(run_xpm);
win->show(argc, argv);
return Fl::run();
}
示例13: editbookmark
void editbookmark(bookmark * const ptr) {
if (!bookedit_win) {
bookedit_win = new Fl_Double_Window(350, 180, _("Edit bookmark"));
{ bookedit_name = new Fl_Input(60, 20, 265, 25, _("Name:"));
} // Fl_Input* bookedit_name
{ bookedit_url = new Fl_Input(60, 55, 265, 25, _("URL:"));
} // Fl_Input* bookedit_url
{ Fl_Box* o = new Fl_Box(60, 80, 265, 50, _("The changes get applied immediately."));
o->align(FL_ALIGN_WRAP);
} // Fl_Box* o
{ Fl_Button * o = new Fl_Button(60, 130, 115, 30, _("OK"));
o->callback(bookedit_ok);
bookedit_okbtn = o;
} // Fl_Button* o
{ Fl_Button* o = new Fl_Button(195, 130, 115, 30, _("Cancel"));
o->callback(bookedit_cancel);
} // Fl_Button* o
bookedit_win->end();
} // Fl_Double_Window* bookedit_win
bookedit_name->value(ptr->name);
bookedit_url->value(ptr->url);
bookedit_url->activate();
if (!ptr->url)
bookedit_url->deactivate();
bookedit_okbtn->user_data(ptr);
bookedit_win->show();
}
示例14: main
int main(int argc, char **argv) {
ThemeLoader::init();
IconLoader::init();
win = new EdeWindow(455, 485, "Theme demo");
win->begin();
{ Fl_Button* o = new Fl_Button(355, 450, 90, 25, "Load");
o->tooltip("Load predefined theme");
o->callback(load_theme_cb);
} // Fl_Button* o
{ Fl_Menu_Bar* o = new Fl_Menu_Bar(0, 0, 455, 25);
o->menu(menu_);
} // Fl_Menu_Bar* o
{ Fl_Round_Button* o = new Fl_Round_Button(5, 285, 90, 25, "round");
o->down_box(FL_ROUND_DOWN_BOX);
} // Fl_Round_Button* o
{ new Fl_Return_Button(5, 195, 90, 25, "button");
} // Fl_Return_Button* o
{ new Fl_Input(160, 196, 285, 25, "input:");
} // Fl_Input* o
{ Fl_Output* o = new Fl_Output(160, 225, 285, 25, "output:");
o->value("Some output value");
} // Fl_Output* o
{ Fl_File_Browser* o = new Fl_File_Browser(5, 30, 210, 125);
o->load("/");
} // Fl_File_Browser* o
{ Fl_Check_Browser* o = new Fl_Check_Browser(220, 30, 225, 125);
o->add("foo");
o->add("foo");
o->add("foo");
} // Fl_Check_Browser* o
{ Fl_Progress* o = new Fl_Progress(5, 160, 210, 25, "progress bar");
o->value(50);
} // Fl_Progress* o
{ Fl_Slider* o = new Fl_Slider(220, 160, 225, 25);
o->type(1);
o->align(Fl_Align(FL_ALIGN_TOP_LEFT));
} // Fl_Slider* o
{ new Fl_Light_Button(5, 225, 90, 25, "button");
} // Fl_Light_Button* o
{ Fl_Check_Button* o = new Fl_Check_Button(5, 255, 90, 25, "check");
o->down_box(FL_DOWN_BOX);
} // Fl_Check_Button* o
{ Fl_File_Input* o = new Fl_File_Input(160, 256, 285, 35, "file:");
o->value("/home/foo/baz/taz.txt");
} // Fl_File_Input* o
{ Fl_Text_Editor* o = new Fl_Text_Editor(160, 325, 285, 115, "Text editor");
o->buffer(new Fl_Text_Buffer());
} // Fl_Text_Editor* o
{ Fl_Box* o = new Fl_Box(25, 328, 80, 80, "image");
IconLoader::set(o, "utilities-terminal", ICON_SIZE_MEDIUM);
} // Fl_Box* o
win->end();
win->show(argc, argv);
Fl::run();
ThemeLoader::shutdown();
IconLoader::shutdown();
return 0;
}
示例15: shadedColorCB
static void shadedColorCB( Fl_Widget *w, void* )
{
Fl_Button *b = (Fl_Button*)w;
b->color( fl_show_colormap( b->color() ) );
b->redraw();
tree->shaded_entry_colors( shadedEvenColor->color(), shadedOddColor->color() );
tree->redraw();
}