openclonk/src/gui/C4Folder.cpp

73 lines
1.5 KiB
C++
Raw Normal View History

2009-05-08 13:28:41 +00:00
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de/
2016-04-03 18:18:29 +00:00
* Copyright (c) 2009-2016, The OpenClonk Team and contributors
2009-05-08 13:28:41 +00:00
*
* Distributed under the terms of the ISC license; see accompanying file
* "COPYING" for details.
2009-05-08 13:28:41 +00:00
*
* "Clonk" is a registered trademark of Matthes Bender, used with permission.
* See accompanying file "TRADEMARK" for details.
2009-05-08 13:28:41 +00:00
*
* To redistribute this file separately, substitute the full license texts
* for the above references.
2009-05-08 13:28:41 +00:00
*/
/* Core component of a folder */
#include "C4Include.h"
#include "gui/C4Folder.h"
2009-05-08 13:28:41 +00:00
#include "c4group/C4Group.h"
#include "c4group/C4Components.h"
2009-05-08 13:28:41 +00:00
//================= C4FolderHead ====================
void C4FolderHead::Default()
2010-03-28 18:58:01 +00:00
{
2009-05-08 13:28:41 +00:00
Index = 0;
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00
void C4FolderHead::CompileFunc(StdCompiler *pComp)
2010-03-28 18:58:01 +00:00
{
pComp->Value(mkNamingAdapt(Index, "Index", 0));
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00
//=================== C4Folder ======================
C4Folder::C4Folder()
2010-03-28 18:58:01 +00:00
{
Default();
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00
void C4Folder::Default()
2010-03-28 18:58:01 +00:00
{
2009-05-08 13:28:41 +00:00
Head.Default();
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00
bool C4Folder::Load(C4Group &hGroup)
2010-03-28 18:58:01 +00:00
{
2009-05-08 13:28:41 +00:00
char *pSource;
// Load
if (!hGroup.LoadEntry(C4CFN_FolderCore, &pSource, nullptr, 1)) return false;
2009-05-08 13:28:41 +00:00
// Compile
if (!Compile(pSource)) { delete [] pSource; return false; }
2009-05-08 13:28:41 +00:00
delete [] pSource;
// Success
return true;
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00
void C4Folder::CompileFunc(StdCompiler *pComp)
2010-03-28 18:58:01 +00:00
{
pComp->Value(mkNamingAdapt(Head, "Head"));
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00
bool C4Folder::Compile(const char *szSource)
2010-03-28 18:58:01 +00:00
{
2009-05-08 13:28:41 +00:00
Default();
return CompileFromBuf_LogWarn<StdCompilerINIRead>(*this, StdStrBuf(szSource), C4CFN_FolderCore);
2010-03-28 18:58:01 +00:00
}
2009-05-08 13:28:41 +00:00