void FsGuiColorDialog::Make(FsGuiColorPalette *linkedColorPalette) { this->linkedColorPalette=linkedColorPalette; FsGuiDialog::Initialize(); closeBtn=AddTextButton(0,FSKEY_ESC,FSGUI_PUSHBUTTON,L"Close",YSTRUE); AddCustomControl(0,FSKEY_NULL,brightness,32,240,YSTRUE); AddCustomControl(0,FSKEY_NULL,colorBand,320,240,YSFALSE); AddCustomControl(0,FSKEY_NULL,curColorStatic,64,64,YSFALSE); hueText=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,L"H:",4,YSTRUE); saturationText=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,L"S:",4,YSFALSE); valueText=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,L"V:",4,YSFALSE); redText=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,L"R:",4,YSFALSE); greenText=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,L"G:",4,YSFALSE); blueText=AddTextBox(0,FSKEY_NULL,FsGuiTextBox::HORIZONTAL,L"B:",4,YSFALSE); AddStaticText(0,FSKEY_NULL,L"H:",YSTRUE); hueSlider=AddHorizontalSlider(0,FSKEY_NULL,40,0.0,1.0,YSFALSE); AddStaticText(0,FSKEY_NULL,L"S:",YSTRUE); saturationSlider=AddHorizontalSlider(0,FSKEY_NULL,40,0.0,1.0,YSFALSE); AddStaticText(0,FSKEY_NULL,L"V:",YSTRUE); valueSlider=AddHorizontalSlider(0,FSKEY_NULL,40,0.0,1.0,YSFALSE); AddStaticText(0,FSKEY_NULL,L"R:",YSTRUE); redSlider=AddHorizontalSlider(0,FSKEY_NULL,40,0.0,1.0,YSFALSE); AddStaticText(0,FSKEY_NULL,L"G:",YSTRUE); greenSlider=AddHorizontalSlider(0,FSKEY_NULL,40,0.0,1.0,YSFALSE); AddStaticText(0,FSKEY_NULL,L"B:",YSTRUE); blueSlider=AddHorizontalSlider(0,FSKEY_NULL,40,0.0,1.0,YSFALSE); if(NULL!=linkedColorPalette && YSTRUE==linkedColorPalette->HasColorButton()) { for(int i=0; i<16; ++i) { const YSBOOL newLine=((0==i || 8==i) ? YSTRUE : YSFALSE); YsString str; str.Printf("Set C%d",i); setToPaletteBtn[i]=AddTextButton(0,FSKEY_NULL,FSGUI_PUSHBUTTON,str,newLine); } } else { for(int i=0; i<10; ++i) { setToPaletteBtn[i]=NULL; } } Fit(); }
wxTextCtrl * ShuttleGuiBase::TieTextBox( const wxString &Prompt, WrappedType & WrappedRef, const int nChars) { // The Add function does a UseUpId(), so don't do it here in that case. if( mShuttleMode == eIsCreating ) return AddTextBox( Prompt, WrappedRef.ReadAsString(), nChars ); UseUpId(); wxTextCtrl * pTextBox=NULL; wxWindow * pWnd = wxWindow::FindWindowById( miId, mpDlg); pTextBox = wxDynamicCast(pWnd, wxTextCtrl); switch( mShuttleMode ) { // IF setting internal storage from the controls. case eIsGettingFromDialog: { wxASSERT( pTextBox ); WrappedRef.WriteToAsString( pTextBox->GetValue() ); } break; case eIsSettingToDialog: { wxASSERT( pTextBox ); pTextBox->SetValue( WrappedRef.ReadAsString() ); } break; // IF Saving settings to external storage... // or IF Getting settings from external storage. case eIsGettingViaShuttle: case eIsSavingViaShuttle: DoDataShuttle( Prompt, WrappedRef ); break; default: wxASSERT( false ); break; } return pTextBox; }