本文整理汇总了C++中CFileDialog::AddFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileDialog::AddFilter方法的具体用法?C++ CFileDialog::AddFilter怎么用?C++ CFileDialog::AddFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileDialog
的用法示例。
在下文中一共展示了CFileDialog::AddFilter方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnImportImage
void CImageMgr::OnImportImage()
{
if( fontGen->GetStatus() != 0 ) return;
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*");
dlg.AddFilter("Supported image files (*.bmp;*.jpg;*.tga;*.dds;*.png)", "*.bmp;*.jpg;*.tga;*.dds;*.png", true);
if( dlg.AskForOpenFileName(this) )
{
CIconImageDlg iconDlg;
iconDlg.fileName = dlg.GetFileName();
iconDlg.id = 0;
iconDlg.xoffset = 0;
iconDlg.yoffset = 0;
iconDlg.advance = 0;
if( iconDlg.DoModal(this) == IDOK )
{
// Create the icon image
int r = fontGen->AddIconImage(iconDlg.fileName.c_str(),
iconDlg.id,
iconDlg.xoffset,
iconDlg.yoffset,
iconDlg.advance);
if( r < 0 )
{
MessageBox(hWnd, "Failed to load image file", "File error", MB_OK);
return;
}
RefreshList();
}
}
}
示例2: OnLoadFontConfiguration
void CCharWin::OnLoadFontConfiguration()
{
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*");
dlg.AddFilter("BMFont Font config (*.csv)", "*.csv", true);
dlg.AddFilter("Text (*.txt)", "*.txt");
if (dlg.AskForOpenFileName(this))
LoadFontConfig(dlg.GetFileName());
}
示例3: OnSelectCharsFromFile
void CCharWin::OnSelectCharsFromFile()
{
if( isGenerating ) return;
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*", true);
if( dlg.AskForOpenFileName(this) )
{
fontGen->SelectCharsFromFile(dlg.GetFileName().c_str());
int countMissing = fontGen->GetNumFailedChars();
if( countMissing )
{
stringstream s;
s << countMissing << " characters from the file are not available in the font";
TCHAR buf[1024];
ConvertAnsiToTChar(s.str(), buf, 1024);
MessageBox(hWnd, buf, __TEXT("Warning"), MB_OK);
}
UpdateSubsetsSelection();
Invalidate(FALSE);
}
}
示例4: OnSaveFontConfiguration
void CCharWin::OnSaveFontConfiguration()
{
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*");
dlg.AddFilter("BMFont Font config (*.csv)", "*.csv", true);
dlg.AddFilter("Text (*.txt)", "*.txt");
// Open a SaveAs dialog to get a filename from the user
if (dlg.AskForSaveFileName(this))
{
FILE *file = NULL;
string path = dlg.GetFileName();
file = fopen(path.c_str(), "w+");
if (NULL != file)
{
// write the column definitions
string definitions = "character,image_path,x_offset,y_offset,x_advance,x,y,width,height\n";
fwrite(definitions.c_str(), 1, definitions.size(), file);
const map<int, SIconImage *> &IconImages = fontGen->GetIconImageInfo();
for (map<int, SIconImage *>::const_iterator itr = IconImages.begin(); IconImages.end() != itr; ++itr)
{
TCHAR characterT[4] = { 0 };
characterT[0] = itr->first;
string character;
ConvertTCharToAnsi(characterT, character);
char info[1024] = { 0 };
int length = sprintf(info, "%s,%s,%d,%d,%d,%d,%d,%d,%d\n", \
character.c_str(), \
itr->second->fileName.c_str(), \
itr->second->xoffset, \
itr->second->yoffset, \
itr->second->advance, \
itr->second->x, \
itr->second->y, \
itr->second->width, \
itr->second->height);
fwrite(info, 1, length, file);
}
fclose(file);
}
}
}
示例5: OnLoadConfiguration
void CCharWin::OnLoadConfiguration()
{
if( isGenerating ) return;
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*");
dlg.AddFilter("BMFont config (*.bmfc)", "*.bmfc", true);
dlg.AddFilter("Text (*.txt)", "*.txt");
string dir = fontGen->GetLastConfigFile();
if( dir != GetDefaultConfig() )
{
// cut off the filename and last /
dir = dir.substr(0, dir.find_last_of("/\\"));
dlg.SetInitialDir(dir.c_str());
}
if( dlg.AskForOpenFileName(this) )
LoadConfig(dlg.GetFileName());
}
示例6: OnSaveConfiguration
void CCharWin::OnSaveConfiguration()
{
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*");
dlg.AddFilter("BMFont config (*.bmfc)", "*.bmfc", true);
dlg.AddFilter("Text (*.txt)", "*.txt");
string dir = fontGen->GetLastConfigFile();
if( dir != GetDefaultConfig() )
{
// cut off the filename and last /
dir = dir.substr(0, dir.find_last_of("/\\"));
dlg.SetInitialDir(dir.c_str());
}
// Open a SaveAs dialog to get a filename from the user
if( dlg.AskForSaveFileName(this) )
{
fontGen->SaveConfiguration(dlg.GetFileName().c_str());
}
}
示例7: OnBrowseFont
void CChooseFont::OnBrowseFont()
{
CFileDialog dlg;
dlg.AddFilter("Windows font files", "*.fon;*.fnt;*.ttf;*.ttc;*.fot;*.otf;", true);
if( dlg.AskForOpenFileName(this) )
{
TCHAR buf[1024];
ConvertAnsiToTChar(dlg.GetFileName(), buf, 1024);
SetDlgItemText(hWnd, IDC_FONTFILE, buf);
EnumFonts();
}
}
示例8: OnSaveAs
void CCharWin::OnSaveAs()
{
if( isGenerating ) return;
CFileDialog dlg;
dlg.AddFilter("All files (*.*)", "*.*");
dlg.AddFilter("Bitmap font (*.fnt)", "*.fnt", true);
// Open a SaveAs dialog to get a filename from the user
if( dlg.AskForSaveFileName(this) )
{
saveFontName = dlg.GetFileName();
// First start the generation
fontGen->GeneratePages();
// Let the time know what to do when the generation is finished
whenGenerateIsFinished = 2;
isGenerating = true;
SetCursor(LoadCursor(0, IDC_WAIT));
}
}