Class: Watobo::Gui::WorkspaceDialog
- Inherits:
-
FXDialogBox
- Object
- FXDialogBox
- Watobo::Gui::WorkspaceDialog
- Defined in:
- lib/watobo/gui/workspace_dialog.rb
Instance Attribute Summary collapse
-
#workspace_dir ⇒ Object
readonly
Returns the value of attribute workspace_dir.
Instance Method Summary collapse
-
#initialize(parent, prefs) ⇒ WorkspaceDialog
constructor
A new instance of WorkspaceDialog.
- #open_select_workspace_dir_dialog(sender, sel, ptr) ⇒ Object
Constructor Details
#initialize(parent, prefs) ⇒ WorkspaceDialog
Returns a new instance of WorkspaceDialog.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/watobo/gui/workspace_dialog.rb', line 20 def initialize(parent, prefs) # Invoke base class initialize function first # super(parent, "New Project", DECOR_TITLE|DECOR_BORDER) super(parent, "Define Workspace", DECOR_ALL) @workspace_dir = FXDataTarget.new('') if prefs[:workspace_dir] then if File.exists?(prefs[:workspace_dir]) then @workspace_dir.value = prefs[:workspace_dir] end end base_frame = FXVerticalFrame.new(self, :opts => LAYOUT_FILL_X|LAYOUT_FILL_Y) workspace_path_form = FXHorizontalFrame.new(base_frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP) FXLabel.new(workspace_path_form, "Workspace Directory:" ) @workspaceText = FXTextField.new(workspace_path_form, 60, :target => @workspace_dir, :selector => FXDataTarget::ID_VALUE, :opts => TEXTFIELD_NORMAL|LAYOUT_FILL_X|LAYOUT_FILL_COLUMN) =FXButton.new(workspace_path_form, "Change") .connect(SEL_COMMAND, method(:open_select_workspace_dir_dialog) ) # # BUTTONS FRAME # = FXHorizontalFrame.new(base_frame, :opts => LAYOUT_FILL_X|LAYOUT_SIDE_TOP) @finishButton = FXButton.new(, "Finish" , nil, nil, :opts => BUTTON_NORMAL|LAYOUT_RIGHT) @finishButton.disable @finishButton.connect(SEL_COMMAND) do |sender, sel, item| #self.handle(self, FXSEL(SEL_COMMAND, ID_CANCEL), nil) self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil) end @cancelButton = FXButton.new(, "Cancel" , :target => self, :selector => FXDialogBox::ID_CANCEL, :opts => BUTTON_NORMAL|LAYOUT_RIGHT) end |
Instance Attribute Details
#workspace_dir ⇒ Object (readonly)
Returns the value of attribute workspace_dir.
6 7 8 |
# File 'lib/watobo/gui/workspace_dialog.rb', line 6 def workspace_dir @workspace_dir end |
Instance Method Details
#open_select_workspace_dir_dialog(sender, sel, ptr) ⇒ Object
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/watobo/gui/workspace_dialog.rb', line 8 def open_select_workspace_dir_dialog(sender, sel, ptr) workspace_dir = FXFileDialog.getOpenDirectory(self, "Select Workspace Directory", @workspace_dir.value) if workspace_dir != "" then if File.exists?(workspace_dir) then @workspace_dir.value = workspace_dir @workspace_dir.handle(self, FXSEL(SEL_UPDATE, 0), nil) updateProjectList(@workspace_dir.value) end end end |