MCPcopy Create free account
hub / github.com/chieapp/chie / constructor

Method constructor

src/view/params-view.ts:320–347  ·  view source on GitHub ↗
(param: Param, nullable: boolean)

Source from the content-addressed store, hash-verified

318 icon?: Icon;
319
320 constructor(param: Param, nullable: boolean) {
321 super(param, gui.Container.create(), nullable);
322 this.editor.setStyle({flexDirection: 'row', gap: basicStyle.padding / 2});
323 this.imageView = new ToggleButton();
324 this.imageView.setSelected(true);
325 this.imageView.view.setStyle({
326 width: style.buttonSize,
327 height: style.buttonSize,
328 });
329 this.editor.addChildView(this.imageView.view);
330
331 // Button to choose an icon from the disk.
332 const editButton = gui.Button.create('Choose from disk...');
333 editButton.onClick = () => this.#chooseIconFromDisk();
334 this.editor.addChildView(editButton);
335
336 // Button to revert the icon to the default one in param.
337 this.revertButton = gui.Button.create('Use default icon');
338 this.revertButton.onClick = () => {
339 this.setValue(param.value);
340 this.onChange?.emit();
341 };
342 this.revertButton.setVisible(false);
343 this.editor.addChildView(this.revertButton);
344
345 if (param.value)
346 this.setValue(param.value);
347 }
348
349 getValue() {
350 return this.icon;

Callers

nothing calls this directly

Calls 3

#chooseIconFromDiskMethod · 0.95
setValueMethod · 0.95
setSelectedMethod · 0.45

Tested by

no test coverage detected