ComponentTransitPtr LuaDebuggerInterface::generateSplitOptionListComponent(List* const Parent, const boost::any& Value, UInt32 Index, bool IsSelected, bool HasFocus) { ButtonRecPtr TheComponent = Button::create(); TheComponent->setBackgrounds(NULL); TheComponent->setAlignment(Vec2f(0.0f,0.5f)); std::string ValueString; try { ValueString = boost::any_cast<std::string>(Value); BoostPath IconPath; if(ValueString.compare("Horizontal") == 0) { IconPath = BoostPath(_BaseIconDir / BoostPath("view-split-left-right.png")); } else if(ValueString.compare("Vertical") == 0) { IconPath = BoostPath(_BaseIconDir / BoostPath("view-split-top-bottom.png")); } else { IconPath = BoostPath(_BaseIconDir / BoostPath("view-split-none.png")); } TheComponent->setImages(IconPath.string()); } catch (boost::bad_lexical_cast &) { //Could not convert to string } TheComponent->setText(ValueString); if(IsSelected) { LineBorderRecPtr LabelBorder = LineBorder::create(); LabelBorder->setWidth(1.0f); LabelBorder->setColor(Color4f(0.0f,0.0f,0.0f,1.0f)); TheComponent->setBorders(LabelBorder); } else { TheComponent->setBorders(NULL); } return ComponentTransitPtr(TheComponent); }
void LuaDebuggerInterface::createCodeEditor(void) { //Create the Breakpoint images BoostPath BreakpointIconPath(_BaseIconDir / BoostPath("breakpoint.png")), BreakpointDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-disabled.png")), BreakpointConditionalIconPath(_BaseIconDir / BoostPath("breakpoint-conditional.png")), BreakpointConditionalDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-conditional-disabled.png")), BreakpointCountIconPath(_BaseIconDir / BoostPath("breakpoint-count.png")), BreakpointCountDisabledIconPath(_BaseIconDir / BoostPath("breakpoint-count-disabled.png")); //Breakpoint Button prototypes //Regular Breakpoint ButtonRecPtr BreakpointProtoButton = Button::create(); BreakpointProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f)); BreakpointProtoButton->setImages(BreakpointIconPath.string()); BreakpointProtoButton->setDisabledImage(BreakpointDisabledIconPath.string()); BreakpointProtoButton->setBorders(NULL); BreakpointProtoButton->setBackgrounds(NULL); BreakpointProtoButton->setForegrounds(NULL); //Count Breakpoint ButtonRecPtr BreakpointCountProtoButton = Button::create(); BreakpointCountProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f)); BreakpointCountProtoButton->setImages(BreakpointCountIconPath.string()); BreakpointCountProtoButton->setDisabledImage(BreakpointCountDisabledIconPath.string()); BreakpointCountProtoButton->setBorders(NULL); BreakpointCountProtoButton->setBackgrounds(NULL); BreakpointCountProtoButton->setForegrounds(NULL); //Conditional breakpoint ButtonRecPtr BreakpointConditionalProtoButton = Button::create(); BreakpointConditionalProtoButton->setPreferredSize(Vec2f(18.0f, 18.0f)); BreakpointConditionalProtoButton->setImages(BreakpointConditionalIconPath.string()); BreakpointConditionalProtoButton->setDisabledImage(BreakpointConditionalDisabledIconPath.string()); BreakpointConditionalProtoButton->setBorders(NULL); BreakpointConditionalProtoButton->setBackgrounds(NULL); BreakpointConditionalProtoButton->setForegrounds(NULL); //Create the default font _CodeFont = UIFont::create(); _CodeFont->setFamily("Courier New"); _CodeFont->setSize(21); _CodeFont->setGlyphPixelSize(22); _CodeFont->setAntiAliasing(false); // Create a TextArea component _CodeTextArea = TextEditor::create(); _CodeTextArea->setIsSplit(false); _CodeTextArea->setClipboardVisible(false); //_CodeTextArea->getTextDomArea()->setFont(_CodeFont); //_CodeTextArea->setGutterWidth(50.0f); _CodeTextArea->setText(createDefaultCodeText()); //_CodeTextArea->connectCaretChanged(boost::bind(&LuaDebuggerInterface::codeAreaCaretChanged,this, _1)); //_CodeTextArea->connectMouseClicked(boost::bind(&LuaDebuggerInterface::handleCodeAreaMouseClicked,this, _1)); _MainSplitPanel = SplitPanel::create(); _MainSplitPanel->setMinComponent(_CodeTextArea); _MainSplitPanel->setMaxComponent(_InfoTabPanel); _MainSplitPanel->setOrientation(SplitPanel::VERTICAL_ORIENTATION); _MainSplitPanel->setDividerPosition(0.7); // location from the left/top _MainSplitPanel->setDividerSize(4); _MainSplitPanel->setMaxDividerPosition(.8); _MainSplitPanel->setMinDividerPosition(.2); //Code Area Info LabelRefPtr LineLabel = Label::create(); LineLabel->setText("Line:"); LineLabel->setPreferredSize(Vec2f(40.0f, 30.0f)); LineLabel->setAlignment(Vec2f(1.0f, 0.5f)); _LineValueLabel = Label::create(); _LineValueLabel->setText(""); _LineValueLabel->setPreferredSize(Vec2f(40.0f, 30.0f)); LabelRefPtr ColumnLabel = Label::create(); ColumnLabel->setText("Column:"); ColumnLabel->setPreferredSize(Vec2f(55.0f, 30.0f)); ColumnLabel->setAlignment(Vec2f(1.0f, 0.5f)); _ColumnValueLabel = Label::create(); _ColumnValueLabel->setText(""); _ColumnValueLabel->setPreferredSize(Vec2f(40.0f, 30.0f)); //TextArea Info Panel _CodeAreaInfoPanel = Panel::create(); SpringLayoutRefPtr CodeAreaInfoLayout = SpringLayout::create(); //ColumnValueLabel CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _ColumnValueLabel, 0, SpringLayoutConstraints::EAST_EDGE, _CodeAreaInfoPanel); //ColumnLabel CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, ColumnLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, ColumnLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, ColumnLabel, -1, SpringLayoutConstraints::WEST_EDGE, _ColumnValueLabel); //LineValueLabel CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, _LineValueLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, _LineValueLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, _LineValueLabel, -1, SpringLayoutConstraints::WEST_EDGE, ColumnLabel); //LineLabel CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::NORTH_EDGE, LineLabel, 0, SpringLayoutConstraints::NORTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::SOUTH_EDGE, LineLabel, 0, SpringLayoutConstraints::SOUTH_EDGE, _CodeAreaInfoPanel); CodeAreaInfoLayout->putConstraint(SpringLayoutConstraints::EAST_EDGE, LineLabel, -1, SpringLayoutConstraints::WEST_EDGE, _LineValueLabel); _CodeAreaInfoPanel->setPreferredSize(Vec2f(400.0f, 22.0f)); _CodeAreaInfoPanel->pushToChildren(LineLabel); _CodeAreaInfoPanel->pushToChildren(_LineValueLabel); _CodeAreaInfoPanel->pushToChildren(ColumnLabel); _CodeAreaInfoPanel->pushToChildren(_ColumnValueLabel); _CodeAreaInfoPanel->setBorders(NULL); _CodeAreaInfoPanel->setLayout(CodeAreaInfoLayout); }