AUI_ERRCODE MessageEyePointStandard::InitCommon( MBCHAR const *ldlBlock, MessageModal *window ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR buttonBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; m_button = NULL; m_action = NULL; sprintf( buttonBlock, "%s.%s", ldlBlock, "StandardEyeButton" ); m_button = new aui_Button( &errcode, aui_UniqueId(), buttonBlock ); Assert( AUI_NEWOK( m_button, errcode )); if ( !AUI_NEWOK( m_button, errcode )) return AUI_ERRCODE_MEMALLOCFAILED; m_action = new MessageStandardEyePointAction( NULL, window ); Assert( m_action != NULL ); if ( m_action == NULL ) return AUI_ERRCODE_MEMALLOCFAILED; m_button->SetAction( m_action ); errcode = window->AddControl( m_button ); Assert( errcode == AUI_ERRCODE_OK ); if ( errcode != AUI_ERRCODE_OK ) return errcode; return AUI_ERRCODE_OK; }
AUI_ERRCODE c3_HyperTipWindow::InitCommonLdl( MBCHAR *ldlBlock ) { ldl_datablock * block = aui_Ldl::FindDataBlock(ldlBlock); Assert( block != NULL ); if ( !block ) return AUI_ERRCODE_LDLFINDDATABLOCKFAILED; AUI_ERRCODE errcode = InitCommon(); Assert( AUI_SUCCESS(errcode) ); if ( !AUI_SUCCESS(errcode) ) return errcode; MBCHAR tipBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; sprintf( tipBlock, "%s.%s", ldlBlock, k_C3_HYPERTIPWINDOW_LDL_TIP ); if (aui_Ldl::GetLdl()->FindDataBlock( tipBlock ) ) { m_hyperTip = new aui_HyperTextBox( &errcode, aui_UniqueId(), tipBlock ); Assert( AUI_NEWOK(m_hyperTip,errcode) ); if ( !AUI_NEWOK(m_hyperTip,errcode) ) return errcode; m_hyperTip->SetBlindness( TRUE ); m_hyperTip->TextReloadFont(); aui_Ldl::Remove( m_hyperTip ); m_allocatedHyperTip = TRUE; AddChild( m_hyperTip ); m_hyperTip->Move( 0, 0 ); m_hyperTip->Resize( m_width-5, m_height-10 ); } return AUI_ERRCODE_OK; }
HighScoreWindowPopup::HighScoreWindowPopup( sint32 type ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; strcpy(windowBlock, "HighScoreWindowPopup"); { m_window = new c3_PopupWindow( &errcode, aui_UniqueId(), windowBlock, 16, AUI_WINDOW_TYPE_FLOATING, false); Assert( AUI_NEWOK(m_window, errcode) ); if ( !AUI_NEWOK(m_window, errcode) ) return; m_window->Resize(m_window->Width(),m_window->Height()); m_window->GrabRegion()->Resize(m_window->Width(),m_window->Height()); m_window->SetStronglyModal(TRUE); } m_continueButton = NULL; m_quitButton = NULL; m_creditsButton = NULL; m_list = NULL; m_title = NULL; m_highScoreDB = new HighScoreDB(); Initialize( windowBlock ); if (g_player[g_selected_item->GetVisiblePlayer()] == NULL) { m_continueButton->Enable(FALSE); } else { m_continueButton->Enable(TRUE); } }
AUI_ERRCODE ChatWindow::InitCommonLdl(MBCHAR *ldlBlock) { MBCHAR controlBlock[k_AUI_LDL_MAXBLOCK + 1]; AUI_ERRCODE errcode = AUI_ERRCODE_OK; sprintf(controlBlock, "%s.%s", ldlBlock, "ChatTextBox"); m_textBox = new c3_HyperTextBox(&errcode, aui_UniqueId(), controlBlock, NULL, NULL); Assert( AUI_NEWOK(m_textBox, errcode) ); if ( !AUI_NEWOK(m_textBox, errcode) ) return AUI_ERRCODE_MEMALLOCFAILED; AddControl(m_textBox); sprintf(controlBlock, "%s.%s", ldlBlock, "ChatTextField"); m_textField = new C3TextField(&errcode, aui_UniqueId(), controlBlock, ChatWindow::ChatCallback, (void *)this); Assert( AUI_NEWOK(m_textField, errcode) ); if ( !AUI_NEWOK(m_textField, errcode) ) return AUI_ERRCODE_MEMALLOCFAILED; m_textField->SetMaxFieldLen(k_CHATBOX_LINE_LENGTH); AddControl(m_textField); SetDraggable(TRUE); m_grabRegion->Move(0, 0); m_grabRegion->Resize(m_width, m_height); Move(0, g_radarWindow->Y() - m_height); return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_Tab::InitCommon( sint32 paneWidth, sint32 paneHeight ) { Assert( paneWidth >= m_width ); if ( paneWidth < m_width ) paneWidth = m_width; AUI_ERRCODE errcode = AUI_ERRCODE_OK; m_pane = new aui_Static( &errcode, aui_UniqueId(), 0, m_height, paneWidth, paneHeight ); Assert( AUI_NEWOK(m_pane,errcode) ); if ( !AUI_NEWOK(m_pane,errcode) ) return AUI_ERRCODE_OK; m_pane->SetBlindness( TRUE ); AddChild( m_pane ); return AUI_ERRCODE_OK; }
int SpriteEditWindow_Initialize( void ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( g_spriteEditWindow ) return 0; strcpy(windowBlock, "SpriteEditor"); g_spriteEditWindow = new SpriteEditWindow(&errcode, aui_UniqueId(), windowBlock, 16 ); Assert( AUI_NEWOK(g_spriteEditWindow, errcode)); if ( !AUI_NEWOK(g_spriteEditWindow, errcode) ) return -1; errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); if ( !AUI_SUCCESS(errcode) ) return -1; g_spriteEditWindow->Show(); if (g_c3ui) { g_c3ui->RegisterCleanup(&SpriteEditWindow_Cleanup); } return 0; }
sint32 victorywin_AddWonders( MBCHAR *windowBlock ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR controlBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; int i = 0; s_wonderIcons = new ctp2_Static *[k_VICWIN_WONDERICON_MAX]; sprintf( controlBlock, "%s", "TabGroup.Tab1.TabPanel.WonderList" ); s_wonderList = (ctp2_ListBox *)aui_Ldl::GetObject(windowBlock, controlBlock); s_wonderList->SetAbsorbancy( FALSE ); sint32 height = s_wonderList->Height(); tech_WLList<ctp2_Static *> wonderList; ctp2_Static *item = NULL; for ( i = 0; i < k_VICWIN_WONDERICON_MAX; i++ ) { item = new ctp2_Static(&errcode, aui_UniqueId(), "VictoryWindow_WonderIcon"); Assert( AUI_NEWOK(item,errcode) ); if ( !AUI_NEWOK(item,errcode) ) return - 1; s_wonderIcons[i] = item; if ( (height -= item->Height()) < 0 ) break; wonderList.AddTail( item ); } ListPos pos = wonderList.GetHeadPosition(); for ( i++; i < k_VICWIN_WONDERICON_MAX; i++ ) { wonderList.GetNext( pos )->AddChild( item ); item = new ctp2_Static(&errcode, aui_UniqueId(), "VictoryWindow_WonderIcon"); Assert( AUI_NEWOK(item,errcode) ); if ( !AUI_NEWOK(item,errcode) ) return AUI_ERRCODE_MEMALLOCFAILED; s_wonderIcons[i] = item; if ( !pos ) pos = wonderList.GetHeadPosition(); } wonderList.GetAt( pos )->AddChild( item ); pos = wonderList.GetHeadPosition(); for ( i = wonderList.L(); i; i-- ) s_wonderList->AddItem( (aui_Item *)wonderList.GetNext( pos ) ); return 0; }
AUI_ERRCODE MessageEyePointListbox::InitCommon(MBCHAR const * ldlBlock, MessageWindow *window ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR buttonBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; sint32 count = 0; m_buttonLeft = NULL; m_buttonRight = NULL; m_action1 = NULL; m_action2 = NULL; count = window->GetMessage()->AccessData()->GetNumEyePoints( ); sprintf( buttonBlock, "%s.%s", ldlBlock, "EyeLeftButton" ); m_buttonLeft = new aui_Button( &errcode, aui_UniqueId(), buttonBlock ); Assert( AUI_NEWOK( m_buttonLeft, errcode )); if ( !AUI_NEWOK( m_buttonLeft, errcode )) return AUI_ERRCODE_MEMALLOCFAILED; m_action1 = new MessageListboxEyePointAction( window, 0, -1, 0, count ); Assert( m_action1 != NULL ); if ( m_action1 == NULL ) return AUI_ERRCODE_MEMALLOCFAILED; m_buttonLeft->SetAction( m_action1 ); if ( window->GetGreatLibraryButton() ) { m_buttonLeft->Offset( window->GetGreatLibraryButton()->Width() + 3, 0 ); } errcode = window->AddControl( m_buttonLeft ); Assert( errcode == AUI_ERRCODE_OK ); if ( errcode != AUI_ERRCODE_OK ) return errcode; sprintf( buttonBlock, "%s.%s", ldlBlock, "EyeRightButton" ); m_buttonRight = new aui_Button( &errcode, aui_UniqueId(), buttonBlock ); Assert( AUI_NEWOK( m_buttonRight, errcode )); if ( !AUI_NEWOK( m_buttonRight, errcode )) return AUI_ERRCODE_MEMALLOCFAILED; m_action2 = new MessageListboxEyePointAction( window, 0, 1, 0, count ); Assert( m_action2 != NULL ); if ( m_action2 == NULL ) return AUI_ERRCODE_MEMALLOCFAILED; m_buttonRight->SetAction( m_action2 ); if ( window->GetGreatLibraryButton() ) { m_buttonRight->Offset( window->GetGreatLibraryButton()->Width() + 3, 0 ); } errcode = window->AddControl( m_buttonRight ); Assert( errcode == AUI_ERRCODE_OK ); if ( errcode != AUI_ERRCODE_OK ) return errcode; m_action1->SetAction( m_action2 ); m_action2->SetAction( m_action1 ); return AUI_ERRCODE_OK; }
AUI_ERRCODE UITestWindow::InitCommon( void ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; SetDraggable(TRUE); m_button1 = new IconButton( &errcode, aui_UniqueId(), 20, 37, 32, 32, "upba0104.tif", k_MESSAGE_ICON_EVENT, 0 ); Assert( AUI_NEWOK( m_button1, errcode )); if ( !AUI_NEWOK( m_button1, errcode )) return AUI_ERRCODE_MEMALLOCFAILED; errcode = AddControl( m_button1 ); Assert( errcode == AUI_ERRCODE_OK ); if ( errcode != AUI_ERRCODE_OK ) return errcode; m_button1Action = new Button1Action( ); Assert( m_button1Action != NULL ); if ( m_button1Action == NULL ) return AUI_ERRCODE_MEMALLOCFAILED; m_button1->SetAction( m_button1Action ); m_button2 = new IconButton( &errcode, aui_UniqueId(), 54, 37, 32, 32, "upba0104.tif", k_MESSAGE_ICON_DIPLOMATIC, 0 ); Assert( AUI_NEWOK( m_button2, errcode )); if ( !AUI_NEWOK( m_button2, errcode )) return AUI_ERRCODE_MEMALLOCFAILED; errcode = AddControl( m_button2 ); Assert( errcode == AUI_ERRCODE_OK ); if ( errcode != AUI_ERRCODE_OK ) return errcode; m_button2Action = new Button2Action( ); Assert( m_button2Action != NULL ); if ( m_button2Action == NULL ) return AUI_ERRCODE_MEMALLOCFAILED; m_button2->SetAction( m_button2Action ); return AUI_ERRCODE_OK; }
aui_Surface * aui_Factory::new_Surface(AUI_ERRCODE &retval, const sint32 &width, const sint32 &height, void *data, const BOOL &isPrimary, const BOOL &useVideoMemory, const BOOL &takeOwnership ) { #if defined(__AUI_USE_SDL__) aui_SDLSurface *surface = 0; surface = new aui_SDLSurface(&retval, width, height, g_c3ui->BitsPerPixel(), g_c3ui->DD(), isPrimary, useVideoMemory, takeOwnership); #elif defined(__AUI_USE_DIRECTX__) aui_DirectSurface *surface = 0; surface = new aui_DirectSurface(&retval, width, height, g_c3ui->BitsPerPixel(), g_c3ui->DD(), (LPDIRECTDRAWSURFACE) data, isPrimary, useVideoMemory); #endif Assert( AUI_NEWOK(surface, retval) ); return surface; }
aui_Static *aui_HyperTextBase::CreateHyperStatic( const MBCHAR *string, uint32 len, MBCHAR ttffile[ MAX_PATH + 1 ], sint32 pointSize, sint32 bold, sint32 italic, COLORREF color, sint32 underline, BOOL shadow, COLORREF shadowColor, uint32 flags ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; aui_Static *hs = new aui_Static( &errcode, 0, 0, 0, 0, 0, string, len ); Assert( AUI_NEWOK(hs,errcode) ); if ( !AUI_NEWOK(hs,errcode) ) return NULL; hs->SetBlindness( TRUE ); hs->TextFlags() = flags; hs->SetTextColor( color ); hs->SetTextUnderline( underline ); hs->SetTextShadow( shadow ); hs->SetTextShadowColor( shadowColor ); hs->SetTextFont( ttffile ); hs->SetTextFontSize( pointSize ); hs->SetTextBold( bold ); hs->SetTextItalic( italic ); hs->TextReloadFont(); hs->Resize( hs->GetTextFont()->GetStringWidth( hs->GetText() ), hs->GetTextFont()->GetLineSkip() ); return hs; }
aui_DragDropWindow *aui_Region::CreateDragDropWindow( aui_Control *dragDropItem ) { if ( !IsDragDrop() ) return NULL; AUI_ERRCODE errcode = AUI_ERRCODE_OK; aui_DragDropWindow *ddw = new aui_DragDropWindow( &errcode, dragDropItem, this, 0, 0, m_width, m_height ); Assert( AUI_NEWOK(ddw,errcode) ); if ( !AUI_NEWOK(ddw,errcode) ) return NULL; g_ui->AddChild( ddw ); return ddw; }
AUI_ERRCODE ctp2_HyperTextBox::CreateRanger( MBCHAR *ldlBlock ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; static MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( ldlBlock ) { sprintf( block, "%s.%s", ldlBlock, k_AUI_HYPERTEXTBOX_LDL_RANGERY ); if (aui_Ldl::FindDataBlock( block ) ) m_ranger = new c3_Ranger( &errcode, aui_UniqueId(), block, HyperTextBoxRangerActionCallback, this ); } MBCHAR * pattern = (m_pattern) ? m_pattern->GetFilename() : NULL; if ( !m_ranger ) m_ranger = new c3_Ranger( &errcode, aui_UniqueId(), m_width, k_CONTROL_DEFAULT_SIZE, m_height - 2 * k_CONTROL_DEFAULT_SIZE, k_CONTROL_DEFAULT_SIZE, AUI_RANGER_TYPE_SCROLLER, AUI_RANGER_ORIENTATION_VERTICAL, pattern, HyperTextBoxRangerActionCallback, this ); Assert( AUI_NEWOK(m_ranger,errcode) ); if ( !AUI_NEWOK(m_ranger,errcode) ) return AUI_ERRCODE_MEMALLOCFAILED; AddChild( m_ranger ); SetRangerSize(m_ranger->Width()); return RepositionRanger(); }
AUI_ERRCODE loadsavescreen_Initialize( aui_Control::ControlActionCallback *callback ) { if ( g_loadsaveWindow ) return AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; strcpy(windowBlock, "LoadSaveWindow"); AUI_ERRCODE errcode = AUI_ERRCODE_OK; g_loadsaveWindow= new LoadSaveWindow(&errcode, aui_UniqueId(), windowBlock, 16 , AUI_WINDOW_TYPE_STANDARD); Assert( AUI_NEWOK(g_loadsaveWindow, errcode) ); if ( !AUI_NEWOK(g_loadsaveWindow, errcode) ) return errcode; errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); switch ( g_loadsaveWindow->GetType() ) { case LSS_LOAD_GAME: case LSS_LOAD_MP: case LSS_LOAD_SCEN: case LSS_LOAD_SCEN_MP: g_loadsaveWindow->GetOkButton()->Enable( FALSE ); break; default: g_loadsaveWindow->GetOkButton()->Enable( TRUE ); break; } g_loadsaveWindow->GetDeleteButton()->Enable( FALSE ); g_loadsaveWindow->GetListOne()->GetHeader()->Enable( FALSE ); g_loadsaveWindow->GetListTwo()->GetHeader()->Enable( FALSE ); if ( callback ) g_loadsaveWindow->GetOkButton()->SetActionFuncAndCookie( callback, NULL ); return AUI_ERRCODE_OK; }
sint32 victorywin_Initialize( sint32 type ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( g_victoryWindow ) { victorywin_UpdateData(type); return 0; } strcpy(windowBlock, "VictoryWindow"); g_victoryWindow = new VictoryWindow(&errcode); Assert( AUI_NEWOK(g_victoryWindow, errcode) ); if ( !AUI_NEWOK(g_victoryWindow, errcode) ) return -1; g_victoryWindow->m_window->SetStronglyModal(TRUE); victorywin_Init_Controls(windowBlock); s_highScoreWin = new HighScoreWindowPopup(type); s_stringTable = new aui_StringTable( &errcode, "VictoryStrings" ); Assert( AUI_NEWOK(s_stringTable, errcode) ); if ( !AUI_NEWOK(s_stringTable, errcode) ) return -2; errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); if ( !AUI_SUCCESS(errcode) ) return -1; return 0; }
AUI_ERRCODE aui_UI::CreateScreen( void ) { AUI_ERRCODE retcode = AUI_ERRCODE_OK; m_primary = new aui_Surface( &retcode, m_width, m_height, m_bpp, 0, NULL, TRUE ); Assert( AUI_NEWOK(m_primary,retcode) ); if ( !AUI_NEWOK(m_primary,retcode) ) return AUI_ERRCODE_MEMALLOCFAILED; // Has to be added in aui_DirectUI, because we need the hdc from the DirectX screen // do get a 16 bit HDC instead of a 15 bit one. Actally, this is an ugly solution. /* if(m_secondary == NULL) { m_secondary = new aui_Surface( &retcode, m_width, m_height, m_bpp, 0, NULL, FALSE ); Assert( AUI_NEWOK(m_secondary,retcode) ); if ( !AUI_NEWOK(m_secondary,retcode) ) return AUI_ERRCODE_MEMALLOCFAILED; }*/ m_pixelFormat = m_primary->PixelFormat(); return retcode; }
ChatBox::ChatBox() { AUI_ERRCODE errcode = AUI_ERRCODE_OK; m_chatWindow = new ChatWindow(&errcode, aui_UniqueId(), "ChatWindow", 16, AUI_WINDOW_TYPE_FLOATING, this); Assert(AUI_NEWOK(m_chatWindow, errcode)); if (!m_chatWindow || errcode != AUI_ERRCODE_OK) return; m_active = FALSE; }
AUI_ERRCODE aui_Header::CreateSwitches( MBCHAR *ldlBlock ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; static MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( ldlBlock ) { sint32 i = 0; do { sprintf( block, "%s.%s%d", ldlBlock, k_AUI_HEADER_LDL_SWITCH, i ); if (!aui_Ldl::GetLdl()->FindDataBlock( block ) ) break; aui_Switch *theSwitch = new aui_Switch( &errcode, aui_UniqueId(), block ); Assert( AUI_NEWOK(theSwitch,errcode) ); if ( !AUI_NEWOK(theSwitch,errcode) ) return AUI_ERRCODE_MEMALLOCFAILED; aui_Action *action = new aui_HeaderSwitchAction( i ); Assert( action != NULL ); if ( !action ) return AUI_ERRCODE_MEMALLOCFAILED; theSwitch->SetAction( action ); AddChild( theSwitch ); i++; } while ( 1 ); } return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_Tab::InitCommon( MBCHAR *ldlBlock ) { static MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; sprintf( block, "%s.%s", ldlBlock, "pane" ); AUI_ERRCODE errcode = AUI_ERRCODE_OK; m_pane = new aui_Static( &errcode, aui_UniqueId(), block ); Assert( AUI_NEWOK(m_pane,errcode) ); if ( !AUI_NEWOK(m_pane,errcode) ) return AUI_ERRCODE_OK; // Returnin OK? m_pane->SetBlindness( TRUE ); m_pane->Move( 0, m_height ); AddChild( m_pane ); return AUI_ERRCODE_OK; // Why not errcode? }
AUI_ERRCODE MessageEyePointDropdown::InitCommonCommon ( MBCHAR const * ldlBlock, MessageData * a_Message ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR buttonBlock[k_AUI_LDL_MAXBLOCK + 1]; sprintf(buttonBlock, "%s.%s", ldlBlock, "StandardEyeButton"); m_button = new aui_Button(&errcode, aui_UniqueId(), buttonBlock); Assert(AUI_NEWOK(m_button, errcode)); if (!AUI_NEWOK(m_button, errcode)) return AUI_ERRCODE_MEMALLOCFAILED; m_button->TextReloadFont(); sprintf(buttonBlock, "%s.%s", ldlBlock, "StandardEyePointDropdown"); m_dropdown = new c3_DropDown(&errcode, aui_UniqueId(), buttonBlock); Assert(AUI_NEWOK(m_dropdown, errcode)); if (!AUI_NEWOK(m_dropdown, errcode)) return AUI_ERRCODE_MEMALLOCFAILED; if (m_dropdown->GetListBox()) { m_dropdown->GetListBox()->SetForceSelect(false); } sprintf( buttonBlock, "%s.%s", ldlBlock, "StandardEyePointDropdownItem" ); sint32 i = 0; while (MBCHAR const * text = a_Message->GetEyePointName(i++)) { MessageEyePointListItem * item = new MessageEyePointListItem(&errcode, text, i, buttonBlock); if (item) m_dropdown->AddItem((aui_Item *) item); } return errcode; }
AUI_ERRCODE C3Slider::CreateThumb( MBCHAR *ldlBlock ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; static MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( ldlBlock ) { sprintf( block, "%s.%s", ldlBlock, k_AUI_RANGER_LDL_THUMB ); if (aui_Ldl::GetLdl()->FindDataBlock( block ) ) m_thumb = new C3Thumb( &errcode, aui_UniqueId(), block, C3SliderThumbActionCallback, this ); } if ( !m_thumb ) m_thumb = new C3Thumb( &errcode, aui_UniqueId(), 0, 0, 0, 0, m_pattern->GetFilename(), C3SliderThumbActionCallback, this ); Assert( AUI_NEWOK(m_thumb,errcode) ); if ( !AUI_NEWOK(m_thumb,errcode) ) return AUI_ERRCODE_MEMALLOCFAILED; AddChild( m_thumb ); RepositionThumb( FALSE ); return AUI_ERRCODE_OK; }
int AncientWindows_PreInitialize(void) { return 0; #if 0 // CTP1? MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; MBCHAR imageBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; AUI_ERRCODE errcode; sprintf(windowBlock, "%s", "LowerRight"); s_lowerRight = new C3Window(&errcode, aui_UniqueId(), windowBlock, 16, AUI_WINDOW_TYPE_BACKGROUND ); Assert( AUI_NEWOK(s_lowerRight, errcode) ); if ( !AUI_NEWOK(s_lowerRight, errcode) ) return -1; sprintf(imageBlock, "%s.%s", windowBlock, "Image"); s_imageLowerRight = new aui_Static(&errcode, aui_UniqueId(), imageBlock); Assert( AUI_NEWOK(s_imageLowerRight, errcode) ); if ( !AUI_NEWOK(s_imageLowerRight, errcode) ) return -1; return 0; #endif }
void LineGraph::InitCommon(void) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; m_surface = aui_Factory::new_Surface(errcode, m_width, m_height); Assert( AUI_NEWOK(m_surface, errcode) ); SetRect(&m_surfaceRect, 0, 0, m_width, m_height); m_graphRect = m_surfaceRect; InflateRect(&m_graphRect, -10, -10); m_graphRect.bottom -= (m_events)?40:20; m_graphRect.left += 20; m_drawMask = k_AUI_REGION_DRAWFLAG_UPDATE; }
aui_Keyboard * aui_Factory::new_Keyboard(AUI_ERRCODE &retval) { #if defined(__AUI_USE_SDL__) aui_SDLKeyboard *keyboard = 0; keyboard = new aui_SDLKeyboard(&retval); #elif defined(__AUI_USE_DIRECTX__) aui_DirectKeyboard *keyboard = 0; keyboard = new aui_DirectKeyboard(&retval); #endif Assert( AUI_NEWOK(keyboard, retval) ); return keyboard; }
aui_Mouse * aui_Factory::new_Mouse(AUI_ERRCODE &retval, MBCHAR *ldlBlock, const BOOL &useExclusiveMode ) { #if defined(__AUI_USE_SDL__) aui_SDLMouse *mouse = 0; mouse = new aui_SDLMouse(&retval, ldlBlock, useExclusiveMode); #elif defined(__AUI_USE_DIRECTX__) aui_DirectMouse *mouse = 0; mouse = new aui_DirectMouse(&retval, ldlBlock, useExclusiveMode); #endif Assert( AUI_NEWOK(mouse, retval) ); return mouse; }
AUI_ERRCODE spnewgamerandomcustomscreen_Initialize( aui_Control::ControlActionCallback *callback ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; MBCHAR controlBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; MBCHAR switchBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; sint32 i; if ( s_spNewGameRandomCustomScreen ) return AUI_ERRCODE_OK; strcpy(windowBlock, "SPNewGameRandomCustomScreen"); { s_spNewGameRandomCustomScreen = new c3_PopupWindow( &errcode, aui_UniqueId(), windowBlock, 16, AUI_WINDOW_TYPE_FLOATING, false); Assert( AUI_NEWOK(s_spNewGameRandomCustomScreen, errcode) ); if ( !AUI_NEWOK(s_spNewGameRandomCustomScreen, errcode) ) errcode; s_spNewGameRandomCustomScreen->Resize(s_spNewGameRandomCustomScreen->Width(),s_spNewGameRandomCustomScreen->Height()); s_spNewGameRandomCustomScreen->GrabRegion()->Resize(s_spNewGameRandomCustomScreen->Width(),s_spNewGameRandomCustomScreen->Height()); s_spNewGameRandomCustomScreen->SetStronglyModal(TRUE); } sprintf( controlBlock, "%s.%s", windowBlock, "Name" ); s_spNewGameRandomCustomScreen->AddTitle( controlBlock ); s_spNewGameRandomCustomScreen->AddClose( callback ? callback : spnewgamerandomcustomscreen_backPress ); sprintf( controlBlock, "%s.%s", windowBlock, "Group" ); s_group = new aui_SwitchGroup( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_group, errcode) ); if ( !AUI_NEWOK(s_group, errcode) ) return errcode; s_checkBox = new aui_Radio*[k_NUM_RANDOMCUSTOMBOXES]; for ( i = 0;i < k_NUM_RANDOMCUSTOMBOXES;i++ ) { sprintf( switchBlock, "%s.%s", controlBlock, checknames[i] ); s_checkBox[i] = new aui_Radio( &errcode, aui_UniqueId(), switchBlock ); Assert( AUI_NEWOK(s_checkBox[i], errcode) ); if ( !AUI_NEWOK(s_checkBox[i], errcode) ) return errcode; s_group->AddSwitch( (aui_Radio *)s_checkBox[i] ); } errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); return AUI_ERRCODE_OK; }
//---------------------------------------------------------------------------- // // Name : specialAttackWindow_Initialize // // Description: Initializes the tileimp tracker window. // // Parameters : - // // Globals : g_theSpecialAttackWindow: The special attack window // // Returns : 0 if initalization was successfull, -1 otherwise. // // Remark(s) : - // //---------------------------------------------------------------------------- sint32 specialAttackWindow_Initialize() { MBCHAR textBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; MBCHAR controlBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; AUI_ERRCODE errcode = AUI_ERRCODE_OK; strcpy(textBlock, "SpecialAttackWindow"); g_theSpecialAttackWindow = new SpecialAttackWindow( &errcode, aui_UniqueId(), textBlock, 16); Assert(AUI_NEWOK(g_theSpecialAttackWindow, errcode)); if(!AUI_SUCCESS(errcode)) return -1; sprintf(controlBlock, "%s.%s", textBlock, "SpecialAttackCostN"); if (aui_Ldl::IsValid(controlBlock)) { s_saWindowCostN = new c3_Static( &errcode, aui_UniqueId(), controlBlock); } sprintf(controlBlock, "%s.%s", textBlock, "SpecialAttackCostV"); if (aui_Ldl::IsValid(controlBlock)) { s_saWindowCostV = new c3_Static( &errcode, aui_UniqueId(), controlBlock); } sprintf(controlBlock, "%s.%s", textBlock, "Background"); if (aui_Ldl::IsValid(controlBlock)) { s_saWindowBackground = new c3_Static(&errcode, aui_UniqueId(), controlBlock); } errcode = aui_Ldl::SetupHeirarchyFromRoot(textBlock); Assert(AUI_SUCCESS(errcode)); if(!AUI_SUCCESS(errcode)) return -1; return 0; }
sint32 HighScoreWindowPopup::Initialize( MBCHAR *windowBlock ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR controlBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; sprintf( controlBlock, "%s.%s", windowBlock, "ContinueButton" ); m_continueButton = new ctp2_Button(&errcode, aui_UniqueId(), controlBlock, HighScoreWinButtonActionCallback, this); Assert( AUI_NEWOK(m_continueButton, errcode) ); if ( !AUI_NEWOK(m_continueButton, errcode) ) return -1; sprintf( controlBlock, "%s.%s", windowBlock, "QuitButton" ); m_quitButton = new ctp2_Button(&errcode, aui_UniqueId(), controlBlock, HighScoreWinButtonActionCallback, this); Assert( AUI_NEWOK(m_quitButton, errcode) ); if ( !AUI_NEWOK(m_quitButton, errcode) ) return -1; sprintf( controlBlock, "%s.%s", windowBlock, "HighScoreList" ); m_list = new ctp2_ListBox(&errcode, aui_UniqueId(), controlBlock, NULL, NULL); Assert( AUI_NEWOK(m_list, errcode) ); if ( !AUI_NEWOK(m_list, errcode) ) return -1; sprintf(controlBlock, "%s.%s", windowBlock, "Title"); m_window->AddTitle(controlBlock); errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); return 0; }
AUI_ERRCODE passwordscreen_Initialize( void ) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; MBCHAR controlBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; if ( s_passwordScreen ) return AUI_ERRCODE_OK; strcpy(windowBlock, "passwordscreen"); s_passwordScreen = new ns_Window( &errcode, aui_UniqueId(), windowBlock, 0, AUI_WINDOW_TYPE_FLOATING); Assert( AUI_NEWOK(s_passwordScreen, errcode) ); if ( !AUI_NEWOK(s_passwordScreen, errcode) ) errcode; s_okButton = spNew_ctp2_Button( &errcode, windowBlock, "button0", PasswordScreenCallback); Assert( AUI_NEWOK(s_okButton, errcode) ); if ( !AUI_NEWOK(s_okButton, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "askstatic" ); s_askStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_askStatic, errcode) ); if ( !AUI_NEWOK(s_askStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "joinstatic" ); s_joinStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_joinStatic, errcode) ); if ( !AUI_NEWOK(s_joinStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "yesnoswitchgroup" ); s_yesnoSwitchGroup = new aui_SwitchGroup( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_yesnoSwitchGroup, errcode) ); if ( !AUI_NEWOK(s_yesnoSwitchGroup, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "yesnoswitchgroup.yesradio" ); s_yesRadio = new aui_Radio( &errcode, aui_UniqueId(), controlBlock, PasswordScreenCallback ); Assert( AUI_NEWOK(s_yesRadio, errcode) ); if ( !AUI_NEWOK(s_yesRadio, errcode) ) return errcode; s_yesnoSwitchGroup->AddSwitch( s_yesRadio ); sprintf( controlBlock, "%s.%s", windowBlock, "yesnoswitchgroup.noradio" ); s_noRadio = new aui_Radio( &errcode, aui_UniqueId(), controlBlock, PasswordScreenCallback ); Assert( AUI_NEWOK(s_noRadio, errcode) ); if ( !AUI_NEWOK(s_noRadio, errcode) ) return errcode; s_yesnoSwitchGroup->AddSwitch( s_noRadio ); sprintf( controlBlock, "%s.%s", windowBlock, "inputstatic" ); s_inputStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_inputStatic, errcode) ); if ( !AUI_NEWOK(s_inputStatic, errcode) ) return errcode; Assert( AUI_NEWOK(s_yesnoSwitchGroup, errcode) ); if ( !AUI_NEWOK(s_yesnoSwitchGroup, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "inputtextfield" ); s_inputTextField = new C3TextField( &errcode, aui_UniqueId(), controlBlock, PasswordScreenCallback ); Assert( AUI_NEWOK(s_inputTextField, errcode) ); if ( !AUI_NEWOK(s_inputTextField, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "denystatic" ); s_denyStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_denyStatic, errcode) ); if ( !AUI_NEWOK(s_denyStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "fullstatic" ); s_fullStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_fullStatic, errcode) ); if ( !AUI_NEWOK(s_fullStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "nolobbystatic" ); s_nolobbyStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_nolobbyStatic, errcode) ); if ( !AUI_NEWOK(s_nolobbyStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "connectionloststatic" ); s_connectionlostStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_connectionlostStatic, errcode) ); if ( !AUI_NEWOK(s_connectionlostStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "nodialupstatic" ); s_nodialupStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_nodialupStatic, errcode) ); if ( !AUI_NEWOK(s_nodialupStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "connectionerrstatic" ); s_connectionerrStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_connectionerrStatic, errcode) ); if ( !AUI_NEWOK(s_connectionerrStatic, errcode) ) return errcode; sprintf( controlBlock, "%s.%s", windowBlock, "noscenariostatic" ); s_scenarionotfoundStatic = new c3_Static( &errcode, aui_UniqueId(), controlBlock ); Assert( AUI_NEWOK(s_scenarionotfoundStatic, errcode) ); if ( !AUI_NEWOK(s_scenarionotfoundStatic, errcode) ) return errcode; return AUI_ERRCODE_OK; }
AUI_ERRCODE graphicsscreen_Initialize( void ) { s_gridToggled = FALSE; s_cityInfluenceToggled = FALSE; s_politicalBordersToggled = FALSE; if ( s_graphicsWindow ) return AUI_ERRCODE_OK; AUI_ERRCODE errcode = AUI_ERRCODE_OK; MBCHAR windowBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; strcpy(windowBlock, "GraphicsWindow"); s_graphicsWindow = new c3_PopupWindow( &errcode, aui_UniqueId(), windowBlock, 16, AUI_WINDOW_TYPE_FLOATING, false ); Assert( AUI_NEWOK(s_graphicsWindow, errcode) ); if ( !AUI_NEWOK(s_graphicsWindow, errcode) ) return errcode; s_graphicsWindow->SetStronglyModal(TRUE); s_walk = spNew_aui_Switch(&errcode,windowBlock,"WalkButton",graphicsscreen_checkPress,&check[GS_WALK]); s_trade = spNew_aui_Switch(&errcode,windowBlock,"TradeButton",graphicsscreen_checkPress,&check[GS_TRADE]); s_wonder = spNew_aui_Switch(&errcode,windowBlock,"WonderButton",graphicsscreen_checkPress,&check[GS_WONDER]); s_politicalBorders = spNew_aui_Switch(&errcode,windowBlock,"PoliticalBordersButton",graphicsscreen_checkPress,&check[GS_POLITICALBORDERS]); s_tradeRoutes = spNew_aui_Switch(&errcode,windowBlock,"TradeRoutesButton",graphicsscreen_checkPress,&check[GS_TRADEROUTES]); s_cityInfluence = spNew_aui_Switch(&errcode,windowBlock,"CityInflenceButton",graphicsscreen_checkPress,&check[GS_CITYINFLUENCE]); s_grid = spNew_aui_Switch(&errcode,windowBlock,"GridButton",graphicsscreen_checkPress,&check[GS_GRID]); s_cityNames = spNew_aui_Switch(&errcode,windowBlock,"CityNamesButton", graphicsscreen_checkPress, &check[GS_CITYNAMES]); s_armyNames = spNew_aui_Switch(&errcode,windowBlock,"ArmyNamesButton", graphicsscreen_checkPress, &check[GS_ARMYNAMES]); s_civflags = spNew_aui_Switch(&errcode,windowBlock,"CivFlagButton", graphicsscreen_checkPress, &check[GS_CIVFLAGS]); s_resScreenButton = spNew_ctp2_Button( &errcode, windowBlock, "ResolutionButton", graphicsscreen_selectResolution ); s_smooth = spNew_aui_Switch(&errcode,windowBlock,"SmoothButton", graphicsscreen_checkPress, &check[GS_SMOOTH]); s_goodAnims = spNew_aui_Switch(&errcode,windowBlock,"GoodsButton",graphicsscreen_checkPress,&check[GS_GOODANIMS]); s_cityProd = spNew_aui_Switch(&errcode,windowBlock,"ShowCityProdButton",graphicsscreen_checkPress,&check[GS_CITYPROD]); s_unitSpeed = spNew_C3Slider(&errcode, windowBlock, "UnitSpeedSlider", graphicsscreen_unitSpeedSlide); s_unitSpeedN = spNew_c3_Static(&errcode, windowBlock, "UnitSpeedName"); if(g_theProfileDB) { s_unitSpeed->SetValue(g_theProfileDB->GetUnitSpeed(), 0); } else { s_unitSpeed->SetValue(0,0); } s_walk ->SetState(g_theProfileDB->IsUnitAnim()); s_trade ->SetState(g_theProfileDB->IsTradeAnim()); s_wonder ->SetState(g_theProfileDB->IsWonderMovies()); s_politicalBorders ->SetState(g_theProfileDB->GetShowPoliticalBorders()); s_tradeRoutes ->SetState(g_theProfileDB->GetShowTradeRoutes()); s_cityNames ->SetState(g_theProfileDB->GetShowCityNames()); s_armyNames ->SetState(g_theProfileDB->GetShowArmyNames()); s_civflags ->SetState(g_theProfileDB->IsCivFlags()); s_smooth ->SetState(g_theProfileDB->IsSmoothBorders()); s_goodAnims ->SetState(g_theProfileDB->IsGoodAnim()); s_cityInfluence ->SetState(g_theProfileDB->IsShowCityInfluence()); s_grid ->SetState(g_isGridOn); s_cityProd ->SetState(g_theProfileDB->IsShowCityProduction()); MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; sprintf( block, "%s.%s", windowBlock, "Name" ); s_graphicsWindow->AddTitle( block ); s_graphicsWindow->AddClose( graphicsscreen_exitPress ); errcode = aui_Ldl::SetupHeirarchyFromRoot( windowBlock ); Assert( AUI_SUCCESS(errcode) ); return AUI_ERRCODE_OK; }