Advertisement
BoneFort

Untitled

Nov 8th, 2023 (edited)
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.50 KB | None | 0 0
  1. //main.cpp
  2. //Большая часть программы скрыта за ненадобностью
  3.  
  4. #include <FL/Fl.H>
  5. #include <FL/Fl_Button.H>
  6. #include <FL/Fl_Input.H>
  7. #include <FL/Fl_Native_File_Chooser.H>
  8. #include "Fl_Canvas.h"
  9. #include <string>
  10. #include "effects.h"
  11.  
  12. void ChooseNewImagesCb(Fl_Widget* widget, void* data)
  13. {
  14.     Fl_Native_File_Chooser* chooser = new Fl_Native_File_Chooser(Fl_Native_File_Chooser::BROWSE_FILE);
  15.     chooser->title("Choise images...");
  16.     chooser->filter("Изображения\t*.{jpg,png,bmp,gif}");
  17.     chooser->show();
  18.     Fl_Canvas* _canvas = (Fl_Canvas*)data;
  19.     _canvas->add_image(chooser->filename()); //Здесь я вызываю метод у которого по мнению компилятора, нету определния
  20.     _canvas->redraw();
  21. }
  22.  
  23. class Photoeditor : public Fl_Window
  24. {
  25.     public:
  26.     Photoeditor(int w, int h, const char* title) : Fl_Window(w, h, title) {
  27.    
  28.     Fl_Canvas* canvas = new Fl_Canvas(FL_BORDER_BOX, 20, 40, 400, 400);
  29.    
  30.     /*Creating a button. Its opens a dialog box with image selection*/    
  31.     int button_x = 10, button_y = 10,
  32.     button_width = 60, button_hight = 15;
  33.    
  34.     Fl_Button* load_image = new Fl_Button(button_x, button_y, button_width, button_hight, "image");
  35.     load_image->callback(ChooseNewImagesCb, canvas);
  36.    
  37.     resizable(this);
  38.     show();
  39. }
  40. };
  41.  
  42. int main()
  43. {
  44.     fl_register_images();
  45.     Photoeditor photoeditor(640, 480, "photoeditor");
  46.     Fl::run();
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement