public void setViewTypeCategorized()
        {
            GuiEditorGui.GuiEditor GuiEditor = "GuiEditor";

            // Create rollouts for each class category we have and
            // record the classes in each category in a temporary array
            // on the rollout so we can later sort the class names before
            // creating the actual controls in the toolbox.

            string controls = Util.enumerateConsoleClassesByCategory("Gui");

            foreach (string className in controls.Split('\t'))
            {
                if (GuiEditor.isFilteredClass(className) ||
                    !Util.isMemberOfClass(className, "GuiControl"))
                {
                    continue;
                }

                // Get the class's next category under Gui.

                string category = Util.getWord(Util.getCategoryOfClass(className), 1);
                if (category == "")
                {
                    continue;
                }

                // Find or create the rollout for the category.

                GuiRolloutCtrl rollout = this.getOrCreateRolloutForCategory(category);

                // Insert the item.

                if (!rollout["classes"].AsBool())
                {
                    rollout["classes"] = new ObjectCreator("ArrayObject").Create().AsString();
                }

                ((ArrayObject)rollout["classes"]).push_back(className, "");
            }

            // Go through the rollouts, sort the class names, and
            // create the toolbox controls.

            for (uint i = 0; i < this.getCount(); i++)
            {
                GuiRolloutCtrl rollout = this.getObject(i);
                if (!rollout.isMemberOfClass("GuiRolloutCtrl"))
                {
                    continue;
                }

                // Get the array with the class names and sort it.
                // Sort in descending order to counter reversal of order
                // when we later add the controls to the stack.

                ArrayObject classes = rollout["classes"];
                classes.sortk(true);

                // Add a control for each of the classes to the
                // rollout's stack control.

                GuiDynamicCtrlArrayControl stack = rollout.FOT("array");
                int numClasses = classes.count();
                for (int n = 0; n < numClasses; n++)
                {
                    string className = classes.getKey(n);

                    #region GuiIconButtonCtrl ()        oc_Newobject3

                    ObjectCreator oc_Newobject3 = new ObjectCreator("GuiIconButtonCtrl", "",
                                                                    typeof(GuiEditorToolboxButton));
                    oc_Newobject3["profile"]    = "ToolsGuiIconButtonSmallProfile";
                    oc_Newobject3["extent"]     = "128 18";
                    oc_Newobject3["text"]       = className;
                    oc_Newobject3["iconBitmap"] = console.Call_Classname("EditorIconRegistry", "findIconByClassName",
                                                                         new string[] { className });
                    oc_Newobject3["buttonMargin"]   = "2 2";
                    oc_Newobject3["iconLocation"]   = "left";
                    oc_Newobject3["textLocation"]   = "left";
                    oc_Newobject3["textMargin"]     = "24";
                    oc_Newobject3["AutoSize"]       = new ObjectCreator.StringNoQuote("true");
                    oc_Newobject3["command"]        = "GuiEditor.createControl( " + className + " );";
                    oc_Newobject3["useMouseEvents"] = new ObjectCreator.StringNoQuote("true");

                    //TODO doesn't work for every control.
                    //oc_Newobject3["tooltip"] = className + '\n' + "\n" + Util.getDescriptionOfClass( className );
                    oc_Newobject3["tooltipProfile"] = "ToolsGuiToolTipProfile";

                    #endregion

                    GuiIconButtonCtrl ctrl = oc_Newobject3.Create();


                    stack.add(ctrl);
                }

                // Delete the temporary array.

                rollout["classes"] = "";
                classes.delete();
            }

            this.currentViewType = "Categorized";
        }