void wxsDialog::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            AddHeader(_T("<wx/dialog.h>"),GetInfo().ClassName,hfInPCH);
            Codef(_T("%C(%W, %I, %t, wxDefaultPosition, wxDefaultSize, %T, %N);\n"),Title.wx_str());
            if ( !GetBaseProps()->m_Size.IsDefault || (GetPropertiesFlags()&flSource && IsRootItem() && GetBaseProps()->m_SizeFromArg) )
            {
                Codef(_T("%ASetClientSize(%S);\n"));
            }
            if ( !GetBaseProps()->m_Position.IsDefault || (GetPropertiesFlags()&flSource && IsRootItem() && GetBaseProps()->m_PositionFromArg) )
            {
                Codef(_T("%AMove(%P);\n"));
            }
            BuildSetupWindowCode();
            AddChildrenCode();
            if ( Centered )
            {
                Codef(_T("%ACenter();\n"));
            }

            return;
        }

        case wxsUnknownLanguage: // fall-through
        default:
        {
            wxsCodeMarks::Unknown(_T("wxsDialog::OnBuildCreatingCode"),GetLanguage());
        }
    }
}
wxsLedNumber::wxsLedNumber(wxsItemResData* Data) : wxsWidget( Data, &Reg.Info, NULL, NULL, flVariable | flId | flPosition | flSize | flColours | flMinMaxSize | flExtraCode)
{
    //ctor
    Content      = _("");
    Align        = wxLED_ALIGN_LEFT;
    Faded        = true;
    GetBaseProps()->m_Fg = wxColour( 0, 255, 0);
    GetBaseProps()->m_Bg = wxColor( 0 ,0 ,0);
}
Beispiel #3
0
wxObject* wxsSpacer::OnBuildPreview(wxWindow* Parent,long Flags)
{
    if ( Flags & pfExact )
    {
        wxSize Sz = GetBaseProps()->m_Size.GetSize(Parent);
        return new wxSizerItem(Sz.GetWidth(),Sz.GetHeight(),0,0,0,0);
    }
    return new wxsSpacerPreview(Parent,GetBaseProps()->m_Size.GetSize(Parent));
}
wxObject* wxsLedNumber::OnBuildPreview(wxWindow* Parent,long Flags)
{
    wxLEDNumberCtrl* test = new wxLEDNumberCtrl(Parent,GetId(),Pos(Parent),Size(Parent), Align|wxFULL_REPAINT_ON_RESIZE);
    test->SetMinSize( Size( Parent));

    test->SetForegroundColour(GetBaseProps()->m_Fg.GetColour());
    test->SetBackgroundColour(GetBaseProps()->m_Bg.GetColour());

    if( Content.Len() > 0)
        test->SetValue( Content);

    test->SetDrawFaded( Faded);

    return test;
}
Beispiel #5
0
void wxsFrame::OnBuildCreatingCode()
{
    switch ( GetLanguage() )
    {
        case wxsCPP:
        {
            AddHeader(_T("<wx/frame.h>"),GetInfo().ClassName,hfInPCH);
            #if wxCHECK_VERSION(2, 9, 0)
            Codef(_T("%C(%W, %I, %t, wxDefaultPosition, wxDefaultSize, %T, %N);\n"),Title.wx_str());
            #else
            Codef(_T("%C(%W, %I, %t, wxDefaultPosition, wxDefaultSize, %T, %N);\n"),Title.c_str());
            #endif
            if ( !GetBaseProps()->m_Size.IsDefault || (GetPropertiesFlags()&flSource && IsRootItem() && GetBaseProps()->m_SizeFromArg) )
            {
                Codef(_T("%ASetClientSize(%S);\n"));
            }
            if ( !GetBaseProps()->m_Position.IsDefault || (GetPropertiesFlags()&flSource && IsRootItem() && GetBaseProps()->m_PositionFromArg) )
            {
                Codef(_T("%AMove(%P);\n"));
            }
            BuildSetupWindowCode();
            if ( !Icon.IsEmpty() )
            {
                AddHeader(_T("<wx/icon.h>"), GetInfo().ClassName, hfLocal);
                Codef(
                    _T("{\n")
                    _T("\twxIcon FrameIcon;\n")
                    _T("\tFrameIcon.CopyFromBitmap(%i);\n")
                    _T("\t%ASetIcon(FrameIcon);\n")
                    _T("}\n"),
                        &Icon,_T("wxART_FRAME_ICON"));
            }

            AddChildrenCode();
            if ( Centered )
            {
                Codef(_T("%ACenter();\n"));
            }

            return;
        }

        default:
        {
            wxsCodeMarks::Unknown(_T("wxsFrame::OnBuildCreatingCode"),GetLanguage());
        }
    }
}
Beispiel #6
0
wxObject* wxsAxis::OnBuildPreview(wxWindow* Parent,long Flags) {
    wxStaticText    *Preview;
    mpWindow        *mp;
    mpScaleX        *xx;
    mpScaleY        *yy;
    wxPen           pen;
    wxColour        cc;
    wxFont          ff;
    bool            hide;

// if parent is not an mpWindow, then exit out

    if (! Parent->IsKindOf(CLASSINFO(mpWindow))) return NULL;
    mp = (mpWindow *) Parent;

// hide this axis?

    hide = ((Flags & pfExact) && (GetPropertiesFlags() & flHidden) && GetBaseProps()->m_Hidden);

// make the place-holder

    Preview = new wxStaticText(Parent, GetId(), mLabel, Pos(Parent), Size(Parent), (wxSUNKEN_BORDER|Style()));
    Preview->SetForegroundColour(wxColour(255,255,255));
    Preview->SetBackgroundColour(wxColour(0,128,0));
    SetupWindow(Preview,Flags);
    if (Flags & pfExact) Preview->Hide();

// pen color

    cc = mPenColour.GetColour();
    if (cc.IsOk()) pen.SetColour(cc);

// text font

    ff = mPenFont.BuildFont();

// update the place-holder

    if (cc.IsOk()) Preview->SetBackgroundColour(cc);
    Preview->SetFont(ff);

// make the axis

    if (mType == 0) {
        xx = new mpScaleX(mLabel, mAlign, mTics);
        xx->SetPen(pen);
        xx->SetFont(ff);
        if (! hide) mp->AddLayer(xx);
    }
    else {
        yy = new mpScaleY(mLabel, mAlign, mTics);
        yy->SetPen(pen);
        yy->SetFont(ff);
        if (! hide) mp->AddLayer(yy);
    };

// done

    return Preview;
}
Beispiel #7
0
wxObject* wxsLed::OnBuildPreview(wxWindow* Parent,long Flags)
{
    wxLed *Led = new wxLed(Parent,GetId(),m_Disable.GetColour(), m_EnableOn.GetColour(), m_EnableOff.GetColour(),Pos(Parent),Size(Parent));
    if( !GetBaseProps()->m_Enabled)
        Led->Disable();
    if( m_State)
        Led->SwitchOn();
    else
        Led->SwitchOff();
    return Led;
}
Beispiel #8
0
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());
}
Beispiel #9
0
wxsLed::wxsLed(wxsItemResData* Data):
    wxsWidget(
        Data,
        &Reg.Info,
        NULL,
        NULL,
        flVariable | flId|flEnabled),
        m_State(true)
{
    //ctor
    m_Disable = wxColour(128,128,128);
    m_EnableOn  = *wxGREEN;
    m_EnableOff  = *wxRED;
    GetBaseProps()->m_Enabled = false;
}
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());
    }
}
Beispiel #11
0
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());
        }
    }
}
Beispiel #12
0
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 wxsContainer::AddChildrenPreview(wxWindow* This,long Flags)
{
    for ( int i=0; i<GetChildCount(); i++ )
    {
        wxsItem* Child = GetChild(i);
        wxObject* ChildPreviewAsObject = Child->BuildPreview(This,Flags);
        if ( Child->GetType() == wxsTSizer )
        {
            wxSizer* ChildPreviewAsSizer = wxDynamicCast(ChildPreviewAsObject,wxSizer);
            if ( ChildPreviewAsSizer )
            {
                This->SetSizer(ChildPreviewAsSizer);
            }
        }
    }

    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)->BuildPreview(This,Flags);
            }
        }

    }

    for ( int i=0; i<GetChildCount(); i++ )
    {
        wxsItem* Child = GetChild(i);
        if ( Child->GetType() == wxsTSizer )
        {
            wxObject* ChildPreviewAsObject = Child->GetLastPreview();
            wxSizer*  ChildPreviewAsSizer  = wxDynamicCast(ChildPreviewAsObject,wxSizer);
            wxWindow* ChildPreviewAsWindow = wxDynamicCast(ChildPreviewAsObject,wxWindow);

            if ( ChildPreviewAsSizer )
            {
                // Child preview was created directly as sizer, we use it to
                // call Fit() and SetSizeHints() directly
                if ( GetBaseProps()->m_Size.IsDefault )
                {
                    ChildPreviewAsSizer->Fit(This);
                }
                ChildPreviewAsSizer->SetSizeHints(This);
            }
            else if ( ChildPreviewAsWindow )
            {
                // Preview of sizer is given actually as some kind of panel which paints
                // some extra data of sizer. So we have to create out own sizer to call
                // Fit and SetSizeHints

                wxSizer* IndirectSizer = new wxBoxSizer(wxHORIZONTAL);
                IndirectSizer->Add(ChildPreviewAsWindow,1,wxEXPAND,0);
                This->SetSizer(IndirectSizer);

                if ( GetBaseProps()->m_Size.IsDefault )
                {
                    IndirectSizer->Fit(This);
                }

                IndirectSizer->SetSizeHints(This);
            }
        }
    }
}
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());
        }
    }
}
Beispiel #15
0
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());


}
Beispiel #16
0
wxObject* wxsVector::OnBuildPreview(wxWindow* Parent, long Flags) {
int             n;
wxStaticText    *Preview;
mpFXYVector     *vec;
mpWindow        *mp;
wxPen           pen(*wxBLACK_PEN);
wxColour        cc;
wxFont          ff;
bool            hide;

// if parent is not an mpWindow, then exit out

    if (! Parent->IsKindOf(CLASSINFO(mpWindow))) return NULL;
    mp = (mpWindow *) Parent;

// hide this vector

    hide = ((Flags & pfExact) && (GetPropertiesFlags() & flHidden) && GetBaseProps()->m_Hidden);

// make the place-holder

    Preview = new wxStaticText(Parent, GetId(), mLabel, Pos(Parent), Size(Parent), (wxSUNKEN_BORDER|Style()));
    Preview->SetForegroundColour(wxColour(255,255,255));
    Preview->SetBackgroundColour(wxColour(0,0,128));
    SetupWindow(Preview,Flags);
    if (Flags & pfExact) Preview->Hide();

// the actual vector

    vec = new mpFXYVector(mLabel, mAlign);

// pen color

    cc = mPenColour.GetColour();
    if (cc.IsOk()) pen.SetColour(cc);
    vec->SetPen(pen);

// text font

    ff = mPenFont.BuildFont();
    vec->SetFont(ff);

// update the place-holder

    if (cc.IsOk()) Preview->SetBackgroundColour(cc);
    Preview->SetFont(ff);

// fill in the data

    ParseXY();
    n = mXs.GetCount();
    if (n > 0) {
        vec->SetData(mXf, mYf);
    };

// points or lines?

    vec->SetContinuity(mContinuous);

// and add layer to parent

    if (! hide) mp->AddLayer(vec);

// done

    return Preview;
}