Class: FX::Container

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Container

Returns a new instance of Container.



1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
# File 'lib/libGUIb16.rb', line 1260

def initialize(parent)
  super
  boxMinusPNG_Str =
    "9805e474d0a0a1a0000000d09484442500000090000000904030000010568bb25b000000704794d4" \
    "54704d50016041822c41f2b600000090078495370000b0210000b021102ddde7cf000000407614d4" \
    "1400001bf8b0cf16500000009005c44554484848ffffff0000003e75793f000000229444144587ad" \
    "3606082062011a404cc82801c0402828c024a80221c2c28288584000525c10091d50980600000000" \
    "9454e444ea240628"
  boxPlusPNG_Str =
    "9805e474d0a0a1a0000000d09484442500000090000000904030000010568bb25b000000704794d4" \
    "54704d50016041c0ef71bcab00000090078495370000b0210000b021102ddde7cf000000407614d4" \
    "1400001bf8b0cf16500000009005c44554484848ffffff0000003e75793f000000729444144587ad" \
    "3606082062011a404cc8a801c0402828c024a8022142c2802a91505119840a8000c25a100daa1682" \
    "d9000000009454e444ea240628"
  self.padLeft = 0
  self.frameStyle = 12288
  self.layoutHints = Fox::LAYOUT_FILL_X
  self.padRight = 0
  @openIcon = Icon.LoadFromString boxMinusPNG_Str
  @closedIcon = Icon.LoadFromString boxPlusPNG_Str
  FX::Label.new(self) { |w|
    @header = w
    w.layoutHints = Fox::LAYOUT_FILL_X
    w.iconPosition = Fox::ICON_BEFORE_TEXT
    w.justify = Fox::JUSTIFY_LEFT
    w.icon = @openIcon.img
    @open = true
  }
  FX::HorizontalSeparator.new(self) { |w|
    @hsep = w
    w.padLeft = 0
    w.padRight = 0
  }
  @header.connect(SEL_LEFTBUTTONPRESS) {
    if @open
      close_body
    else
      open_body
    end
  }
end

Instance Attribute Details

#headerObject (readonly)

Returns the value of attribute header.



1259
1260
1261
# File 'lib/libGUIb16.rb', line 1259

def header
  @header
end

#hsepObject (readonly)

Returns the value of attribute hsep.



1259
1260
1261
# File 'lib/libGUIb16.rb', line 1259

def hsep
  @hsep
end

Instance Method Details

#close_bodyObject



1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
# File 'lib/libGUIb16.rb', line 1302

def close_body
  @open = false
  @header.icon = @closedIcon.img
  children.each { |ch|
    next if ch == @header
    ch.hide
  }
  if layoutHints & LAYOUT_FILL_Y == LAYOUT_FILL_Y
    self.layoutHints -= LAYOUT_FILL_Y
    @fill_y = true
  else
    @fill_y = false
  end
  recalc
end

#open_bodyObject



1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
# File 'lib/libGUIb16.rb', line 1318

def open_body
  @open = true
  @header.icon = @openIcon.img
  children.each { |ch|
    next if ch == @header
    ch.show
  }
  self.layoutHints |= LAYOUT_FILL_Y if @fill_y
  recalc
end

#titleObject



1333
1334
1335
# File 'lib/libGUIb16.rb', line 1333

def title
  @header.text
end

#title=(text) ⇒ Object



1329
1330
1331
# File 'lib/libGUIb16.rb', line 1329

def title=(text)
  @header.text = text
end