예제 #1
0
        public void addItemSelector(string displayText)
        {
            // add a new item selector
            // determine new index for item
            int          idx  = mItemSelectorContainer.Count;
            ItemSelector item = new ItemSelector();

            mItemSelectorContainer.Add(item);

            // create new checkbox
            Checkbox checkbox = item.CheckBoxWidget = new Checkbox(Window.getCPtr(
                                                                       WindowManager.Instance.CreateWindow("TaharezLook/Checkbox",
                                                                                                           "ItemCheckbox" + idx.ToString())).Handle, false);

            // set checkbox ID to selector ID
            checkbox.setID((uint)idx);
            checkbox.setMetricsMode(CeguiDotNet.MetricsMode.Absolute);
            checkbox.SetSize(100, ITEM_YSIZE);
            checkbox.setText(displayText);
            checkbox.setHoverTextColour(new CeguiDotNet.colour(1.0f, 1.0f, 0.0f));

            // add event handler for when checkbox state changes
            checkbox.SubscribeEvents();
            checkbox.CheckStateChanged += new WindowEventDelegate(handleCheckStateChanged);
            checkbox.SetPosition(0.0f, 12.0f + (ITEM_YSIZE + ITEM_YSPACING) * (float)idx);
            // add checkbox to the scroll pane
            mScrollablePane.AddChildWindow(checkbox);
        }