Class: PathSelector

Inherits:
Object
  • Object
show all
Defined in:
lib/libGUIb16.rb,
lib/libGUIb16.rb,
lib/libGUIb14.rb,
lib/libGUIb14.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ PathSelector

Returns a new instance of PathSelector.



1209
1210
1211
1212
# File 'lib/libGUIb16.rb', line 1209

def initialize(parent)
  construct_widget_tree(parent)
  init if respond_to? :init
end

Instance Attribute Details

#__foxGUIb__last__Object

Returns the value of attribute __foxGUIb__last__.



1248
1249
1250
# File 'lib/libGUIb16.rb', line 1248

def __foxGUIb__last__
  @__foxGUIb__last__
end

#browseObject

Returns the value of attribute browse.



1248
1249
1250
# File 'lib/libGUIb16.rb', line 1248

def browse
  @browse
end

#directoryObject

Returns the value of attribute directory.



1589
1590
1591
# File 'lib/libGUIb16.rb', line 1589

def directory
  @directory
end

#filenameObject

Returns the value of attribute filename.



1589
1590
1591
# File 'lib/libGUIb16.rb', line 1589

def filename
  @filename
end

#labelObject

Returns the value of attribute label.



1248
1249
1250
# File 'lib/libGUIb16.rb', line 1248

def label
  @label
end

#PathSelectorObject

Returns the value of attribute PathSelector.



1248
1249
1250
# File 'lib/libGUIb16.rb', line 1248

def PathSelector
  @PathSelector
end

#relative_pathObject

Returns the value of attribute relative_path.



1589
1590
1591
# File 'lib/libGUIb16.rb', line 1589

def relative_path
  @relative_path
end

#textfieldObject

Returns the value of attribute textfield.



1248
1249
1250
# File 'lib/libGUIb16.rb', line 1248

def textfield
  @textfield
end

#titleObject

Returns the value of attribute title.



1589
1590
1591
# File 'lib/libGUIb16.rb', line 1589

def title
  @title
end

#topwinObject

Returns the value of attribute topwin.



1248
1249
1250
# File 'lib/libGUIb16.rb', line 1248

def topwin
  @topwin
end

Instance Method Details

#construct_widget_tree(parent) ⇒ Object



1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/libGUIb16.rb', line 1214

def construct_widget_tree(parent)
  @topwin =
    FX::HorizontalFrame.new(parent) { |w|
      @PathSelector = w
      w.padLeft = 0
      w.frameStyle = 0
      w.padRight = 0
      w.hSpacing = 2
      w.height = 21
      w.layoutHints = 1024
      FX::Label.new(@PathSelector) { |w|
        @label = w
        w.text = "Path:"
        w.width = 30
        w.x = 0
      }
      FX::TextField.new(@PathSelector) { |w|
        @textfield = w
        w.width = 291
        w.y = 0
        w.layoutHints = 1024
        w.x = 32
      }
      FX::Button.new(@PathSelector) { |w|
        @browse = w
        w.text = "Browse..."
        w.padLeft = 4
        w.width = 59
        w.padRight = 4
        w.y = 0
        w.x = 325
      }
    }
end

#descriptionObject



1594
1595
1596
# File 'lib/libGUIb16.rb', line 1594

def description
  @label.text
end

#description=(text) ⇒ Object



1590
1591
1592
# File 'lib/libGUIb16.rb', line 1590

def description=text
  @label.text = text
end

#initObject



1581
1582
1583
1584
1585
1586
1587
1588
# File 'lib/libGUIb16.rb', line 1581

def init
  @title = "Directory Dialog"
  @relative_path = false
  @directory = Dir.getwd
  update(@directory)
  @dialog = FXDirDialog.new(@topwin, @title)
  @browse.connect(SEL_COMMAND, method(:onBrowse))
end

#onBrowse(*args) ⇒ Object



1598
1599
1600
1601
1602
1603
1604
# File 'lib/libGUIb16.rb', line 1598

def onBrowse(*args)
  @dialog.title = @title
  @dialog.directory = @directory
  if @dialog.execute != 0
    update(@dialog.directory)
  end
end

#update(path) ⇒ Object



1606
1607
1608
1609
1610
1611
1612
# File 'lib/libGUIb16.rb', line 1606

def update(path)
  @directory = @textfield.text = if @relative_path
                 rel_path(Dir.getwd, path)
               else
                 path
               end
end