| 2997 | // ------------------------------------------------------------------------------------ |
| 2998 | |
| 2999 | void box_win:: |
| 3000 | enter_folder ( |
| 3001 | const std::string& folder_name |
| 3002 | ) |
| 3003 | { |
| 3004 | if (btn_root.is_checked()) |
| 3005 | btn_root.set_unchecked(); |
| 3006 | if (cur_dir != -1) |
| 3007 | sob[cur_dir]->set_unchecked(); |
| 3008 | |
| 3009 | |
| 3010 | const std::string old_path = path; |
| 3011 | const long old_cur_dir = cur_dir; |
| 3012 | |
| 3013 | std::unique_ptr<toggle_button> new_btn(new toggle_button(*this)); |
| 3014 | new_btn->set_name(folder_name); |
| 3015 | new_btn->set_click_handler(*this,&box_win::on_path_button_click); |
| 3016 | |
| 3017 | // remove any path buttons that won't be part of the path anymore |
| 3018 | if (sob.size()) |
| 3019 | { |
| 3020 | while (sob.size() > (unsigned long)(cur_dir+1)) |
| 3021 | { |
| 3022 | std::unique_ptr<toggle_button> junk; |
| 3023 | sob.remove(cur_dir+1,junk); |
| 3024 | } |
| 3025 | } |
| 3026 | |
| 3027 | if (sob.size()) |
| 3028 | new_btn->set_pos(sob[sob.size()-1]->right()+5,sob[sob.size()-1]->top()); |
| 3029 | else |
| 3030 | new_btn->set_pos(btn_root.right()+5,btn_root.top()); |
| 3031 | |
| 3032 | cur_dir = sob.size(); |
| 3033 | sob.add(sob.size(),new_btn); |
| 3034 | |
| 3035 | path += folder_name + directory::get_separator(); |
| 3036 | if (set_dir(prefix + path) == false) |
| 3037 | { |
| 3038 | sob.remove(sob.size()-1,new_btn); |
| 3039 | path = old_path; |
| 3040 | cur_dir = old_cur_dir; |
| 3041 | } |
| 3042 | else |
| 3043 | { |
| 3044 | |
| 3045 | sob[cur_dir]->set_checked(); |
| 3046 | } |
| 3047 | } |
| 3048 | |
| 3049 | // ------------------------------------------------------------------------------------ |
| 3050 | |