本文整理汇总了C++中Fl_Button::callback方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Button::callback方法的具体用法?C++ Fl_Button::callback怎么用?C++ Fl_Button::callback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Button
的用法示例。
在下文中一共展示了Fl_Button::callback方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: AddStructure
void FolderWindow::AddStructure(const char* filename, const int index)
{
Fl_Pack* pack = folderPack;
pack->begin();
int vertPosn = pack->children() * 30 + pack->y();
Fl_Group* group = new Fl_Group(pack->x(), vertPosn, pack->w(), 30);
group->begin();
Fl_Button* label = new Fl_Button(pack->x() + 10, vertPosn, pack->w() - 40, 30, filename);
label->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
label->callback(FolderWindow::ShowFileCallback);
label->user_data((void*)index);
Fl_Button* removeButton = new Fl_Button(pack->x() + pack->w() - 20, vertPosn + 5, 20, 20);
removeButton->callback(FolderWindow::RemoveCallback);
removeButton->user_data((void*)index);
removeButton->label("@1+");
//printf("Added file: %s\n",label->label());
group->resizable(label);
group->end();
pack->end();
folderScroll->redraw();
}
示例3: create
/*
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);
}
示例4: create_dlg
//-----------------------------------------------------------------------------
void NrmDlg::create_dlg()
{
Fl_Menu_Item k[]={{"x"}, {"y"}, { "z"}, {0}};
wnd = new Fl_Double_Window(135, 215);
min = new Fl_Value_Input(10, 25, 115, 25, mgl_gettext("Minimal value (v1)"));
min->align(FL_ALIGN_TOP_LEFT);
min->tooltip(mgl_gettext("Minimal value for resulting data values"));
max = new Fl_Value_Input(10, 70, 115, 25, mgl_gettext("Maximal value (v2)"));
max->align(FL_ALIGN_TOP_LEFT);
max->tooltip(mgl_gettext("Maximal value for resulting data values"));
dir = new Fl_Choice(10, 115, 115, 25, mgl_gettext("Direction"));
dir->align(FL_ALIGN_TOP_LEFT); dir->copy(k);
dir->tooltip(mgl_gettext("Direction along which data will be filled"));
sym = new Fl_Check_Button(10, 115, 115, 25, mgl_gettext("Symetrical range"));
sym->tooltip(mgl_gettext("Normalize in symmetrical range: -max(|v1|,|v2|) ... max(|v1|,|v2|)"));
Fl_Button *o;
o = new Fl_Button(25, 150, 85, 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(25, 180, 85, 25, mgl_gettext("Change"));o->callback(nrm_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();
}
示例5: 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();
}
示例6: SetStructures
FolderWindow::FolderWindow(int x, int y, int wid, int hgt, const char *label, int folderIndex): Fl_Group(x, y, wid, hgt, label)
{
Fl_Button* diagramButton = new Fl_Button(x+20,y+10,90,30,"Diagram");
diagramButton->callback(DiagramCallback);
Fl_Button* statsButton = new Fl_Button(x+120,y+10,90,30,"Statistics");
statsButton->callback(StatsCallback);
Fl_Button* closeButton = new Fl_Button(x+wid-25,y+5,20,20,"");
closeButton->callback(FolderWindow::CloseFolderCallback);
closeButton->label("@1+");
Fl_Box* fileLabel = new Fl_Box(x+20,y+40,120,30,"Files");
fileLabel->align(FL_ALIGN_CENTER | FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
folderScroll = new Fl_Scroll(x+10, y+70, 280, 310);
folderScroll->type(Fl_Scroll::VERTICAL_ALWAYS);
folderPack = new Fl_Pack(x+10, y+70, 260, 310);
folderPack->type(Fl_Pack::VERTICAL);
folderScroll->color(FL_WHITE);
folderPack->color(FL_WHITE);
this->resizable(folderScroll);
this->color(FL_WHITE);
this->selection_color(FL_WHITE);
//size_range(300, 400, 300);
//title = (char*)malloc(sizeof(char) * 64);
SetStructures(folderIndex);
}
示例7: 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();
}
示例8: window
window(int x, int y, int w, int h, const char *label = 0)
: Fl_Window(x, y, w, h, label)
{
Fl_Box *o = new Fl_Box(10, 10, 300, 25,
"Open CSV file to convert to HTML -->");
o->box(FL_BORDER_BOX);
o->align(FL_ALIGN_INSIDE | FL_ALIGN_WRAP| FL_ALIGN_CENTER);
o->color((Fl_Color)215);
o->labelfont(FL_HELVETICA_BOLD);
Fl_Button *but = new Fl_Button(320, 10, 80, 25, "Pick Files");
but->callback(on_pick_button_click, this);
encode_check = new Fl_Check_Button(10, 40, 280, 25,
"Escape special HTML characters.");
encode_check->value(1);
open_file_check = new Fl_Check_Button(10, 65, 280, 25,
"Open HTML in browser.");
open_file_check->value(1);
Fl_Button *author = new Fl_Button(320, 65, 80, 25, "Mingjie Li");
author->box(FL_FLAT_BOX);
author->align(FL_ALIGN_INSIDE | FL_ALIGN_RIGHT);
author->labelsize(12);
author->labelcolor(fl_rgb_color(128, 128, 128));
author->callback(on_author_click, this);
}
示例9: make_group
void Fl_Help_Dialog::make_group(int w, int h)
{
menubar_ = new Fl_Menu_Bar(0, 0, 595, 20);
menubar_->begin();
{
Fl_Item_Group *g = new Fl_Item_Group("&File");
Fl_Item *i;
i= new Fl_Item("Open");
i->shortcut(FL_CTRL+'o');
i->callback((Fl_Callback*)cb_open, this);
i = new Fl_Item("Close");
i->shortcut(FL_CTRL+'c');
i->callback((Fl_Callback*)cb_close, this);
g->end();
}
menubar_->end();
{
Fl_Group *g = new Fl_Group(0, 20, w, 30);
g->box(FL_THIN_DOWN_BOX);
Fl_Button *b;
b = back = new Fl_Highlight_Button(35, 2, 30, 25, "@<-");
b->box(FL_HIGHLIGHT_UP_BOX);
b->label_type(FL_SYMBOL_LABEL);
b->label_color(FL_DARK3);
b->highlight_label_color(FL_GRAY);
b->callback((Fl_Callback*)cb_back, this);
b->tooltip("Back");
b->deactivate();
b = next = new Fl_Highlight_Button(65, 2, 30, 25, "@->");
b->box(FL_HIGHLIGHT_UP_BOX);
b->label_type(FL_SYMBOL_LABEL);
b->label_color(FL_DARK3);
b->highlight_label_color(FL_GRAY);
b->callback((Fl_Callback*)cb_next, this);
b->tooltip("Next");
b->deactivate();
b = new Fl_Highlight_Button(5, 2, 30, 25);
b->image(Fl_Image::read(0, (uchar*)datas_open));
b->box(FL_HIGHLIGHT_UP_BOX);
b->callback((Fl_Callback*)cb_open, this);
b->tooltip("Open");
b->take_focus();
g->end();
}
htmlWidget = new Fl_Simple_Html(0, 50, w, h-50);
htmlWidget->callback(cb_html_link, this);
htmlWidget->end();
resizable(htmlWidget);
}
示例10: populate
void select_monitor_widget_t::populate(console_window_t *console_window)
{
label("Select a running coLinux");
console = console_window;
browser = new Fl_Hold_Browser(0, 0, 400, 200);
Fl_Button *button;
button = new Fl_Button(0, 200, 200, 20);
button->label("Select");
button->when(FL_WHEN_RELEASE);
button->callback((Fl_Callback *)console_select_monitor, this);
select_button = button;
button = new Fl_Button(200, 200, 200, 20);
button->label("Cancel");
button->when(FL_WHEN_RELEASE);
button->callback((Fl_Callback *)console_select_monitor, this);
cancel_button = button;
resizable(browser);
end();
show();
load_monitors_list();
}
示例11: make_window
Fl_Double_Window* make_window() {
Fl_Double_Window* w;
{ Fl_Double_Window* o = controls = new Fl_Double_Window(255, 60, "Rotation Angle");
w = o;
{ Fl_Value_Input* o = angle_value = new Fl_Value_Input(180, 5, 70, 25, "Angle");
o->minimum(-65000);
o->maximum(65000);
o->callback((Fl_Callback*)cb_angle_value);
o->when(FL_WHEN_ENTER_KEY);
}
{ Fl_Roller* o = angle_roller = new Fl_Roller(5, 35, 245, 20);
o->type(1);
o->minimum(65000);
o->maximum(-65000);
o->step(0.1);
o->callback((Fl_Callback*)cb_angle_roller);
}
{ Fl_Button* o = new Fl_Button(70, 5, 55, 25, "next");
o->shortcut(0x66);
o->callback((Fl_Callback*)cb_next);
}
{ Fl_Button* o = new Fl_Button(5, 5, 55, 25, "prev");
o->shortcut(0x64);
o->callback((Fl_Callback*)cb_prev);
}
o->end();
o->resizable(o);
}
{ ImageWindow* o = iw1 = new ImageWindow(100, 100);
w = o;
o->box(FL_FLAT_BOX);
o->color(FL_BACKGROUND_COLOR);
o->selection_color(FL_BACKGROUND_COLOR);
o->labeltype(FL_NO_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->align(FL_ALIGN_TOP);
o->when(FL_WHEN_RELEASE);
o->end();
}
{ ImageWindow* o = iw2 = new ImageWindow(100, 100);
w = o;
o->box(FL_FLAT_BOX);
o->color(FL_BACKGROUND_COLOR);
o->selection_color(FL_BACKGROUND_COLOR);
o->labeltype(FL_NO_LABEL);
o->labelfont(0);
o->labelsize(14);
o->labelcolor(FL_FOREGROUND_COLOR);
o->align(FL_ALIGN_TOP);
o->when(FL_WHEN_RELEASE);
o->end();
}
return w;
}
示例12: main
int main() {
Fl_Window* win = new Fl_Window(290, 180, "Icon chooser test");
win->begin();
Fl_Box* ibox = image_box = new Fl_Box(80, 10, 135, 110);
ibox->box(FL_THIN_DOWN_BOX);
Fl_Button* run = new Fl_Button(95, 145, 90, 25, "&Run");
run->callback(run_cb);
Fl_Button* close = new Fl_Button(190, 145, 90, 25, "&Close");
close->callback(close_cb, win);
win->end();
win->show();
return Fl::run();
}
示例13: main
int main(int argc, char **argv) {
Fl_Window *window = new Fl_Window(400,350);
int y = 10;
input[0] = new Fl_Input(70,y,300,23,"Normal:"); y += 27;
input[0]->tooltip("Normal input field");
// input[0]->cursor_color(FL_SELECTION_COLOR);
// input[0]->maximum_size(20);
// input[0]->static_value("this is a testgarbage");
input[1] = new Fl_Float_Input(70,y,300,23,"Float:"); y += 27;
input[1]->tooltip("Input field for floating-point number");
input[2] = new Fl_Int_Input(70,y,300,23,"Int:"); y += 27;
input[2]->tooltip("Input field for integer number");
input[3] = new Fl_Secret_Input(70,y,300,23,"Secret:"); y += 27;
input[3]->tooltip("Input field for password");
input[4] = new Fl_Wordwrap_Input(70,y,300,100,"Wordwrap:"); y += 105;
input[4]->tooltip("Input field for short text with newlines");
for (int i = 0; i < 4; i++) {
input[i]->when(0); input[i]->callback(cb);
}
int y1 = y;
Fl_Button *b;
b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&CHANGED");
b->tooltip("Do callback each time the text changes");
b->callback(toggle_cb, FL_WHEN_CHANGED); y += 23;
b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&RELEASE");
b->callback(toggle_cb, FL_WHEN_RELEASE); y += 23;
b->tooltip("Do callback when widget loses focus");
b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&ENTER_KEY");
b->callback(toggle_cb, FL_WHEN_ENTER_KEY); y += 23;
b->tooltip("Do callback when user hits Enter key");
b = new Fl_Toggle_Button(10,y,200,23,"FL_WHEN_&NOT_CHANGED");
b->callback(toggle_cb, FL_WHEN_NOT_CHANGED); y += 23;
b->tooltip("Do callback even if the text is not changed");
y += 5;
b = new Fl_Button(10,y,200,23,"&print changed()");
b->callback(button_cb);
b->tooltip("Print widgets that have changed() flag set");
b = new Fl_Button(220,y1,100,23,"color"); y1 += 23;
b->color(input[0]->color()); b->callback(color_cb, (void*)0);
b->label_color(fl_contrast(FL_BLACK,b->color()));
b->tooltip("Color behind the text");
b = new Fl_Button(220,y1,100,23,"selection_color"); y1 += 23;
b->color(input[0]->selection_color()); b->callback(color_cb, (void*)1);
b->label_color(fl_contrast(FL_BLACK,b->color()));
b->tooltip("Color behind selected text");
b = new Fl_Button(220,y1,100,23,"text_color"); y1 += 23;
b->color(input[0]->text_color()); b->callback(color_cb, (void*)2);
b->label_color(fl_contrast(FL_BLACK,b->color()));
b->tooltip("Color of the text");
window->resizable(window);
window->end();
window->show(argc,argv);
// CET - FIXME - crashes windows Fl::lock();
return Fl::run();
}
示例14: crash_dialog_show
int crash_dialog_show(const ProgramDetails& p) {
info_was_collected = false;
pdetails = &p;
win = new edelib::Window(380, WIN_H_NORMAL, _("EDE Crash Handler"));
win->begin();
Fl_Box* image_box = new Fl_Box(10, 10, 65, 60);
image_box->image(image_core);
String s;
if(p.name)
s.printf(_("Program '%s' quit unexpectedly."), p.name);
else
s = _("Program quit unexpectedly.");
s += _("\n\nYou can inspect the details about this crash by clicking on \'Show details\' below");
Fl_Box* txt_box = new Fl_Box(85, 10, 285, 75, s.c_str());
txt_box->align(132|FL_ALIGN_INSIDE);
/* only EDE applications can have 'Report' button for reporting issues on EDE bugzilla */
if(p.ede_app) {
Fl_Button* report = new Fl_Button(185, 95, 90, 25, _("&Report..."));
report->callback(report_cb);
}
Fl_Button* close = new Fl_Button(280, 95, 90, 25, _("&Close"));
close->callback(close_cb);
show_details = new Fl_Button(10, 95, 165, 25, _("@> Show details"));
show_details->box(FL_FLAT_BOX);
show_details->align(FL_ALIGN_LEFT|FL_ALIGN_INSIDE);
show_details->callback(show_details_cb);
txt_display = new Fl_Text_Display(10, 130, 360, 165);
txt_buf = new Fl_Text_Buffer();
txt_display->buffer(txt_buf);
txt_display->hide();
save_as = new Fl_Button(280, 305, 90, 25, _("&Save As..."));
save_as->hide();
save_as->callback(save_as_cb);
win->end();
win->window_icon(core_xpm);
win->show();
return Fl::run();
}
示例15: setup
void BlockWindow::setup() {
reset();
help_button_ = new Fl_Button(0, 0, 20, 20, "?");
help_button_->callback((Fl_Callback *)help_cb, this);
help_button_->shortcut('?');
play_button_ = new Fl_Button(80, (h() - 80) / 2, 80, 80, "@>");
play_button_->callback((Fl_Callback *)play_cb, this);
play_button_->labelsize(44);
play_button_->shortcut(' ');
sound_ = new BlockSound();
prefs_.get("high_score", high_score_, 0);
Fl::add_timeout(0.1, (Fl_Timeout_Handler)timeout_cb, (void *)this);
}