private IEnumerator <YieldAction> doUpdateThumbnails() { imageGrid.clear(); yield return(Coroutine.WaitSeconds(0.1f)); foreach (ThumbnailPickerInfo thumbProp in thumbnailProperties) { if (imageGrid == null) { yield break; } String imageId; using (FreeImageBitmap thumb = imageRenderer.renderImage(thumbProp.ImageProperties)) { imageId = thumbnailImages.addImage(thumb, thumb); } imageGrid.SuppressLayout = true; ButtonGridItem item = imageGrid.addItem("Main", "", imageId); item.UserObject = thumbProp; imageGrid.SuppressLayout = false; imageGrid.layout(); if (imageGrid.Count == 1) //Select first item { imageGrid.SelectedItem = imageGrid.getItem(0); } yield return(Coroutine.WaitSeconds(0.1f)); } }
private ColorMenu(ColorChosenDelegate colorChosenCallback, Action colorClearedCallback) : base("Anomalous.GuiFramework.GUI.ColorMenu.ColorMenu.layout") { this.colorChosenCallback = colorChosenCallback; this.colorClearedCallback = colorClearedCallback; colorGrid = new SingleSelectButtonGrid(widget.findWidget("ColorGrid") as ScrollView); for (int i = 0; i < 77; ++i) { ButtonGridItem item = colorGrid.addItem("Main", "", "Colors/" + i); item.UserObject = i; } colorGrid.SelectedValueChanged += new EventHandler(colorGrid_SelectedValueChanged); Button moreColorsButton = widget.findWidget("MoreColorsButton") as Button; if (RuntimePlatformInfo.ShowMoreColors) { moreColorsButton.MouseButtonClick += new MyGUIEvent(moreColorsButton_MouseButtonClick); } else { moreColorsButton.Visible = false; widget.setSize(widget.Width, widget.Height - (widget.Height - moreColorsButton.Top)); } this.Hidden += new EventHandler(ColorMenu_Hidden); Button clearColorButton = (Button)widget.findWidget("ClearColorButton"); clearColorButton.Visible = colorClearedCallback != null; clearColorButton.MouseButtonClick += clearColorButton_MouseButtonClick; }
private void addMedicalState(MedicalState state) { String imageId = imageAtlas.addImage(state, state.Thumbnail); ButtonGridItem entry = stateListBox.addItem("", state.Name, imageId); entry.UserObject = state; entries.Add(state, entry); entry.ItemClicked += entry_ItemClicked; }
public void addItemTemplate(AddItemTemplate itemTemplate) { itemTemplate.reset(); ButtonGridItem item = itemGrid.addItem(itemTemplate.Group, itemTemplate.TypeName, itemTemplate.ImageName); item.UserObject = itemTemplate; if (itemGrid.SelectedItem == null) { itemGrid.SelectedItem = item; } }
//void applyButton_MouseButtonClick(Widget source, EventArgs e) //{ // int numImagesToUpdate; // if (int.TryParse(numToUpdateEdit.Caption, out numImagesToUpdate)) // { // LiveThumbnailUpdater.NumImagesToUpdate = numImagesToUpdate; // } // double secondsToSleep; // if (double.TryParse(secondsToSleepEdit.Caption, out secondsToSleep)) // { // LiveThumbnailUpdater.SecondsToSleep = secondsToSleep; // } //} void addButton_MouseButtonClick(Widget source, EventArgs e) { SceneViewWindow activeWindow = sceneViewController.ActiveWindow; LayerState layers = new LayerState(); layers.captureState(); ButtonGridItem item = buttonGrid.addItem("Main", count++.ToString()); buttonGrid.resizeAndLayout(window.ClientWidget.Width); liveThumbHost.itemAdded(item, layers, activeWindow.Translation, activeWindow.LookAt); }
public IEnumerator <YieldAction> initialize() { this.clear(); yield return(Coroutine.WaitSeconds(0.1f)); foreach (PresetState state in loadPresets(subDirectory)) { if (presetListView == null) { yield break; } String fullImageName = subDirectory + "/" + state.ImageName; String imageKey = null; if (!imageAtlas.containsImage(fullImageName)) { try { using (Stream imageStream = context.ResourceProvider.openFile(fullImageName)) { using (var image = new FreeImageBitmap(imageStream)) { if (image != null) { imageKey = imageAtlas.addImage(fullImageName, image); image.Tag = fullImageName; } } } } catch (Exception) { Log.Error("Could not open image preview file {0}.", fullImageName); } } presetListView.SuppressLayout = true; ButtonGridItem item = presetListView.addItem(state.Category, state.Name, imageKey); item.UserObject = state; presetListView.SuppressLayout = false; presetListView.layout(); if (presetListView.Count == 1) //Select first item { defaultItem = presetListView.getItem(0); } yield return(Coroutine.WaitSeconds(0.1f)); } }
private void addNodes(BrowserNode node, BrowserNode defaultNode) { if (node.Value != null) { ButtonGridItem item = imageGrid.addItem("", node.Text); item.UserObject = node.Value; imageManager.loadThumbnail(node.Value.ToString(), FullImageWidth, FullImageHeight, (imageKey, size) => { item.setImage(imageKey); item.setImageSize(size.Width, size.Height, FullImageWidth + Inflation, FullImageHeight + Inflation); }); if (node == defaultNode) { imageGrid.SelectedItem = item; } } foreach (BrowserNode child in node.getChildIterator()) { addNodes(child, defaultNode); } }
void findSceneFiles() { try { VirtualFileSystem archive = VirtualFileSystem.Instance; String sceneDirectory = MedicalConfig.SceneDirectory; IEnumerable <String> files = archive.listFiles(sceneDirectory, "*.sim.xml", false); foreach (String file in files) { String fileName = VirtualFileSystem.GetFileName(file); String baseName = fileName.Substring(0, fileName.IndexOf('.')); String pictureFileName = sceneDirectory + "/" + baseName + ".png"; String imageKey = null; if (archive.exists(pictureFileName)) { using (Stream imageStream = archive.openStream(pictureFileName, Engine.Resources.FileMode.Open, Engine.Resources.FileAccess.Read)) { using (var image = new FreeImageBitmap(imageStream)) { if (image != null) { imageKey = imageAtlas.addImage(pictureFileName, image); } } } } ButtonGridItem item = sceneFileGrid.addItem("Main", baseName, imageKey); item.ItemClicked += new EventHandler(item_ItemClicked); item.UserObject = file; } if (sceneFileGrid.Count > 0) { sceneFileGrid.SelectedItem = sceneFileGrid.getItem(0); } } catch (Exception ex) { Logging.Log.Error("{0} loading scene files for ChooseScneDialog.\nMessage: {1}", ex.GetType().Name, ex.Message); } }