1 #include "browsebutton.h"
10 BrowseButton::BrowseButton(MWindow *mwindow,
11 BC_WindowBase *parent_window,
19 const char *recent_prefix)
20 : BC_Button(x, y, mwindow->theme->get_image_set("magnify_button")),
23 this->parent_window = parent_window;
24 this->want_directory = want_directory;
26 this->caption = caption;
27 this->init_directory = init_directory;
28 this->textbox = textbox;
29 this->mwindow = mwindow;
30 this->recent_prefix = recent_prefix;
31 set_tooltip(_("Look for file"));
33 startup_lock = new Mutex("BrowseButton::startup_lock");
36 BrowseButton::~BrowseButton()
38 startup_lock->lock("BrowseButton::~BrowseButton");
45 startup_lock->unlock();
50 int BrowseButton::handle_event()
63 x = parent_window->get_abs_cursor_x(0);
64 y = parent_window->get_abs_cursor_y(0);
65 startup_lock->lock("BrowseButton::handle_event 1");
68 startup_lock->lock("BrowseButton::handle_event 2");
69 startup_lock->unlock();
73 void BrowseButton::run()
75 BrowseButtonWindow browsewindow(mwindow,
83 startup_lock->unlock();
84 browsewindow.create_objects();
85 int result2 = browsewindow.run_window();
91 // textbox->update(browsewindow.get_directory());
95 // textbox->update(browsewindow.get_filename());
98 textbox->update(browsewindow.get_submitted_path());
99 parent_window->flush();
100 textbox->handle_event();
102 startup_lock->lock("BrowseButton::run");
104 startup_lock->unlock();
112 BrowseButtonWindow::BrowseButtonWindow(MWindow *mwindow,
113 BrowseButton *button,
114 BC_WindowBase *parent_window,
115 char *init_directory,
119 : BC_FileBox(button->x -
120 BC_WindowBase::get_resources()->filebox_w / 2,
122 BC_WindowBase::get_resources()->filebox_h / 2,
126 // Set to 1 to get hidden files.
128 // Want only directories
131 mwindow->theme->browse_pad)
135 BrowseButtonWindow::~BrowseButtonWindow()