本文整理汇总了C++中TextEdit::SetBackGround方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEdit::SetBackGround方法的具体用法?C++ TextEdit::SetBackGround怎么用?C++ TextEdit::SetBackGround使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEdit
的用法示例。
在下文中一共展示了TextEdit::SetBackGround方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetWindow
/** Returns the i-th window in the Previously Loaded Stream */
Window* CHUImporter::GetWindow(unsigned int wid)
{
ieWord WindowID, XPos, YPos, Width, Height, BackGround;
ieWord ControlsCount, FirstControl;
ieResRef MosFile;
unsigned int i;
bool found = false;
for (unsigned int c = 0; c < WindowCount; c++) {
str->Seek( WEOffset + ( 0x1c * c ), GEM_STREAM_START );
str->ReadWord( &WindowID );
if (WindowID == wid) {
found = true;
break;
}
}
if (!found) {
return NULL;
}
str->Seek( 2, GEM_CURRENT_POS );
str->ReadWord( &XPos );
str->ReadWord( &YPos );
str->ReadWord( &Width );
str->ReadWord( &Height );
str->ReadWord( &BackGround );
str->ReadWord( &ControlsCount );
str->ReadResRef( MosFile );
str->ReadWord( &FirstControl );
Window* win = new Window( WindowID, XPos, YPos, Width, Height );
if (BackGround == 1) {
ResourceHolder<ImageMgr> mos(MosFile);
if (mos != NULL) {
win->SetBackGround( mos->GetSprite2D(), true );
} else
printMessage( "CHUImporter","Cannot Load BackGround, skipping\n",YELLOW );
}
if (!core->IsAvailable( IE_BAM_CLASS_ID )) {
printMessage( "CHUImporter","No BAM Importer Available, skipping controls\n",LIGHT_RED );
return win;
}
for (i = 0; i < ControlsCount; i++) {
str->Seek( CTOffset + ( ( FirstControl + i ) * 8 ), GEM_STREAM_START );
ieDword COffset, CLength, ControlID;
ieWord XPos, YPos, Width, Height;
ieByte ControlType, temp;
str->ReadDword( &COffset );
str->ReadDword( &CLength );
str->Seek( COffset, GEM_STREAM_START );
str->ReadDword( &ControlID );
str->ReadWord( &XPos );
str->ReadWord( &YPos );
str->ReadWord( &Width );
str->ReadWord( &Height );
str->Read( &ControlType, 1 );
str->Read( &temp, 1 );
switch (ControlType) {
case IE_GUI_BUTTON:
{
//Button
Button* btn = new Button( );
btn->ControlID = ControlID;
btn->XPos = XPos;
btn->YPos = YPos;
btn->Width = Width;
btn->Height = Height;
btn->ControlType = ControlType;
ieResRef BAMFile;
ieWord Cycle, UnpressedIndex, PressedIndex,
SelectedIndex, DisabledIndex;
str->ReadResRef( BAMFile );
str->ReadWord( &Cycle );
str->ReadWord( &UnpressedIndex );
str->ReadWord( &PressedIndex );
str->ReadWord( &SelectedIndex );
str->ReadWord( &DisabledIndex );
btn->Owner = win;
/** Justification comes from the .chu, other bits are set by script */
if (!Width) {
btn->SetFlags(IE_GUI_BUTTON_NO_IMAGE, BM_OR);
}
if (core->HasFeature(GF_UPPER_BUTTON_TEXT)) {
btn->SetFlags(IE_GUI_BUTTON_CAPS, BM_OR);
}
btn->SetFlags( Cycle&0xff00, BM_OR );
if (strnicmp( BAMFile, "guictrl\0", 8 ) == 0) {
if (UnpressedIndex == 0) {
printMessage("CHUImporter", "Special Button Control, Skipping Image Loading\n",GREEN );
win->AddControl( btn );
break;
}
}
AnimationFactory* bam = ( AnimationFactory* )
gamedata->GetFactoryResource( BAMFile,
IE_BAM_CLASS_ID, IE_NORMAL );
if (!bam ) {
printMessage( "CHUImporter","Cannot Load Button Images, skipping control\n",LIGHT_RED );
/* IceWind Dale 2 has fake BAM ResRefs for some Buttons,
//.........这里部分代码省略.........
示例2: GetWindow
/** Returns the i-th window in the Previously Loaded Stream */
Window* CHUImporter::GetWindow(unsigned int wid)
{
ieWord WindowID, XPos, YPos, Width, Height, BackGround;
ieWord ControlsCount, FirstControl;
ieResRef MosFile;
unsigned int i;
if (!str) {
Log(ERROR, "CHUImporter", "No data stream to read from, skipping controls");
return NULL;
}
bool found = false;
for (unsigned int c = 0; c < WindowCount; c++) {
str->Seek( WEOffset + ( 0x1c * c ), GEM_STREAM_START );
str->ReadWord( &WindowID );
if (WindowID == wid) {
found = true;
break;
}
}
if (!found) {
return NULL;
}
str->Seek( 2, GEM_CURRENT_POS );
str->ReadWord( &XPos );
str->ReadWord( &YPos );
str->ReadWord( &Width );
str->ReadWord( &Height );
str->ReadWord( &BackGround );
str->ReadWord( &ControlsCount );
str->ReadResRef( MosFile );
str->ReadWord( &FirstControl );
Window* win = new Window( WindowID, XPos, YPos, Width, Height );
if (BackGround == 1) {
ResourceHolder<ImageMgr> mos(MosFile);
if (mos != NULL) {
win->SetBackGround( mos->GetSprite2D(), true );
}
}
if (!core->IsAvailable( IE_BAM_CLASS_ID )) {
Log(ERROR, "CHUImporter", "No BAM Importer Available, skipping controls");
return win;
}
for (i = 0; i < ControlsCount; i++) {
str->Seek( CTOffset + ( ( FirstControl + i ) * 8 ), GEM_STREAM_START );
ieDword COffset, CLength, ControlID;
Region ctrlFrame;
ieWord tmp;
ieByte ControlType, temp;
str->ReadDword( &COffset );
str->ReadDword( &CLength );
str->Seek( COffset, GEM_STREAM_START );
str->ReadDword( &ControlID );
str->ReadWord( &tmp );
ctrlFrame.x = tmp;
str->ReadWord( &tmp);
ctrlFrame.y = tmp;
str->ReadWord( &tmp );
ctrlFrame.w = tmp;
str->ReadWord( &tmp );
ctrlFrame.h = tmp;
str->Read( &ControlType, 1 );
str->Read( &temp, 1 );
switch (ControlType) {
case IE_GUI_BUTTON:
{
//Button
Button* btn = new Button(ctrlFrame);
btn->ControlID = ControlID;
ieResRef BAMFile;
ieByte Cycle, tmp;
ieDword Flags;
ieByte UnpressedIndex, x1;
ieByte PressedIndex, x2;
ieByte SelectedIndex, y1;
ieByte DisabledIndex, y2;
str->ReadResRef( BAMFile );
str->Read( &Cycle, 1 );
str->Read( &tmp, 1 );
Flags = ((ieDword) tmp)<<8;
str->Read( &UnpressedIndex, 1 );
str->Read( &x1, 1 );
str->Read( &PressedIndex, 1 );
str->Read( &x2, 1 );
str->Read( &SelectedIndex, 1 );
str->Read( &y1, 1 );
str->Read( &DisabledIndex, 1 );
str->Read( &y2, 1 );
btn->Owner = win;
/** Justification comes from the .chu, other bits are set by script */
if (!Width) {
btn->SetFlags(IE_GUI_BUTTON_NO_IMAGE, BM_OR);
}
if (core->HasFeature(GF_UPPER_BUTTON_TEXT)) {
btn->SetFlags(IE_GUI_BUTTON_CAPS, BM_OR);
}
//.........这里部分代码省略.........