Class: MifareAccessConditionBuilder::MainWindow::SelectionDialog

Inherits:
FXDialogBox
  • Object
show all
Includes:
Fox
Defined in:
lib/mifare_access_condition_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data_or_trailer, *args) ⇒ SelectionDialog

Returns a new instance of SelectionDialog.



246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/mifare_access_condition_builder.rb', line 246

def initialize(data_or_trailer, *args)
  super(*args)

  if data_or_trailer == :data_key_b_readable || data_or_trailer == :data_key_b_secret
    FXLabel.new(self, "Mögliche Bit-Kombinationen für Datenblöcke:")

    FXMatrix.new(self, 7, MATRIX_BY_COLUMNS | LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) do |matrix|
      DataBitsHead.each do |labeltext|
        FXLabel.new(matrix, labeltext, nil, LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
      end

      DataBitsDesc.sort.each do |bits, (ws_descs, wr_descs, desc)|
        descs = (data_or_trailer == :data_key_b_readable ? wr_descs : ws_descs) + [desc]
        field = FXLabel.new(matrix, bits, nil, TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|TEXTFIELD_READONLY){|this| this.backColor = FXColor::LightGoldenrod1 }
        FXLabel.new(matrix,'->')
        for desc in descs
          FXLabel.new(matrix, desc, nil, TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|TEXTFIELD_READONLY) do |this|
            this.backColor = FXColor::LightGoldenrod1
            b = bits
            this.connect(SEL_LEFTBUTTONPRESS) do
              @selected_bits = b
              self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
            end
          end
        end
      end
    end
  elsif data_or_trailer == :trailer
    FXLabel.new(self, "Mögliche Bit-Kombinationen für Trailerblöcke:")

    FXMatrix.new(self, 9, MATRIX_BY_COLUMNS | LAYOUT_FILL_X, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) do |matrix|
      TrailerBitsHead.each do |labeltext|
        FXLabel.new(matrix, labeltext, nil, LAYOUT_FILL_COLUMN|LAYOUT_FILL_X)
      end

      TrailerBitsDesc.each do |bits, descs|
        field = FXLabel.new(matrix, bits, nil, TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|TEXTFIELD_READONLY){|this| this.backColor = FXColor::PaleGreen }
        FXLabel.new(matrix,'->')
        for desc in descs
          FXLabel.new(matrix, desc, nil, TEXTFIELD_NORMAL|LAYOUT_FILL_COLUMN|LAYOUT_FILL_X|TEXTFIELD_READONLY) do |this|
            this.backColor = FXColor::PaleGreen
            b = bits
            this.connect(SEL_LEFTBUTTONPRESS) do
              @selected_bits = b
              self.handle(self, FXSEL(SEL_COMMAND, ID_ACCEPT), nil)
            end
          end
        end
      end
    end
  end
end

Instance Attribute Details

#selected_bitsObject (readonly)

Returns the value of attribute selected_bits.



244
245
246
# File 'lib/mifare_access_condition_builder.rb', line 244

def selected_bits
  @selected_bits
end