void CMenuCharacterFiles::Build() { CMenuBase::Build(); SetOptionPos(MENU_FILE_FIELD_X + MENU_FILE_TEXT_OFFSET_X, MENU_FILE_FIELD_Y + MENU_FILE_TEXT_OFFSET_Y); SetItemSpacing(0); SetScrollWrap(DFALSE); // Remove all of the menu options RemoveAllOptions(); if(m_nAction == MENU_ACTION_SAVE) { m_hEdit = AddEditOption("Type the filename:", 0, m_pMainMenus->GetSmallFont(), 135, 16, DNULL); m_hEdit->SetText("Default"); } else InitFileList("Players"); m_hTransColor = m_pClientDE->SetupColor1(1.0f, 0.0f, 1.0f, DFALSE); // Delete the surface of the file field if(m_hFileField) { m_pClientDE->DeleteSurface(m_hFileField); m_hFileField = 0; } m_hFileField = m_pClientDE->CreateSurfaceFromBitmap("interface/mainmenus/dialog.pcx"); }
// Wrapper for adding a control with a string ID instead of an HSTRING CLTGUIEditCtrl *CMenuBase::AddEditOption(int messageCode, DWORD dwCommandID, CLTGUIFont *pFont, int nEditStringOffset, int nBufferSize, char *lpszValue) { // Load the string HSTRING hString=DNULL; if (messageCode) { hString=m_pClientDE->FormatString(messageCode); } // Create the control CLTGUIEditCtrl *pCtrl=AddEditOption(hString, dwCommandID, pFont, nEditStringOffset, nBufferSize, lpszValue); // Free the string if (hString) { m_pClientDE->FreeString(hString); } return pCtrl; }