r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / browsebutton.C
blobc85822de23fc0fc18a41cdcb7c89df88cca56b30
1 #include "browsebutton.h"
2 #include "mwindow.h"
3 #include "theme.h"
5 #include <libintl.h>
6 #define _(String) gettext(String)
7 #define gettext_noop(String) String
8 #define N_(String) gettext_noop (String)
12 BrowseButton::BrowseButton(MWindow *mwindow, 
13         BC_WindowBase *parent_window, 
14         BC_TextBox *textbox, 
15         int x, 
16         int y, 
17         char *init_directory, 
18         char *title, 
19         char *caption, 
20         int want_directory)
21  : BC_Button(x, y, mwindow->theme->magnify_button_data), Thread()
23         this->parent_window = parent_window;
24         this->want_directory = want_directory;
25         this->title = title;
26         this->caption = caption;
27         this->init_directory = init_directory;
28         this->textbox = textbox;
29         this->mwindow = mwindow;
30         set_tooltip(_("Look for file"));
33 BrowseButton::~BrowseButton()
37 int BrowseButton::handle_event()
39         start(); 
42 void BrowseButton::run()
44         BrowseButtonWindow browsewindow(mwindow,
45                 parent_window, 
46                 textbox->get_text(), 
47                 title, 
48                 caption, 
49                 want_directory);
50         browsewindow.create_objects();
51         int result2 = browsewindow.run_window();
53         if(!result2)
54         {
55 //              if(want_directory)
56 //              {
57 //                      textbox->update(browsewindow.get_directory());
58 //              }
59 //              else
60 //              {
61 //                      textbox->update(browsewindow.get_filename());
62 //              }
64                 textbox->update(browsewindow.get_path());
65                 parent_window->flush();
66                 textbox->handle_event();
67         }
75 BrowseButtonWindow::BrowseButtonWindow(MWindow *mwindow, 
76         BC_WindowBase *parent_window, 
77         char *init_directory, 
78         char *title, 
79         char *caption, 
80         int want_directory)
81  : BC_FileBox(parent_window->get_abs_cursor_x() - BC_WindowBase::get_resources()->filebox_w / 2, 
82         parent_window->get_abs_cursor_y() - BC_WindowBase::get_resources()->filebox_h / 2,
83         init_directory,
84         title,
85         caption,
86 // Set to 1 to get hidden files. 
87         want_directory,
88 // Want only directories
89         want_directory,
90         0,
91         mwindow->theme->browse_pad)
95 BrowseButtonWindow::~BrowseButtonWindow()