00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include "xrb_filepanel.hpp"
00012
00013 #include "xrb_label.hpp"
00014 #include "xrb_layout.hpp"
00015 #include "xrb_lineedit.hpp"
00016 #include "xrb_widgetbackground.hpp"
00017
00018 namespace Xrb
00019 {
00020
00021 FilePanel::FilePanel (
00022 std::string const &title_text,
00023 Operation const file_operation,
00024 ContainerWidget *const parent,
00025 std::string const &name)
00026 :
00027 ContainerWidget(parent, name),
00028 m_sender_submit_path(this),
00029 m_sender_submit_path_v(this),
00030 m_internal_receiver_path_set_by_enter_key(
00031 &FilePanel::InternalPathSetByEnterKey, this)
00032 {
00033 Layout *main_control_layout =
00034 new Layout(
00035 VERTICAL,
00036 this,
00037 "main control layout");
00038
00039 Label *label;
00040
00041
00042 label = m_title_label =
00043 new Label(
00044 title_text,
00045 main_control_layout,
00046 "title label");
00047 label->SetIsHeightFixedToTextHeight(true);
00048
00049
00050 Layout *sub_control_layout =
00051 new Layout(
00052 HORIZONTAL,
00053 main_control_layout,
00054 "sub control layout");
00055
00056 m_file_operation = file_operation;
00057 label = new Label("Path:", sub_control_layout);
00058 label->SetIsWidthFixedToTextWidth(true);
00059
00060 m_path_edit =
00061 new LineEdit(
00062 LONGEST_FILESYSTEM_PATH_NAME,
00063 sub_control_layout,
00064 "path edit");
00065 m_path_edit->Focus();
00066
00067 SetMainWidget(main_control_layout);
00068
00069
00070
00071 SignalHandler::Connect1(
00072 m_path_edit->SenderTextSetByEnterKey(),
00073 &m_internal_receiver_path_set_by_enter_key);
00074
00075 FilePanel::UpdateRenderBackground();
00076 }
00077
00078 std::string const &FilePanel::Path () const
00079 {
00080 ASSERT1(m_path_edit != NULL);
00081 return m_path_edit->Text();
00082 }
00083
00084 void FilePanel::UpdateRenderBackground ()
00085 {
00086 SetRenderBackground(NULL);
00087 }
00088
00089 void FilePanel::InternalPathSetByEnterKey (std::string const &path)
00090 {
00091 m_sender_submit_path.Signal(path);
00092 m_sender_submit_path_v.Signal(path);
00093 }
00094
00095 }