void wxsGridBagSizer::OnBuildSizerCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/gbsizer.h>"),GetInfo().ClassName,hfInPCH); Codef(_T("%C(%s, %s);\n"), #if wxCHECK_VERSION(3, 0, 0) VGap.GetPixelsCode(GetCoderContext()).wx_str(), HGap.GetPixelsCode(GetCoderContext()).wx_str()); #else VGap.GetPixelsCode(GetCoderContext()).c_str(), HGap.GetPixelsCode(GetCoderContext()).c_str()); #endif wxArrayInt Cols = GetArray(GrowableCols); for ( size_t i=0; i<Cols.Count(); i++ ) { Codef(_T("%AAddGrowableCol(%d);\n"),Cols[i]); } wxArrayInt Rows = GetArray(GrowableRows); for ( size_t i=0; i<Rows.Count(); i++ ) { Codef(_T("%AAddGrowableRow(%d);\n"),Rows[i]); } return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsGridBagSizer::OnBuildSizerCreatingCode"),GetLanguage()); } } }
/*! \brief Create the initial control. * * \return void * */ void wxsFontPickerCtrl::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/fontpicker.h>"),GetInfo().ClassName,0); wxString sFntName = GetCoderContext()->GetUniqueName(_T("PickerFont")); wxString sFnt = m_fdFont.BuildFontCode(sFntName, GetCoderContext()); if ( sFnt.Len()==0 ) { sFntName = wxT("wxNullFont"); } Codef(_T("%s"), sFnt.wx_str()); Codef(_T("%C(%W, %I, %s, %P, %S, %T, %V, %N);\n"), sFntName.wx_str()); BuildSetupWindowCode(); return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsFontPickerCtrl::OnBuildCreatingCode"),GetLanguage()); } } }
/*! \brief Build the code that creates the control. * * \return void * */ void wxsLCDClock::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("\"wx/KWIC/LCDClock.h\""),GetInfo().ClassName); Codef(_T("%C(%W,%P,%S);\n")); // 6 digits is the default value. if (m_iNumDigits && m_iNumDigits != 6){ Codef(_T("%ASetNumberDigits(%d);\n"), static_cast<int>(m_iNumDigits)); } wxString ss = m_cdLightColour.BuildCode( GetCoderContext() ); if (!ss.IsEmpty()) Codef(_T("%ASetLightColour(%s);\n"), ss.wx_str()); ss = m_cdGrayColour.BuildCode( GetCoderContext() ); if (!ss.IsEmpty()) Codef(_T("%ASetGrayColour(%s);\n"), ss.wx_str()); BuildSetupWindowCode(); break; } default: wxsCodeMarks::Unknown(_T("wxsLCDClock::OnBuildCreatingCode"),GetLanguage()); } }
void wxsAxis::OnBuildCreatingCode() { wxString vname; wxString pname; wxString cname; wxString fname; wxString dtext; // we only know C++ language if (GetLanguage() != wxsCPP) wxsCodeMarks::Unknown(_T("wxsAxis::OnBuildCreatingCode"),GetLanguage()); // usefull names vname = GetVarName(); pname = GetParent()->GetVarName(); cname = vname + _("_PEN"); fname = vname + _("_FONT"); // the header for mathplot AddHeader(_T("<mathplot.h>"),GetInfo().ClassName,hfInPCH); // create the axis -- but not the setup code if (mType == 0) Codef(_T("%s = new mpScaleX(_(\"%s\"), %d, %b);\n"), vname.wx_str(), mLabel.wx_str(), mAlign, mTics); else Codef(_T("%s = new mpScaleY(_(\"%s\"), %d, %b);\n"), vname.wx_str(), mLabel.wx_str(), mAlign, mTics); // BuildSetupWindowCode(); // assign a pen to the layer dtext = mPenColour.BuildCode(GetCoderContext()); if (dtext.Len() > 0) { Codef(_T("wxPen %s(%s);\n"), cname.wx_str(), dtext.wx_str()); Codef(_T("%s->SetPen(%s);\n"), vname.wx_str(), cname.wx_str()); }; // assign a font to the layer dtext = mPenFont.BuildFontCode(fname, GetCoderContext()); if (dtext.Len() > 0) { Codef(_T("%s"), dtext.wx_str()); Codef(_T("%s->SetFont(%s);\n"), vname.wx_str(), fname.wx_str()); }; // add to parent window -- should be a mpWindow if ((GetPropertiesFlags() & flHidden) && GetBaseProps()->m_Hidden) ; // do nothing else Codef(_T("%s->AddLayer(%s);\n"), pname.wx_str(), vname.wx_str()); }
void wxsGridBagSizer::OnBuildCreatingCode() { OnBuildSizerCreatingCode(); bool UnknownLang = false; int Count = GetChildCount(); for ( int i=0; i<Count; i++ ) { wxsItem* Child = GetChild(i); wxsGridBagSizerExtra* _Extra = (wxsGridBagSizerExtra*)GetChildExtra(i); // Using same parent as we got, sizer is not a parent window Child->BuildCode(GetCoderContext()); switch ( Child->GetType() ) { case wxsTWidget: case wxsTContainer: case wxsTSizer: switch ( GetLanguage() ) { case wxsCPP: { Codef(_T("%AAdd(%o, %s);\n"),i,_Extra->AllParamsCode(GetCoderContext()).wx_str()); break; } case wxsUnknownLanguage: // fall-through default: { UnknownLang = true; } } break; case wxsTSpacer: // Spacer is responsible for adding itself into sizer break; case wxsTTool: // fall-through case wxsTInvalid: // fall-through default: break; } } if ( UnknownLang ) { wxsCodeMarks::Unknown(_T("wxsGridBagSizer::OnBuildCreatingCode"),GetLanguage()); } }
void wxsToolBarItem::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: switch ( m_Type ) { case Normal: case Radio: case Check: { const wxChar* ItemType; switch ( m_Type ) { case Normal: ItemType = _T("wxITEM_NORMAL"); break; case Radio: ItemType = _T("wxITEM_RADIO"); break; default: ItemType = _T("wxITEM_CHECK"); break; } wxString BitmapCode = m_Bitmap.BuildCode(true,_T(""),GetCoderContext(),_T("wxART_TOOLBAR")); wxString Bitmap2Code = m_Bitmap2.BuildCode(true,_T(""),GetCoderContext(),_T("wxART_TOOLBAR")); if ( BitmapCode.IsEmpty() ) BitmapCode = _T("wxNullBitmap"); if ( Bitmap2Code.IsEmpty() ) Bitmap2Code = _T("wxNullBitmap"); Codef(_T("%v = %MAddTool(%I, %t, %i, %i, %s, %t, %t);\n"), GetVarName().wx_str(), m_Label.wx_str(), &m_Bitmap,_T("wxART_TOOLBAR"), &m_Bitmap2,_T("wxART_TOOLBAR"), ItemType, m_ToolTip.wx_str(), m_HelpText.wx_str()); break; } case Separator: { Codef(_T("%MAddSeparator();\n")); break; } } break; default: wxsCodeMarks::Unknown(_T("wxsToolBarItem::OnBuildCreatingCode"),GetLanguage()); } }
/*! \brief Build the code that creates the control. * * \return void * */ void wxsLinearRegulator::OnBuildCreatingCode() { switch(GetLanguage()) { case wxsCPP: { AddHeader(_T("\"wx/KWIC/LinearRegulator.h\""), GetInfo().ClassName); Codef(_T("%C(%W,%I,%P,%S, %s);\n"), wxT("wxBORDER_NONE")); // Default range is 0-100. if(m_iRangeMin != 0 || m_iRangeMax != 100){ Codef(_T("%ASetRangeVal(%d, %d);\n"), static_cast<int>(m_iRangeMin), static_cast<int>(m_iRangeMax)); } if(!m_bHorizontal){ Codef(_T("%ASetOrizDirection(false);\n")); } if(!m_bShowVal){ Codef(_T("%AShowCurrent(false);\n")); } if(!m_bShowLimits){ Codef(_T("%AShowLimits(false);\n")); } wxString ss = m_cdActiveBarColour.BuildCode(GetCoderContext()); if(!ss.IsEmpty()) Codef(_T("%ASetActiveBarColour(%s);\n"), ss.wx_str()); ss = m_cdPassiveBarColour.BuildCode(GetCoderContext()); if(!ss.IsEmpty()) Codef(_T("%ASetPassiveBarColour(%s);\n"), ss.wx_str()); ss = m_cdBorderColour.BuildCode(GetCoderContext()); if(!ss.IsEmpty()) Codef(_T("%ASetBorderColour(%s);\n"), ss.wx_str()); ss = m_cdLimitTextColour.BuildCode(GetCoderContext()); if(!ss.IsEmpty()) Codef(_T("%ASetTxtLimitColour(%s);\n"), ss.wx_str()); ss = m_cdValueTextColour.BuildCode(GetCoderContext()); if(!ss.IsEmpty()) Codef(_T("%ASetTxtValueColour(%s);\n"), ss.wx_str()); ss = m_cdTagColour.BuildCode(GetCoderContext()); if(!ss.IsEmpty()) Codef(_T("%ASetTagsColour(%s);\n"), ss.wx_str()); for(size_t i = 0; i < m_arrTags.Count(); i++){ TagDesc *Desc = m_arrTags[i]; Codef(_T("\t%AAddTag(%d);\n"), Desc->val); } ss = GetCoderContext()->GetUniqueName(_T("LinearRegulatorFont")); wxString sFnt = m_fnt.BuildFontCode(ss, GetCoderContext()); if(sFnt.Len() > 0) { Codef(_T("%s"), sFnt.wx_str()); Codef(_T("%ASetTxtFont(%s);\n"), ss.wx_str()); } // Value needs to be set after other params for correct display. if(m_iValue){ Codef(_T("%ASetValue(%d);\n"), static_cast<int>(m_iValue)); } BuildSetupWindowCode(); break; } case wxsUnknownLanguage: // fall-through default: wxsCodeMarks::Unknown(_T("wxsLinearRegulator::OnBuildCreatingCode"), GetLanguage()); } }
void wxsMenu::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: AddHeader(_T("<wx/menu.h>"),GetInfo().ClassName,hfInPCH); if ( IsPointer() ) { // There's no Create() method for wxMenu so we call ctor only when creating pointer Codef(_T("%C();\n")); } for ( int i=0; i<GetChildCount(); i++ ) { GetChild(i)->BuildCode(GetCoderContext()); } if ( GetParent() && GetParent()->GetClassName()==_T("wxMenuBar") ) { Codef(_T("%MAppend(%O, %t);\n"),m_Label.wx_str()); } BuildSetupWindowCode(); break; case wxsUnknownLanguage: // fall-through default: wxsCodeMarks::Unknown(_T("wxsMenu::OnBuildCreatingCode"),GetLanguage()); } }
/*! \brief Create the initial control. * * \return void * */ void wxsAnimationCtrl::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/animate.h>"),GetInfo().ClassName,hfInPCH); wxString sAnimName = GetCoderContext()->GetUniqueName(_T("anim")); Codef(_T("\twxAnimation %s(%n);\n"), sAnimName.wx_str(), m_sAnimation.wx_str()); Codef(_T("%C(%W, %I, %s, %P, %S, %T, %N);\n"), sAnimName.wx_str()); if(!m_bmpInactive.IsEmpty()){ Codef(_T("%ASetInactiveBitmap(%i);\n"), &m_bmpInactive, _T("wxART_OTHER")); } if(m_bPlay){ Codef(_T("%APlay();\n")); } BuildSetupWindowCode(); return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsAnimationCtrl::OnBuildCreatingCode"),GetLanguage()); } } }
void wxsHtmlWindow::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/html/htmlwin.h>"),GetInfo().ClassName,0); Codef(_T("%C(%W, %I, %P, %S, %T, %N);\n")); if ( Borders.Value ) Codef(_T("%ASetBorders(%s);\n"),Borders.GetPixelsCode(GetCoderContext()).wx_str()); if ( !Url.empty() ) Codef(_T("%ALoadPage(%t);\n"),Url.wx_str()); else if ( !HtmlCode.empty() ) Codef(_T("%ASetPage(%t);\n"),HtmlCode.wx_str()); BuildSetupWindowCode(); break; } default: { wxsCodeMarks::Unknown(_T("wxsHtmlWindow::OnBuildCreatingCode"),GetLanguage()); } } }
void wxsColourDialog::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/colordlg.h>"),GetInfo().ClassName,hfInPCH); bool Defaults = true; if ( !m_ChooseFull ) Defaults = false; if ( m_Colour.m_type!=wxsCOLOUR_DEFAULT ) Defaults = false; if ( !Defaults ) { wxString ColourDataName = GetCoderContext()->GetUniqueName(_T("__ColourData")); #if wxCHECK_VERSION(2, 9, 0) Codef(_T("wxColourData %v;\n"),ColourDataName.wx_str()); #else Codef(_T("wxColourData %v;\n"),ColourDataName.c_str()); #endif if ( !m_ChooseFull ) { #if wxCHECK_VERSION(2, 9, 0) Codef(_T("%v.SetChooseFull(%b);\n"),ColourDataName.wx_str(),m_ChooseFull); #else Codef(_T("%v.SetChooseFull(%b);\n"),ColourDataName.c_str(),m_ChooseFull); #endif } if ( m_Colour.m_type != wxsCOLOUR_DEFAULT ) { #if wxCHECK_VERSION(2, 9, 0) Codef(_T("%v.SetColour(%l);\n"),ColourDataName.wx_str(),&m_Colour); #else Codef(_T("%v.SetColour(%l);\n"),ColourDataName.c_str(),&m_Colour); #endif } #if wxCHECK_VERSION(2, 9, 0) Codef(_T("%C(%W, &%v);\n"),ColourDataName.wx_str()); #else Codef(_T("%C(%W, &%v);\n"),ColourDataName.c_str()); #endif } else { Codef(_T("%C(%W);\n")); } BuildSetupWindowCode(); return; } default: { wxsCodeMarks::Unknown(_T("wxsColourDialog::OnBuildCreatingCode"),GetLanguage()); } } }
/*! \brief Create the dialogue. * * \return void * */ void wxsPrintDialog::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/printdlg.h>"),GetInfo().ClassName,hfInPCH); wxString sDataName = GetCoderContext()->GetUniqueName(_T("printDialogData")); AddDeclaration(wxString::Format(wxT("wxPrintDialogData *%s;"), sDataName.wx_str())); Codef(_T("\t%s = new wxPrintDialogData;\n"), sDataName.wx_str()); if(m_bEnableHelp){ Codef(_T("\t%s->EnableHelp(%b);\n"), sDataName.wx_str(), m_bEnableHelp); } if(!m_bEnablePageNumbers){ Codef(_T("\t%s->EnablePageNumbers(%b);\n"), sDataName.wx_str(), m_bEnablePageNumbers); } if(!m_bEnablePrintToFile){ Codef(_T("\t%s->EnablePrintToFile(%b);\n"), sDataName.wx_str(), m_bEnablePrintToFile); } if(m_bEnableSelection){ Codef(_T("\t%s->EnableSelection(%b);\n"), sDataName.wx_str(), m_bEnableSelection); if(m_bSelection){ Codef(_T("\t%s->SetSelection(%b);\n"), sDataName.wx_str(), m_bSelection); } } if(m_bCollate){ Codef(_T("\t%s->SetCollate(%b);\n"), sDataName.wx_str(), m_bCollate); } if(m_iFromPage > 0){ Codef(_T("\t%s->SetFromPage(%d);\n"), sDataName.wx_str(), m_iFromPage); } if(m_iToPage > 0){ Codef(_T("\t%s->SetToPage(%d);\n"), sDataName.wx_str(), m_iToPage); } if(m_iMinPage > 0){ Codef(_T("\t%s->SetMinPage(%d);\n"), sDataName.wx_str(), m_iMinPage); } if(m_iMaxPage > 0){ Codef(_T("\t%s->SetMaxPage(%d);\n"), sDataName.wx_str(), m_iMaxPage); } if(m_iNoCopies > 1){ Codef(_T("\t%s->SetNoCopies(%d);\n"), sDataName.wx_str(), m_iNoCopies); } Codef(_T("%C(%W, %v);\n"), sDataName.wx_str()); BuildSetupWindowCode(); return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsPrintDialog::OnBuildCreatingCode"),GetLanguage()); } } }
/*! \brief Create the initial control. * * \return void * */ void wxsHyperlinkCtrl::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/hyperlink.h>"),GetInfo().ClassName,hfInPCH); #if wxCHECK_VERSION(2, 9, 0) Codef(_T("%C(%W, %I, %t, %t, %P, %S, %T, %N);\n"),m_Label.wx_str(), m_URL.wx_str()); #else Codef(_T("%C(%W, %I, %t, %t, %P, %S, %T, %N);\n"),m_Label.c_str(), m_URL.c_str()); #endif wxString ss = m_NormalColour.BuildCode( GetCoderContext() ); #if wxCHECK_VERSION(2, 9, 0) if (!ss.IsEmpty()) Codef(_T("%ASetNormalColour(%s);\n"), ss.wx_str()); #else if (!ss.IsEmpty()) Codef(_T("%ASetNormalColour(%s);\n"), ss.c_str()); #endif ss = m_HoverColour.BuildCode( GetCoderContext() ); #if wxCHECK_VERSION(2, 9, 0) if (!ss.IsEmpty()) Codef(_T("%ASetHoverColour(%s);\n"), ss.wx_str()); #else if (!ss.IsEmpty()) Codef(_T("%ASetHoverColour(%s);\n"), ss.c_str()); #endif ss = m_VisitedColour.BuildCode( GetCoderContext() ); #if wxCHECK_VERSION(2, 9, 0) if (!ss.IsEmpty()) Codef(_T("%ASetVisitedColour(%s);\n"), ss.wx_str()); #else if (!ss.IsEmpty()) Codef(_T("%ASetVisitedColour(%s);\n"), ss.c_str()); #endif BuildSetupWindowCode(); return; } default: { wxsCodeMarks::Unknown(_T("wxsHyperlinkCtrl::OnBuildCreatingCode"),GetLanguage()); } } }
/*! \brief Create the dialogue. * * \return void * */ void wxsFontDialog::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/fontdlg.h>"),GetInfo().ClassName,hfInPCH); wxString sfontName = GetCoderContext()->GetUniqueName(_T("fontData")); Codef(_T("\twxFontData %s;\n"), sfontName.wx_str()); wxString sClr = m_cdColour.BuildCode(GetCoderContext()); if(!sClr.IsEmpty()) Codef(_T("\t%s.SetColour(%s);\n"), sfontName.wx_str(), sClr.wx_str()); if(!m_bEnableEffects) Codef(_T("\t%s.EnableEffects(%b);\n"), sfontName.wx_str(), m_bEnableEffects); Codef(_T("\t%s.SetInitialFont(*wxNORMAL_FONT);\n"), sfontName.wx_str()); // These functions are Windows only. if((wxPlatformInfo::Get().GetOperatingSystemId() & wxOS_WINDOWS) > 0){ if(!m_bShowHelp){ Codef(_T("\t%s.SetAllowSymbols(%b);\n"), sfontName.wx_str(), m_bAllowSymbols); } if(m_iMinSize > 0 || m_iMaxSize > 0){ Codef(_T("\t%s.SetRange(%d, %d);\n"), sfontName.wx_str(), m_iMinSize, m_iMaxSize); } if(m_bShowHelp){ Codef(_T("\t%s.SetShowHelp(%b);\n"), sfontName.wx_str(), m_bShowHelp); } } Codef(_T("%C(%W, %s);\n"), sfontName.wx_str()); BuildSetupWindowCode(); return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsFontDialog::OnBuildCreatingCode"),GetLanguage()); } } }
void wxsSpacer::OnBuildCreatingCode() { int Index = GetParent()->GetChildIndex(this); wxsSizerExtra* Extra = (wxsSizerExtra*) GetParent()->GetChildExtra(Index); if ( Extra == 0 ) return; switch ( GetLanguage() ) { case wxsCPP: { wxsSizeData& Size = GetBaseProps()->m_Size; if ( Size.DialogUnits ) { // We use 'SpacerSizes' extra variable to keep count of currently added spacer sizes // length of this extra string indicates current spacer size number wxString SizeName = GetCoderContext()->GetUniqueName(_T("__SpacerSize")); Codef(_T("wxSize %s = %z;\n") _T("%MAdd(%s.GetWidth(),%s.GetHeight(),%s);\n"), SizeName.wx_str(), &Size, SizeName.wx_str(), SizeName.wx_str(), Extra->AllParamsCode(GetCoderContext()).wx_str()); } else { Codef(_T("%MAdd(%d,%d,%s);\n"), (int)Size.X, (int)Size.Y, Extra->AllParamsCode(GetCoderContext()).wx_str()); } break; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsSpacer::OnBuildCreatingCode"),GetLanguage()); } } }
void wxsGridSizer::OnBuildSizerCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/sizer.h>"),GetInfo().ClassName,hfInPCH); Codef(_T("%C(%d, %d, %s, %s);\n"),Rows,Cols, VGap.GetPixelsCode(GetCoderContext()).wx_str(), HGap.GetPixelsCode(GetCoderContext()).wx_str()); return; } default: { wxsCodeMarks::Unknown(_T("wxsGridSizer::OnBuildSizerCreatingCode"),GetLanguage()); } } }
/*! \brief Enumerate the tool's properties. * * \param flags long The control flags. * \return void * */ void wxsImage::OnEnumToolProperties(cb_unused long Flags) { // starting a new build cycle m_IsBuilt = false; m_Context = GetCoderContext(); // details WXS_IMAGE(wxsImage, m_ImageData, _("Image"), _T("image")); WXS_ARRAYSTRING(wxsImage, m_ImageData, _("Image as Text"), _T("image_text"), _("item2")); WXS_BOOL(wxsImage, m_Include, _("Use Include File"), _T("use_include"), false); };
void wxsMultiChoiceDialog::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/choicdlg.h>"),GetInfo().ClassName,hfInPCH); wxString ChoicesName; if ( m_Content.GetCount() > 0 ) { ChoicesName = GetCoderContext()->GetUniqueName(_T("__wxMultiChoiceDialogChoices")); #if wxCHECK_VERSION(2, 9, 0) Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.wx_str(),(int)m_Content.GetCount()); #else Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.c_str(),(int)m_Content.GetCount()); #endif for ( size_t i = 0; i < m_Content.GetCount(); ++i ) { #if wxCHECK_VERSION(2, 9, 0) Codef(_T("\t%t%s\n"),m_Content[i].wx_str(),((i!=m_Content.GetCount()-1)?_T(","):_T(""))); #else Codef(_T("\t%t%s\n"),m_Content[i].c_str(),((i!=m_Content.GetCount()-1)?_T(","):_T(""))); #endif } Codef(_T("};\n")); } Codef(_T("%C(%W, %t, %t, %d, %s, %T, %P);\n"), #if wxCHECK_VERSION(2, 9, 0) m_Message.wx_str(), m_Caption.wx_str(), (int)m_Content.GetCount(), (m_Content.IsEmpty()?_T("0"):ChoicesName.wx_str())); #else m_Message.c_str(), m_Caption.c_str(), (int)m_Content.GetCount(), (m_Content.IsEmpty()?_T("0"):ChoicesName.c_str())); #endif BuildSetupWindowCode(); return; } default: { wxsCodeMarks::Unknown(_T("wxsMultiChoiceDialog::OnBuildCreatingCode"),GetLanguage()); } } }
void wxsCustomWidget::OnBuildCreatingCode() { if ( GetCoderFlags() & flSource ) { if ( !m_IncludeFile.IsEmpty() ) { if ( m_IncludeIsLocal ) AddHeader(_T("\"") + m_IncludeFile + _T("\""), GetUserClass(), 0); else AddHeader(_T("<") + m_IncludeFile + _T(">"), GetUserClass(), 0); } } wxString Result = m_CreatingCode; Result.Replace(_T("$(POS)"),Codef(GetCoderContext(),_T("%P"))); Result.Replace(_T("$(SIZE)"),Codef(GetCoderContext(),_T("%S"))); Result.Replace(_T("$(STYLE)"),m_Style); Result.Replace(_T("$(ID)"),GetIdName()); Result.Replace(_T("$(THIS)"),GetVarName()); Result.Replace(_T("$(PARENT)"),GetCoderContext()->m_WindowParent); Result.Replace(_T("$(NAME)"),Codef(GetCoderContext(),_T("%N"))); Result.Replace(_T("$(CLASS)"),GetUserClass()); AddBuildingCode(Result+_T("\n")); }
/*! \brief Enumerate the tool's properties. * * \param flags long The control flags. * \return void * */ void wxsImageList::OnEnumToolProperties(long Flags) { // starting a new build cycle m_IsBuilt = false; m_Context = GetCoderContext(); // details for the image list WXS_IMAGELIST(wxsImageList, m_ImageData, _T("Image List"), _T("image_list")); WXS_ARRAYSTRING(wxsImageList, m_ImageData, _("Images as Text"), _T("image_text"), _T("item2")); WXS_LONG(wxsImageList, m_Width, _("Image Width"), _T("image_width"), 16); WXS_LONG(wxsImageList, m_Height, _("Image Height"), _T("image_height"), 16); WXS_LONG(wxsImageList, m_Count, _("Image Count"), _T("image_count"), 0); WXS_BOOL(wxsImageList, m_Include, _("Use Include File"), _T("use_include"), false); };
/*! \brief Create the dialogue. * * \return void * */ void wxsRichTextStyleOrganiserDialog::OnBuildCreatingCode() { wxString sFlags; wxString sStyleSheetName = GetCoderContext()->GetUniqueName(_T("richTextStyleSheet")); switch(GetLanguage()) { case wxsCPP: AddHeader(_T(" <wx/richtext/richtextstyledlg.h>"), GetInfo().ClassName, 0); for(int i = 0;arrStyleValueNames[i];i++){ if(m_iFlags & arrStyleValues[i]){ sFlags << arrStyleValueNames[i] << _T("|"); } } if(sFlags.IsEmpty()){ sFlags = _T("0"); } else{ sFlags.RemoveLast(); } #if wxCHECK_VERSION(2, 9, 0) AddDeclaration(wxString::Format(wxT("wxRichTextStyleSheet *%s;"), sStyleSheetName.wx_str())); Codef(_T("\t%s = new wxRichTextStyleSheet;\n"), sStyleSheetName.wx_str()); #else AddDeclaration(wxString::Format(wxT("wxRichTextStyleSheet *%s;"), sStyleSheetName.c_str())); Codef(_T("\t%s = new wxRichTextStyleSheet;\n"), sStyleSheetName.c_str()); #endif #if wxCHECK_VERSION(2, 9, 0) Codef(_T("%C(%s, %s, NULL, %W, %I, %t, ") wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, ") wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, ") wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE);\n"), sFlags.wx_str(), sStyleSheetName.wx_str(), m_sCaption.wx_str()); #else Codef(_T("%C(%s, %s, NULL, %W, %I, %t, ") wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_POSITION, ") wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_SIZE, ") wxT("SYMBOL_WXRICHTEXTSTYLEORGANISERDIALOG_STYLE);\n"), sFlags.c_str(), sStyleSheetName.c_str(), m_sCaption.c_str()); #endif BuildSetupWindowCode(); break; default: wxsCodeMarks::Unknown(_T("wxsRichTextStyleOrganiserDialog::OnBuildCreatingCode"), GetLanguage()); } }
void wxsLed::OnBuildCreatingCode() { wxString ss = m_Disable.BuildCode(GetCoderContext()); wxString ss2 = m_EnableOn.BuildCode(GetCoderContext()); wxString ss3 = m_EnableOff.BuildCode(GetCoderContext()); switch ( GetLanguage()) { case wxsCPP: AddHeader(_T("<wx/led.h>"),GetInfo().ClassName); Codef(_T("%C(%W,%I,%s,%s,%s,%P,%S);\n"), ss.wx_str(), ss2.wx_str(), ss3.wx_str()); if ( !GetBaseProps()->m_Enabled) Codef(_T("%ADisable();\n")); if(m_State) Codef(_T("%ASwitchOn();\n")); else Codef(_T("%ASwitchOff();\n")); break; default: wxsCodeMarks::Unknown(_T("wxsLed::OnBuildCreatingCode"),GetLanguage()); } }
void wxsLedNumber::OnBuildCreatingCode() { wxString FGCol = GetBaseProps()->m_Fg.BuildCode(GetCoderContext()); wxString BGCol = GetBaseProps()->m_Bg.BuildCode(GetCoderContext()); switch ( GetLanguage() ) { case wxsCPP: AddHeader(_T("<wx/gizmos/ledctrl.h>"),GetInfo().ClassName); Codef( _T("%C(%W,%I,%P,%S,%d|wxFULL_REPAINT_ON_RESIZE %s);\n"), Align, (Faded ? "| wxLED_DRAW_FADED" : "")); Codef( _T( "%ASetMinSize( %S);\n")); if ( !FGCol.empty() ) Codef( _T("%ASetForegroundColour(%s);\n"),FGCol.wx_str()); if ( !BGCol.empty() ) Codef( _T("%ASetBackgroundColour(%s);\n"),BGCol.wx_str()); if( Content.Len() > 0) Codef( _T( "%ASetValue( _T(\"%s\"));\n"), Content.wx_str()); break; default: wxsCodeMarks::Unknown(_T("wxsLedNumber::OnBuildCreatingCode"),GetLanguage()); } }
void wxsRadioBox::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/radiobox.h>"),GetInfo().ClassName,hfInPCH); // wxRadioBox does not have Append Function , therefore , have to build a wxString[] // to pass in to the ctor wxString ChoicesName; if ( ArrayChoices.GetCount() > 0 ) { ChoicesName = GetCoderContext()->GetUniqueName(_T("__wxRadioBoxChoices")); Codef(_T("wxString %s[%d] = \n{\n"),ChoicesName.wx_str(),(int)ArrayChoices.GetCount()); for ( size_t i = 0; i < ArrayChoices.GetCount(); ++i ) { Codef(_T("\t%t%s\n"),ArrayChoices[i].wx_str(),((i!=ArrayChoices.GetCount()-1)?_T(","):_T(""))); } Codef(_T("};\n")); } if ( Dimension < 1 ) Dimension = 1; Codef(_T("%C(%W, %I, %t, %P, %S, %d, %s, %d, %T, %V, %N);\n"), Label.wx_str(),ArrayChoices.GetCount(), (ArrayChoices.IsEmpty()?_T("0"):ChoicesName.wx_str()), Dimension); if ( DefaultSelection >= 0 && DefaultSelection < (int)ArrayChoices.GetCount() ) { Codef( _T("%ASetSelection(%d);\n"), DefaultSelection); } BuildSetupWindowCode(); return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsRadioBox::OnBuildCreatingCode"),GetLanguage()); } } }
void wxsMenuBar::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: AddHeader(_T("<wx/menu.h>"),GetInfo().ClassName,hfInPCH); Codef(_T("%C();\n")); for ( int i=0; i<GetChildCount(); i++ ) { GetChild(i)->BuildCode(GetCoderContext()); } Codef(_T("%MSetMenuBar(%O);\n")); BuildSetupWindowCode(); break; case wxsUnknownLanguage: // fall-through default: wxsCodeMarks::Unknown(_T("wxsMenuBar::OnBuildCreatingCode"),GetLanguage()); } }
void wxsContainer::AddChildrenCode() { switch ( GetLanguage() ) { case wxsCPP: { wxsCoderContext* Context = GetCoderContext(); if ( !Context ) return; // Update parent in context and clear flRoot flag wxString PreviousParent = Context->m_WindowParent; Context->m_WindowParent = Codef(Context,_T("%O")); for ( int i=0; i<GetChildCount(); i++ ) { wxsItem* Child = GetChild(i); Child->BuildCode(Context); if ( Child->GetType() == wxsTSizer ) { // TODO: Is this right place to set-up sizer ? Codef(_T("%ASetSizer(%o);\n"),i); } } if ( IsRootItem() ) { // Adding all tools before calling Fit and SetSizeHints() wxsItemResData* Data = GetResourceData(); if ( Data ) { for ( int i=0; i<Data->GetToolsCount(); i++ ) { Data->GetTool(i)->BuildCode(Context); } } } for ( int i=0; i<GetChildCount(); i++ ) { wxsItem* Child = GetChild(i); if ( Child->GetType() == wxsTSizer ) { if ( GetBaseProps()->m_Size.IsDefault ) { wxString ChildAccessPrefix = Child->GetAccessPrefix(GetLanguage()); Codef(_T("%sFit(%O);\n"),ChildAccessPrefix.wx_str()); Codef(_T("%sSetSizeHints(%O);\n"),ChildAccessPrefix.wx_str()); } else { wxString ChildVarName = Child->GetVarName(); Codef(_T("SetSizer(%s);\n"), ChildVarName.wx_str()); Codef(_T("Layout();\n")); } } } Context->m_WindowParent = PreviousParent; return; } case wxsUnknownLanguage: default: { wxsCodeMarks::Unknown(_T("wxsContainer::AddChildrenCode"),GetLanguage()); } } }
void wxsGLCanvas::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/glcanvas.h>"), GetInfo().ClassName, 0); // Generate unique name for attributes variable wxString aname = GetCoderContext()->GetUniqueName( _T("GLCanvasAttributes") ); // Generate attributes array Codef( _T("int %v[] = {\n" ), aname.wx_str() ); if ( mRGBA ) { Codef( _T("\tWX_GL_RGBA,\n") ); } if ( !mRGBA && mBufferSize > 0 ) { Codef( _T("\tWX_GL_BUFFER_SIZE, %d,\n"), mBufferSize ); } if ( mLevel ) { Codef( _T("\tWX_GL_LEVEL, %d,\n"), mLevel ); } if ( mDoubleBuffer ) { Codef( _T("\tWX_GL_DOUBLEBUFFER,\n") ); } if ( mStereo ) { Codef( _T("\tWX_GL_STEREO,\n") ); } if ( mAuxBuffers > 0 ) { Codef( _T("\tWX_GL_AUX_BUFFERS, %d,\n"), mAuxBuffers ); } if ( mMinRed > 0 ) { Codef( _T("\tWX_GL_MIN_RED, %d,\n"), mMinRed ); } if ( mMinGreen > 0 ) { Codef( _T("\tWX_GL_MIN_GREEN, %d,\n"), mMinGreen ); } if ( mMinBlue > 0 ) { Codef( _T("\tWX_GL_MIN_BLUE, %d,\n"), mMinBlue ); } if ( mMinAlpha > 0 ) { Codef( _T("\tWX_GL_MIN_ALPHA, %d,\n"), mMinAlpha ); } if ( mDepthSize >= 0 ) { int size = ( mDepthSize <= 16 ) ? 16 : 32; Codef( _T("\tWX_GL_DEPTH_SIZE, %d,\n"), size ); } if ( mStencilSize >= 0 ) { Codef( _T("\tWX_GL_STENCIL_SIZE, %d,\n"), mStencilSize ); } if ( mMinAccumRed > 0 ) { Codef( _T("\tWX_GL_MIN_ACCUM_RED, %d,\n"), mMinAccumRed ); } if ( mMinAccumGreen > 0 ) { Codef( _T("\tWX_GL_MIN_ACCUM_GREEN, %d,\n"), mMinAccumGreen ); } if ( mMinAccumBlue > 0 ) { Codef( _T("\tWX_GL_MIN_ACCUM_BLUE, %d,\n"), mMinAccumBlue ); } if ( mMinAccumAlpha > 0 ) { Codef( _T("\tWX_GL_MIN_ACCUM_ALPHA, %d,\n"), mMinAccumAlpha ); } // We padd the attributes table with two zeros instead of one // just to be sure that messy code (ours or from wxWidgets) // don't crash because of lack of second argument Codef( _T("\t0, 0 };\n") ); // Now we can create our window Codef(_T("%C(%W, %I, %P, %S, %T, %N, %v);\n"),aname.wx_str()); BuildSetupWindowCode(); break; } default: { wxsCodeMarks::Unknown(_T("wxsGLCanvas::OnBuildCreatingCode"),GetLanguage()); } }; }
void wxsMenuItem::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: switch ( m_Type ) { case Normal: { if ( GetChildCount() ) { // Creating new wxMenu if ( IsPointer() ) { Codef(_T("%C();\n")); } for ( int i=0; i<GetChildCount(); i++ ) { GetChild(i)->BuildCode(GetCoderContext()); } // Many parameters are passed in wxMenu::Append, so we call this function // here, not in wxMenu Codef(_T("%MAppend(%I, %t, %O, %t)%s;\n"), m_Label.wx_str(), m_Help.wx_str(), m_Enabled?_T(""):_T("->Enable(false)")); break; } } // Fall through /* case Normal: */ case Radio: case Check: { wxString Text = m_Label; if ( !m_Accelerator.IsEmpty() ) { Text.Append(_T('\t')); Text.Append(m_Accelerator); } const wxChar* ItemType; switch ( m_Type ) { case Normal: ItemType = _T("wxITEM_NORMAL"); break; case Radio: ItemType = _T("wxITEM_RADIO"); break; default: ItemType = _T("wxITEM_CHECK"); break; } Codef(_T("%C(%E, %I, %t, %t, %s);\n"), Text.wx_str(), m_Help.wx_str(), ItemType); if ( !m_Bitmap.IsEmpty() ) { Codef(_T("%ASetBitmap(%i);\n"), &m_Bitmap, _T("wxART_OTHER")); } Codef(_T("%MAppend(%O);\n")); if ( !m_Enabled ) { Codef(_T("%AEnable(false);\n")); } if ( m_Checked && (m_Type==Check) ) { Codef(_T("%ACheck(true);\n")); } break; } case Separator: { Codef(_T("%MAppendSeparator();\n")); break; } case Break: { Codef(_T("%MBreak();\n")); break; } } BuildSetupWindowCode(); break; case wxsUnknownLanguage: // fall-through default: wxsCodeMarks::Unknown(_T("wxsMenuItem::OnBuildCreatingCode"),GetLanguage()); } }
void wxsVector::OnBuildCreatingCode() { int i,n; wxString vname; wxString pname; wxString cname; wxString fname; wxString xname; wxString yname; wxString dtext; wxString s; // we only know C++ language if (GetLanguage() != wxsCPP) wxsCodeMarks::Unknown(_T("wxsVector::OnBuildCreatingCode"),GetLanguage()); // usefull names vname = GetVarName(); pname = GetParent()->GetVarName(); cname = vname + _("_PEN"); fname = vname + _("_FONT"); xname = vname + _("_X"); yname = vname + _("_Y"); // the header for mathplot AddHeader(_T("<mathplot.h>"),GetInfo().ClassName,hfInPCH); // create the vector -- but not the setup code Codef(_T("%s = new mpFXYVector(_(\"%s\"), %d);\n"), vname.wx_str(), mLabel.wx_str(), mAlign); // BuildSetupWindowCode(); // assign a pen to the layer dtext = mPenColour.BuildCode(GetCoderContext()); if (dtext.Len() > 0) { Codef(_T("wxPen %s(%s);\n"), cname.wx_str(), dtext.wx_str()); Codef(_T("%s->SetPen(%s);\n"), vname.wx_str(), cname.wx_str()); }; // assign a font to the layer dtext = mPenFont.BuildFontCode(fname, GetCoderContext()); if (dtext.Len() > 0) { Codef(_T("%s"), dtext.wx_str()); Codef(_T("%s->SetFont(%s);\n"), vname.wx_str(), fname.wx_str()); }; // define the arrays dtext = _("std::vector<double> ") + xname + _(";"); AddDeclaration(dtext); dtext = _("std::vector<double> ") + yname + _(";"); AddDeclaration(dtext); // assign the data ParseXY(); n = mXs.GetCount(); if (n > 0) { for(i=0; i<n; i++) { Codef(_T("%s.push_back(%s); %s.push_back(%s);\n"), xname.wx_str(), mXs[i].wx_str(), yname.wx_str(), mYs[i].wx_str()); }; Codef(_T("%ASetData(%s, %s);\n"), xname.wx_str(), yname.wx_str()); }; // draw as points or a continuous line Codef(_T("%ASetContinuity(%b);\n"), mContinuous); // add to parent window -- should be a mpWindow if ((GetPropertiesFlags() & flHidden) && GetBaseProps()->m_Hidden) n = 0; // do nothing else Codef(_T("%s->AddLayer(%s);\n"), pname.wx_str(), vname.wx_str()); }
void wxsGrid::OnBuildCreatingCode() { switch ( GetLanguage() ) { case wxsCPP: { AddHeader(_T("<wx/grid.h>"),GetInfo().ClassName,0); AddHeader(_T("<wx/grid.h>"),_T("wxGridEvent"),0); Codef( _T("%C(%W, %I, %P, %S, %T, %N);\n") ); if ( GetPropertiesFlags() & flSource ) { if ( m_ColsCount>=0 && m_RowsCount>=0 && (m_ColsCount>0 || m_RowsCount>0) ) { Codef( _T("%ACreateGrid(%d,%d);\n"), m_RowsCount, m_ColsCount ); BuildSetupWindowCode(); Codef( _T("%AEnableEditing(%b);\n"), !m_ReadOnly); Codef( _T("%AEnableGridLines(%b);\n"), m_GridLines); if (m_LabelRowHeight > 0) Codef(_T("%ASetColLabelSize(%d);\n"), m_LabelRowHeight); if (m_LabelColWidth > 0) Codef(_T("%ASetRowLabelSize(%d);\n"), m_LabelColWidth); if (m_DefaultRowSize > 0) Codef(_T("%ASetDefaultRowSize(%d, %b);\n"), m_DefaultRowSize, true); if (m_DefaultColSize > 0) Codef(_T("%ASetDefaultColSize(%d, %b);\n"), m_DefaultColSize, true); wxString ss = m_LabelTextColour.BuildCode( GetCoderContext() ); if (ss.Len() > 0) Codef(_T("%ASetLabelTextColour(%s);\n"), ss.wx_str()); ss = GetCoderContext()->GetUniqueName( _T("GridLabelFont") ); wxString tt = m_LabelFont.BuildFontCode(ss, GetCoderContext()); if (tt.Len() > 0) { Codef(_T("%s"), tt.wx_str()); Codef(_T("%ASetLabelFont(%s);\n"), ss.wx_str()); } int n = wxMin( (int)m_ColLabels.GetCount(), m_ColsCount ); for ( int i=0; i<n; i++ ) { Codef(_T("%ASetColLabelValue(%d, %t);\n"), i, m_ColLabels[i].wx_str()); } n = wxMin( (int)m_RowLabels.GetCount(), m_RowsCount ); for ( int i=0; i<n; i++) { Codef(_T("%ASetRowLabelValue(%d, %t);\n"), i, m_RowLabels[i].wx_str()); } n = (int)m_CellText.GetCount(); int i = 0; for ( int j=0; j<m_RowsCount && i<n; j++ ) { for ( int k=0; k<m_ColsCount && i<n; k++, i++ ) { Codef( _T("%ASetCellValue(%d, %d, %t);\n"), j, k, m_CellText[i].wx_str()); } } // default cell font and text colour Codef(_T("%ASetDefaultCellFont( %AGetFont() );\n")); Codef(_T("%ASetDefaultCellTextColour( %AGetForegroundColour() );\n")); } } return; } case wxsUnknownLanguage: // fall-through default: { wxsCodeMarks::Unknown(_T("wxsGrid::OnBuildCreatingCode"),GetLanguage()); } } }