本文整理汇总了C++中Fl_Choice::user_data方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Choice::user_data方法的具体用法?C++ Fl_Choice::user_data怎么用?C++ Fl_Choice::user_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Choice
的用法示例。
在下文中一共展示了Fl_Choice::user_data方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PaintView
//----------------------------------------------------
// Constructor. Creates all of the widgets.
// Add new widgets here
//----------------------------------------------------
ImpressionistUI::ImpressionistUI() {
// Create the main window
m_mainWindow = new Fl_Window(600, 300, "Impressionist");
m_mainWindow->user_data((void*)(this)); // record self to be used by static callback functions
// install menu bar
m_menubar = new Fl_Menu_Bar(0, 0, 600, 25);
m_menubar->menu(menuitems);
// Create a group that will hold two sub windows inside the main
// window
Fl_Group* group = new Fl_Group(0, 25, 600, 275);
// install paint view window
m_paintView = new PaintView(300, 25, 300, 275, "This is the paint view");//0jon
m_paintView->box(FL_DOWN_FRAME);
// install original view window
m_origView = new OriginalView(0, 25, 300, 275, "This is the orig view");//300jon
m_origView->box(FL_DOWN_FRAME);
// m_origView->deactivate();
group->end();
Fl_Group::current()->resizable(group);
m_mainWindow->end();
// init values
m_nSize = 10;
m_nAngle = 45;
m_nAlpha = 255;
m_nBackgroundAlpha = 100;
// brush dialog definition
m_brushDialog = new Fl_Window(400, 325, "Brush Dialog");
// Add a brush type choice to the dialog
m_BrushTypeChoice = new Fl_Choice(50,10,150,25,"&Brush");
m_BrushTypeChoice->user_data((void*)(this)); // record self to be used by static callback functions
m_BrushTypeChoice->menu(brushTypeMenu);
m_BrushTypeChoice->callback(cb_brushChoice);
m_ClearCanvasButton = new Fl_Button(240,10,150,25,"&Clear Canvas");
m_ClearCanvasButton->user_data((void*)(this));
m_ClearCanvasButton->callback(cb_clear_canvas_button);
m_transparentBackgroundButton = new Fl_Button(130,280,150,25,"&Show Background");
m_transparentBackgroundButton->user_data((void*)(this));
m_transparentBackgroundButton->callback(cb_transparentBackground);
m_edgeImageButton = new Fl_Button(130,180,150,25,"&Toggle Edge Image");
m_edgeImageButton->user_data((void*)(this));
m_edgeImageButton->callback(cb_edgeImage);
//Add angle choice menu
Fl_Choice * myChoice = new Fl_Choice(95,60,150,25,"&Angle Choice");
myChoice->user_data((void*)(this)); // record self to be used by static callback functions
myChoice->menu(angleChoiceMenu);
myChoice->callback(cb_angleChoice);
// Add brush size slider to the dialog
m_BrushSizeSlider = new Fl_Value_Slider(10, 100, 300, 20, "Size");
m_BrushSizeSlider->user_data((void*)(this)); // record self to be used by static callback functions
m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
m_BrushSizeSlider->labelfont(FL_COURIER);
m_BrushSizeSlider->labelsize(12);
m_BrushSizeSlider->minimum(1);
m_BrushSizeSlider->maximum(40);
m_BrushSizeSlider->step(1);
m_BrushSizeSlider->value(m_nSize);
m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
m_BrushSizeSlider->callback(cb_sizeSlides);
// Add brush angle slider to the dialog
m_BrushSizeSlider = new Fl_Value_Slider(10, 120, 300, 20, "Angle");
m_BrushSizeSlider->user_data((void*)(this)); // record self to be used by static callback functions
m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
m_BrushSizeSlider->labelfont(FL_COURIER);
m_BrushSizeSlider->labelsize(12);
m_BrushSizeSlider->minimum(0);
m_BrushSizeSlider->maximum(180);
m_BrushSizeSlider->step(1);
m_BrushSizeSlider->value(m_nAngle);
m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
m_BrushSizeSlider->callback(cb_angleSlides);
// Add brush angle slider to the dialog
m_BrushSizeSlider = new Fl_Value_Slider(10, 140, 300, 20, "Opacity");
m_BrushSizeSlider->user_data((void*)(this)); // record self to be used by static callback functions
m_BrushSizeSlider->type(FL_HOR_NICE_SLIDER);
m_BrushSizeSlider->labelfont(FL_COURIER);
m_BrushSizeSlider->labelsize(12);
m_BrushSizeSlider->minimum(0);
m_BrushSizeSlider->maximum(255);
m_BrushSizeSlider->step(1);
m_BrushSizeSlider->value(m_nAlpha);
m_BrushSizeSlider->align(FL_ALIGN_RIGHT);
m_BrushSizeSlider->callback(cb_alphaSlides);
//.........这里部分代码省略.........