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 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; }
AUI_ERRCODE c3_PopupWindow::InitCommon(void) { AUI_ERRCODE errcode = AUI_ERRCODE_OK; m_border[POPUP_BORDER_UL] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupUL"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_UL], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_UL], errcode) ) return errcode; m_border[POPUP_BORDER_UL]->Move( 0, 0 ); m_border[POPUP_BORDER_UR] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupUR"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_UR], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_UR], errcode) ) return errcode; m_border[POPUP_BORDER_UR]->Move( m_width - m_border[POPUP_BORDER_UR]->Width(), 0 ); m_border[POPUP_BORDER_LL] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupLL"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_LL], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_LL], errcode) ) return errcode; m_border[POPUP_BORDER_LL]->Move( 0, m_height - m_border[POPUP_BORDER_LL]->Height() ); m_border[POPUP_BORDER_LR] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupLR"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_LR], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_LR], errcode) ) return errcode; m_border[POPUP_BORDER_LR]->Move( m_width - m_border[POPUP_BORDER_LR]->Width(), m_height - m_border[POPUP_BORDER_LR]->Height() ); sint32 cornerHeight = m_border[POPUP_BORDER_UL]->Height(); sint32 cornerWidth = m_border[POPUP_BORDER_UL]->Width(); m_border[POPUP_BORDER_LEFT] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupLeft"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_LEFT], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_LEFT], errcode) ) return errcode; m_border[POPUP_BORDER_LEFT]->Move( 0, cornerHeight ); m_border[POPUP_BORDER_LEFT]->Resize( m_border[POPUP_BORDER_LEFT]->Width(), m_height - cornerHeight * 2 ); m_border[POPUP_BORDER_TOP] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupTop"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_TOP], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_TOP], errcode) ) return errcode; m_border[POPUP_BORDER_TOP]->Move( cornerWidth, 0 ); m_border[POPUP_BORDER_TOP]->Resize( m_width - cornerWidth * 2, m_border[POPUP_BORDER_TOP]->Height() ); m_border[POPUP_BORDER_RIGHT] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupRight"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_RIGHT], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_RIGHT], errcode) ) return errcode; m_border[POPUP_BORDER_RIGHT]->Move( m_width - m_border[POPUP_BORDER_RIGHT]->Width(), cornerHeight ); m_border[POPUP_BORDER_RIGHT]->Resize( m_border[POPUP_BORDER_RIGHT]->Width(), m_height - cornerHeight * 2 ); m_border[POPUP_BORDER_BOTTOM] = new c3_Static(&errcode, aui_UniqueId(), "c3_PopupBottom"); Assert( AUI_NEWOK(m_border[POPUP_BORDER_BOTTOM], errcode) ); if ( !AUI_NEWOK(m_border[POPUP_BORDER_BOTTOM], errcode) ) return errcode; m_border[POPUP_BORDER_BOTTOM]->Move( cornerWidth, m_height - m_border[POPUP_BORDER_BOTTOM]->Height() ); m_border[POPUP_BORDER_BOTTOM]->Resize( m_width - cornerWidth * 2, m_border[POPUP_BORDER_BOTTOM]->Height() ); for (int i = POPUP_BORDER_UL; i < POPUP_BORDER_MAX; ++i) { m_border[i]->IgnoreEvents( TRUE ); AddControl( m_border[i] ); } return C3Window::InitCommon(); }
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; }
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 aui_TextBox::InitCommon( void ) { m_numItems = 0, m_curItem = 0; m_curColor = k_AUI_UI_NOCOLOR; m_curBold = 0; m_curItalic = 0; TextReloadFont(); aui_Static **itemPtr = m_items; for ( uint32 i = k_AUI_TEXTBOX_MAXITEMS; i; i--, itemPtr++ ) { AUI_ERRCODE errcode; *itemPtr = new aui_Static( &errcode, aui_UniqueId(), 0, 0, m_width, m_textfont->GetMaxHeight(), NULL, k_AUI_TEXTBOX_MAXTEXT ); (*itemPtr)->SetBlindness( TRUE ); (*itemPtr)->TextFlags() = k_AUI_BITMAPFONT_DRAWFLAG_JUSTLEFT; (*itemPtr)->SetTextFont( m_textfont->GetTTFFile() ); (*itemPtr)->SetTextFontSize( m_textfont->GetPointSize() ); } 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; }
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; }
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; }
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; }
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(); }
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; }
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 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; }
AUI_ERRCODE HighScoreListItem::InitCommonLdl(MBCHAR *name, sint32 score, MBCHAR *ldlBlock) { MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; AUI_ERRCODE retval; m_score = score; strcpy(m_name,name); c3_Static *subItem; sprintf(block, "%s.%s", ldlBlock, "Rank"); subItem = new c3_Static(&retval, aui_UniqueId(), block); AddChild(subItem); sprintf(block, "%s.%s", ldlBlock, "Score"); subItem = new c3_Static(&retval, aui_UniqueId(), block); AddChild(subItem); Update(); return AUI_ERRCODE_OK; }
AUI_ERRCODE TextBox::InitCommon( BOOL fromLDL ) { m_numItems = 0, m_curItem = 0; m_curColor = k_AUI_UI_NOCOLOR; m_curBold = FALSE; m_curItalic = FALSE; sint32 i; aui_Static **itemPtr = m_items; TextReloadFont(); for (i=0; i<k_AUI_TEXTBOX_MAXITEMS; i++) { (*itemPtr) = NULL; itemPtr++; } aui_BitmapFont *font = GetTextFont(); if (!font) { aui_TextBase::SetTextFont(k_AUI_TEXTBASE_DEFAULT_FONTNAME); aui_TextBase::TextReloadFont(); font = GetTextFont(); } MBCHAR *fontName = font->GetTTFFile(); itemPtr = m_items; for (i = k_AUI_TEXTBOX_MAXITEMS; i; i--, itemPtr++ ) { AUI_ERRCODE errcode; *itemPtr = new c3_Static( &errcode, aui_UniqueId(), 10, 0, m_width-20, 14, NULL, NULL, k_AUI_TEXTBOX_MAXTEXT, 0 ,0 ); (*itemPtr)->SetTextFont( fontName); (*itemPtr)->SetTextFontSize(9); (*itemPtr)->TextFlags() = k_AUI_BITMAPFONT_DRAWFLAG_JUSTLEFT; (*itemPtr)->SetTextColor(GetTextColor()); if (GetTextShadow()) (*itemPtr)->SetTextShadow(TRUE); (*itemPtr)->SetTextShadowColor(GetTextShadowColor()); } 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 }
//---------------------------------------------------------------------------- // // 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; }
void BattleViewWindow::Initialize(Sequence *seq) { AUI_ERRCODE errcode; if (g_battleViewWindow) Cleanup(); g_battleViewWindow = new BattleViewWindow( &errcode, aui_UniqueId(), "BattleViewWindow", 16, AUI_WINDOW_TYPE_POPUP); g_battleViewWindow->SetSequence(seq); g_modalWindow++; Assert(g_battleViewWindow != NULL); }
AUI_ERRCODE ns_ListItem::InitCommonLdl( const MBCHAR *name, MBCHAR *ldlBlock) { MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; AUI_ERRCODE retval; sprintf(block, "%s.%s", ldlBlock, "Name"); c3_Static *subItem = new c3_Static(&retval, aui_UniqueId(), block); AddChild(subItem); subItem->SetText( name ); Update(); return AUI_ERRCODE_OK; }
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; }
AUI_ERRCODE MessageEyePointListItem::InitCommonLdl(MBCHAR const *name, sint32 index, MBCHAR const *ldlBlock) { MBCHAR block[ k_AUI_LDL_MAXBLOCK + 1 ]; AUI_ERRCODE retval; strcpy(m_name, name); m_index = index; c3_Static *subItem; sprintf(block, "%s.%s", ldlBlock, "name"); subItem = new c3_Static(&retval, aui_UniqueId(), block); subItem->TextFlags() = k_AUI_BITMAPFONT_DRAWFLAG_JUSTCENTER; AddChild(subItem); Update(); return AUI_ERRCODE_OK; }
PlayerSelectWindow::PlayerSelectWindow( AUI_ERRCODE *retval ) : ns_Window( retval, aui_UniqueId(), "playerselectwindow", 0, AUI_WINDOW_TYPE_STANDARD ) { Assert( AUI_SUCCESS(*retval) ); if ( !AUI_SUCCESS(*retval) ) return; *retval = InitCommon(); Assert( AUI_SUCCESS(*retval) ); if ( !AUI_SUCCESS(*retval) ) return; *retval = CreateControls(); Assert( AUI_SUCCESS(*retval) ); if ( !AUI_SUCCESS(*retval) ) return; }
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? }
sint32 c3_PopupWindow::AddOk ( void (*actionFunc)( aui_Control *, uint32, uint32, void *), void *cookie, MBCHAR *buttonBlock ) { if (m_ok) { // No action: already created } else { AUI_ERRCODE errcode = AUI_ERRCODE_OK; m_ok = new ctp2_Button( &errcode, aui_UniqueId(), buttonBlock, actionFunc, cookie ); TestControl( m_ok ); m_ok->Move( m_width - m_ok->Width() - 17, m_height - m_ok->Height() - 17); InsertChild(m_ok, 0); m_ok->SetParentWindow(this); } return 1; }
AUI_ERRCODE BattleViewWindow::InitCommonLdl(MBCHAR *ldlBlock) { MBCHAR buttonBlock[ k_AUI_LDL_MAXBLOCK + 1 ]; AUI_ERRCODE errcode; m_battleView = new BattleView(); Assert(m_battleView != NULL); sprintf(buttonBlock, "%s.%s", ldlBlock, "TitleText"); m_titleText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_titleText); sprintf(buttonBlock, "%s.%s", ldlBlock, "AttackersText"); m_attackersText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_attackersText); sprintf(buttonBlock, "%s.%s", ldlBlock, "AttackersName"); m_attackersName = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_attackersName); sprintf(buttonBlock, "%s.%s", ldlBlock, "AttackersFlag"); m_attackersFlag = new c3_Icon(&errcode, aui_UniqueId(), buttonBlock); Assert(m_attackersFlag); m_attackersFlag->SetMapIcon( MAPICON_FLAG ); sprintf(buttonBlock, "%s.%s", ldlBlock, "DefendersText"); m_defendersText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_defendersText); sprintf(buttonBlock, "%s.%s", ldlBlock, "DefendersName"); m_defendersName = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_defendersName); sprintf(buttonBlock, "%s.%s", ldlBlock, "DefendersFlag"); m_defendersFlag = new c3_Icon(&errcode, aui_UniqueId(), buttonBlock); Assert(m_defendersFlag); m_defendersFlag->SetMapIcon( MAPICON_FLAG ); sprintf(buttonBlock, "%s.%s", ldlBlock, "TerrainBonusText"); m_terrainBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_terrainBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "TerrainBonusValue"); m_terrainBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_terrainBonusValue); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityBonusText"); m_cityBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityBonusValue"); m_cityBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityBonusValue); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityLandAttackBonusText"); m_citylandattackBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_citylandattackBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityLandAttackBonusValue"); m_citylandattackBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_citylandattackBonusValue); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityAirAttackBonusText"); m_cityairattackBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityairattackBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityAirAttackBonusValue"); m_cityairattackBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityairattackBonusValue); sprintf(buttonBlock, "%s.%s", ldlBlock, "CitySeaAttackBonusText"); m_cityseaattackBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityseaattackBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "CitySeaAttackBonusValue"); m_cityseaattackBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityseaattackBonusValue); sprintf(buttonBlock, "%s.%s", ldlBlock, "CityName"); m_cityName = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_cityName); sprintf(buttonBlock, "%s.%s", ldlBlock, "FortBonusText"); m_fortBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_fortBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "FortBonusValue"); m_fortBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_fortBonusValue); m_fortBonusImage = NULL; sprintf(buttonBlock, "%s.%s", ldlBlock, "FortifiedBonusText"); m_fortifiedBonusText = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_fortifiedBonusText); sprintf(buttonBlock, "%s.%s", ldlBlock, "FortifiedBonusValue"); m_fortifiedBonusValue = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_fortifiedBonusValue); sprintf(buttonBlock, "%s.%s", ldlBlock, "ExitButton"); m_exitButton = new ctp2_Button(&errcode, aui_UniqueId(), buttonBlock, battleview_ExitButtonActionCallback); Assert(m_exitButton != NULL); sprintf(buttonBlock, "%s.%s", ldlBlock, "RetreatButton"); m_retreatButton = new ctp2_Button(&errcode, aui_UniqueId(), buttonBlock, battleview_RetreatButtonActionCallback); Assert(m_retreatButton != NULL); sprintf(buttonBlock, "%s.%s", ldlBlock, "TopBorder"); m_topBorder = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_topBorder); sprintf(buttonBlock, "%s.%s", ldlBlock, "LeftBorder"); m_leftBorder = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_leftBorder); sprintf(buttonBlock, "%s.%s", ldlBlock, "RightBorder"); m_rightBorder = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_rightBorder); sprintf(buttonBlock, "%s.%s", ldlBlock, "BottomBorder"); m_bottomBorder = new ctp2_Static(&errcode, aui_UniqueId(), buttonBlock); Assert(m_bottomBorder); sprintf(buttonBlock, "%s.%s", ldlBlock, "BattleViewArea"); ldl_datablock *block = aui_Ldl::GetLdl()->FindDataBlock( buttonBlock ); Assert(block); if (!block) return AUI_ERRCODE_OK; if ( block->GetAttributeType( k_AUI_LDL_HABSPOSITION ) == ATTRIBUTE_TYPE_INT ) { m_battleViewRect.left = block->GetInt( k_AUI_LDL_HABSPOSITION ); } if ( block->GetAttributeType( k_AUI_LDL_VABSPOSITION ) == ATTRIBUTE_TYPE_INT ) { m_battleViewRect.top = block->GetInt( k_AUI_LDL_VABSPOSITION ); } if ( block->GetAttributeType( k_AUI_LDL_HABSSIZE ) == ATTRIBUTE_TYPE_INT ) { m_battleViewRect.right = m_battleViewRect.left + block->GetInt( k_AUI_LDL_HABSSIZE ); } if ( block->GetAttributeType( k_AUI_LDL_VABSSIZE ) == ATTRIBUTE_TYPE_INT ) { m_battleViewRect.bottom = m_battleViewRect.top + block->GetInt( k_AUI_LDL_VABSSIZE ); } errcode = aui_Ldl::SetupHeirarchyFromRoot( ldlBlock ); return AUI_ERRCODE_OK; }
#include "Globals.h" #include "soundmanager.h" #include "StatusBar.h" #include "ldl_data.hpp" extern SoundManager *g_soundManager; static MBCHAR *k_AUI_REGION_LDL_BLINDNESS = "mouseblind"; aui_Region * aui_Region::s_whichSeesMouse = NULL; aui_Region * aui_Region::s_editChild = NULL; uint32 aui_Region::s_editSelectionCount = 0; uint32 aui_Region::s_editSelectionCurrent = 0; uint32 aui_Region::s_editModeStatus = AUI_EDIT_MODE_CHOOSE_REGION; tech_WLList<aui_Undo *> * aui_Region::s_undoList = NULL; uint32 aui_Region::s_regionClassId = aui_UniqueId(); aui_Region::aui_Region ( AUI_ERRCODE * retval, uint32 id, MBCHAR const * ldlBlock ) : aui_Base (), m_id (id), m_x (0), m_y (0), m_width (0), m_height (0), m_dim (new aui_Dimension()),