本文整理匯總了C++中AddButton函數的典型用法代碼示例。如果您正苦於以下問題:C++ AddButton函數的具體用法?C++ AddButton怎麽用?C++ AddButton使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了AddButton函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: LOG
void CNativeToolbar::addToolbarButton(CToolbarBtn& oButton, int nPos)
{
LOG(INFO) + "addToolbarButton: " + oButton.toString();
TBBUTTON btn = {0};
btn.iBitmap = I_IMAGENONE;
if ( oButton.isSeparator() )
{
btn.fsStyle = TBSTYLE_SEP;
if ( oButton.m_nItemWidth )
btn.iBitmap = oButton.m_nItemWidth;
else
{
CSize size;
m_listImages.GetIconSize(size);
btn.iBitmap = size.cx;
oButton.m_nItemWidth = btn.iBitmap;
}
}else
{
btn.iString = (INT_PTR)oButton.m_strLabelW.c_str();
btn.fsStyle = TBSTYLE_BUTTON|TBSTYLE_AUTOSIZE;
btn.fsState = TBSTATE_ENABLED;
btn.idCommand = ID_CUSTOM_TOOLBAR_ITEM_FIRST + nPos;
if ( oButton.m_hImage )
{
btn.iBitmap = m_listImages.Add(oButton.m_hImage, m_rgbMaskColor);
//btn.iBitmap = AddBitmap(1,oButton.m_hImage);
}
}
BOOL bRes = AddButton(&btn);
if ( !bRes )
LOG(ERROR) + "Error";
}
示例2: AddButton
//================================================================================================================
void MenuEditorSystem::OnMouseMove(WPARAM btnState, int x, int y)
{
// Start a left button drag of an item
if ((btnState & MK_LBUTTON) != 0)
{
m_SelectedMousePos.x = x;
m_SelectedMousePos.y = y;
m_leftButtonDown = true;
// If applicable, Add a button
if (BetterString(m_SelectedButtonImageName) != "")
{
AddButton();
}
// If applicable, Add a text
AddText();
}
else
{
m_leftButtonDown = false;
}
m_MouseMovePos = SnapToGrid(x, y);
// Move a button or text display cover
if (editType == ET_Button && (action == A_Place || action == A_Move))
{
if (m_displaySpriteCover == NULL)
{
if (BetterString(m_SelectedButtonImageName) != "")
{
m_displaySpriteCover = new Sprite(m_D3DSystem);
m_displaySpriteCover->Initialize(m_mainGameDirectory->m_menu_sprites_path, m_SelectedButtonImageName, XMFLOAT3(m_MouseMovePos.x, m_MouseMovePos.y, 0), 80, 30, PhysicsType::STATIC);
}
}
}
}
示例3: InitCommonControls
void CAddress::Create(HWND hParent, long ID, HINSTANCE hInst)
{
InitCommonControls();
m_hInst = hInst;
m_hParent = hParent;
m_hAddress = CreateWindow(TOOLBARCLASSNAME, NULL, WS_CHILD | WS_VISIBLE | TBSTYLE_LIST,
0, 100, 100, 200,
m_hParent, (HMENU) ID, m_hInst, NULL);
m_nID = ID;
SetButtonImages();
AddNonButtonControl(_T("STATIC"), _T("Address"), WS_CHILD | WS_VISIBLE,
IDC_ADDRESS_STATIC, 50, 50, 0, IDC_ADDRESS_STATIC, 3);
HFONT hFont = (HFONT) GetStockObject(DEFAULT_GUI_FONT);
SendMessage(GetDlgItem(m_hAddress, IDC_ADDRESS_STATIC), WM_SETFONT, (WPARAM) hFont, TRUE);
RECT main;
GetWindowRect(m_hParent, &main);
AddNonButtonControl(_T("EDIT"), NULL, WS_CHILD | WS_VISIBLE,
IDC_ADDRESS_EDIT, 900, 20, 1, IDC_ADDRESS_EDIT, 1);
SendMessage(GetDlgItem(m_hAddress, IDC_ADDRESS_EDIT), WM_SETFONT, (WPARAM) hFont, TRUE);
AddButton(TBSTATE_ENABLED, BTNS_BUTTON, 0 , IDC_ADDRESS_GO, _T("Go"), 0);
}
示例4: Panel
DlgCollision::DlgCollision(Actor *actor, bool bCollision)
: Panel("DlgCollision", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - (bCollision?(HEIGHT + 55):HEIGHT))/2,
WIDTH, bCollision?(HEIGHT + 55):HEIGHT)
{
SetModal();
eventActor = actionActor = actor;
this->bCollision = bCollision;
Text *text;
Button *button;
Actor *add;
int y;
//Title
text = AddText(bCollision?"Collision Event":"Collision Finish Event", CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
if(bCollision)
{
SetToolTip(TIP_DLG_COLLISION);
text = AddText(" On: ", 10, y);
listSide = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_SIDE); listSide->SetToolTip(TIP_DLG_COLLISION_SIDE);
text = AddText(" Of Actor: ", 10, listSide->Down() + 2);
listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_DLG_COLLISION_ACTOR);
text = AddText(" Repeat this event\nwhile actor is colliding: ", 10, listActor->Down() + 2);
listType = AddListPop(listActor->Right() - 40, text->Top() + 10, 40, 0, LS_TYPE); listType->SetToolTip(TIP_DLG_COLLISION_REPEAT);
listType->AddText("Yes");
listType->AddText("No");
listType->SetItem("No");
listSide->AddText("Any Side");
listSide->AddText("Top Side");
listSide->AddText("Bottom Side");
listSide->AddText("Left Side");
listSide->AddText("Right Side");
listSide->AddText("Top or Bottom Side");
listSide->AddText("Left or Right Side");
listSide->SetItem("Any Side");
side = ANY_SIDE;
y = listType->Down() + 2;
}
else
{
SetToolTip(TIP_DLG_COLLISION_FINISH);
text = AddText(" Actor: ", 10, y);
listActor = AddListPop(text->Right() + 2, text->Top(), 128, 0, LS_ACTOR); listActor->SetToolTip(TIP_DLG_COLLISION_ACTOR);
y = listActor->Down() + 2;
}
//Close
y = DrawHLine(y);
if(Action::inNewActivationEvent())
{
add = AddButton("Choose Actor", 25, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTIVATIONEVENT_CHOOSE);
}
else if(Action::getEditAction())
{
add = AddButton("Edit Action", (WIDTH-135)/2 - 12, y, 0, 0, LS_ACTION); ((Button *)add)->SetToolTip(TIP_ACTION_EDIT);
}
else
{
add = AddListPop(30, y, 85, 0, LS_ACTION, "Add Action"); ((ListPop *)add)->SetToolTip(TIP_ADDACTION);
Action::Populate((ListPop *)add);
}
if(Action::getEditAction())
{
button = AddButton("Cancel", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CANCEL);
}
else
{
button = AddButton("Close", add->Right() + 10, y, 0, 0, BT_CLOSE); if(!Action::inNewActivationEvent()) button->SetToolTip(TIP_ACTION_CLOSE);
}
GameControl::Get()->PopulateActors(listActor);
if(!Tutorial::IsCompatible(VERSION_OUT_OF_VISION_OPTIMIZATION))
{
//Set default only in old tutorials
listActor->SetItem(actionActor->getCloneIndex()?actionActor->getCloneName():actionActor->getActorName());
}
listActor->AddText(ANY_ACTOR);
//.........這裏部分代碼省略.........
示例5: switch
void CBkSafeMsgBox::_MakeButtons()
{
if ((MB_BK_CUSTOM_BUTTON & m_uType) == MB_BK_CUSTOM_BUTTON)
return;
m_lstButton.RemoveAll();
switch (MB_TYPEMASK & m_uType)
{
case MB_OK:
AddButton(BkString::Get(IDS_MSGBOX_OK), IDOK);
break;
case MB_OKCANCEL:
AddButton(BkString::Get(IDS_MSGBOX_OK), IDOK);
AddButton(BkString::Get(IDS_MSGBOX_CANCEL), IDCANCEL);
break;
case MB_ABORTRETRYIGNORE:
AddButton(BkString::Get(IDS_MSGBOX_ABORT), IDABORT);
AddButton(BkString::Get(IDS_MSGBOX_RETRY), IDRETRY);
AddButton(BkString::Get(IDS_MSGBOX_IGNORE), IDIGNORE);
break;
case MB_YESNOCANCEL:
AddButton(BkString::Get(IDS_MSGBOX_YES), IDYES);
AddButton(BkString::Get(IDS_MSGBOX_NO), IDNO);
AddButton(BkString::Get(IDS_MSGBOX_CANCEL), IDCANCEL);
break;
case MB_YESNO:
AddButton(BkString::Get(IDS_MSGBOX_YES), IDYES);
AddButton(BkString::Get(IDS_MSGBOX_NO), IDNO);
break;
case MB_RETRYCANCEL:
AddButton(BkString::Get(IDS_MSGBOX_RETRY), IDRETRY);
AddButton(BkString::Get(IDS_MSGBOX_CANCEL), IDCANCEL);
break;
# if(WINVER >= 0x0500)
case MB_CANCELTRYCONTINUE:
AddButton(BkString::Get(IDS_MSGBOX_CANCEL), IDCANCEL);
AddButton(BkString::Get(IDS_MSGBOX_RETRY), IDRETRY);
AddButton(BkString::Get(IDS_MSGBOX_CONTINUE), IDCONTINUE);
break;
# endif /* WINVER >= 0x0500 */
}
}
示例6: AddCategory
void CGUIDialogAudioSubtitleSettings::InitializeSettings()
{
CGUIDialogSettingsManualBase::InitializeSettings();
CSettingCategory *category = AddCategory("audiosubtitlesettings", -1);
if (category == NULL)
{
CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
return;
}
// get all necessary setting groups
CSettingGroup *groupAudio = AddGroup(category);
if (groupAudio == NULL)
{
CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
return;
}
CSettingGroup *groupSubtitles = AddGroup(category);
if (groupSubtitles == NULL)
{
CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
return;
}
CSettingGroup *groupSaveAsDefault = AddGroup(category);
if (groupSaveAsDefault == NULL)
{
CLog::Log(LOGERROR, "CGUIDialogAudioSubtitleSettings: unable to setup settings");
return;
}
bool usePopup = g_SkinInfo->HasSkinFile("DialogSlider.xml");
CVideoSettings &videoSettings = CMediaSettings::GetInstance().GetCurrentVideoSettings();
if (g_application.m_pPlayer->HasPlayer())
{
g_application.m_pPlayer->GetAudioCapabilities(m_audioCaps);
g_application.m_pPlayer->GetSubtitleCapabilities(m_subCaps);
}
// register IsPlayingPassthrough condition
m_settingsManager->AddCondition("IsPlayingPassthrough", IsPlayingPassthrough);
CSettingDependency dependencyAudioOutputPassthroughDisabled(SettingDependencyTypeEnable, m_settingsManager);
dependencyAudioOutputPassthroughDisabled.Or()
->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition(SETTING_AUDIO_PASSTHROUGH, "false", SettingDependencyOperatorEquals, false, m_settingsManager)))
->Add(CSettingDependencyConditionPtr(new CSettingDependencyCondition("IsPlayingPassthrough", "", "", true, m_settingsManager)));
SettingDependencies depsAudioOutputPassthroughDisabled;
depsAudioOutputPassthroughDisabled.push_back(dependencyAudioOutputPassthroughDisabled);
m_dspEnabled = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_AUDIOOUTPUT_DSPADDONSENABLED);
// audio settings
// audio volume setting
m_volume = g_application.GetVolume(false);
CSettingNumber *settingAudioVolume = AddSlider(groupAudio, SETTING_AUDIO_VOLUME, 13376, 0, m_volume, 14054, VOLUME_MINIMUM, VOLUME_MAXIMUM / 100.0f, VOLUME_MAXIMUM);
settingAudioVolume->SetDependencies(depsAudioOutputPassthroughDisabled);
static_cast<CSettingControlSlider*>(settingAudioVolume->GetControl())->SetFormatter(SettingFormatterPercentAsDecibel);
if (m_dspEnabled)
AddButton(groupAudio, SETTING_AUDIO_DSP, 24136, 0);
// audio volume amplification setting
if (SupportsAudioFeature(IPC_AUD_AMP) && !m_dspEnabled)
{
CSettingNumber *settingAudioVolumeAmplification = AddSlider(groupAudio, SETTING_AUDIO_VOLUME_AMPLIFICATION, 660, 0, videoSettings.m_VolumeAmplification, 14054, VOLUME_DRC_MINIMUM * 0.01f, (VOLUME_DRC_MAXIMUM - VOLUME_DRC_MINIMUM) / 6000.0f, VOLUME_DRC_MAXIMUM * 0.01f);
settingAudioVolumeAmplification->SetDependencies(depsAudioOutputPassthroughDisabled);
}
// audio delay setting
if (SupportsAudioFeature(IPC_AUD_OFFSET) && !m_dspEnabled)
{
CSettingNumber *settingAudioDelay = AddSlider(groupAudio, SETTING_AUDIO_DELAY, 297, 0, videoSettings.m_AudioDelay, 0, -g_advancedSettings.m_videoAudioDelayRange, 0.025f, g_advancedSettings.m_videoAudioDelayRange, 297, usePopup);
static_cast<CSettingControlSlider*>(settingAudioDelay->GetControl())->SetFormatter(SettingFormatterDelay);
}
// audio stream setting
if (SupportsAudioFeature(IPC_AUD_SELECT_STREAM))
AddAudioStreams(groupAudio, SETTING_AUDIO_STREAM);
// audio output to all speakers setting
//! @todo remove this setting
if (SupportsAudioFeature(IPC_AUD_OUTPUT_STEREO) && !m_dspEnabled)
AddToggle(groupAudio, SETTING_AUDIO_OUTPUT_TO_ALL_SPEAKERS, 252, 0, videoSettings.m_OutputToAllSpeakers);
// audio digital/analog setting
if (SupportsAudioFeature(IPC_AUD_SELECT_OUTPUT))
{
m_passthrough = CServiceBroker::GetSettings().GetBool(CSettings::SETTING_AUDIOOUTPUT_PASSTHROUGH);
AddToggle(groupAudio, SETTING_AUDIO_PASSTHROUGH, 348, 0, m_passthrough);
}
// subtitle settings
m_subtitleVisible = g_application.m_pPlayer->GetSubtitleVisible();
// subtitle enabled setting
AddToggle(groupSubtitles, SETTING_SUBTITLE_ENABLE, 13397, 0, m_subtitleVisible);
// subtitle delay setting
if (SupportsSubtitleFeature(IPC_SUBS_OFFSET))
//.........這裏部分代碼省略.........
示例7: AddButton
MultiButton::SubButton& DropGrid::AddEdit(const Callback &cb)
{
return AddButton(BTN_RIGHT, cb);
}
示例8: Panel
TutorialReminder::TutorialReminder()
: Panel("TutorialReminder", (GameControl::Get()->Width() - (WIDTH_REMINDER - 85))/2,
(GameControl::Get()->Height() - HEIGHT_REMINDER)/2,
WIDTH_REMINDER, HEIGHT_REMINDER)
{
SetModal();
bAlreadyShow = true;
chdir((GameControl::getEditorPath() + DIR_SEP + "Tutorials" + DIR_SEP + "Getting Started").c_str());
Text *text;
Button *button;
int y;
//Title
text = AddText("Welcome", CENTER_TEXT, 5);
y = DrawHLine(text->Down() + 2);
//Body
text = AddText("Thank you for choosing Game Editor\nFor a quick start, select a option below:", 30, y);
//Create a new game
y = DrawHLine(text->Down() + 10);
text = AddText("Create a new game:", 30, y);
button = AddButton("Create now", 58, text->Down() + 10, 0, 0, BT_NEWGAME);
//Demos
y = DrawHLine(button->Down() + 5);
text = AddText("Get game demos:", 30, y);
button = AddButton("Go to demo page", 58, text->Down() + 10, 0, 0, BT_DEMOS);
//Tutorials
y = DrawHLine(button->Down() + 5);
text = AddText("See the tutorials:", 30, y);
listTutorialDir = AddListDirectory(10, text->Down() + 10, 0, 0, LS_TUTORIAL, " Click here for the tutorials ");
listTutorialDir->setCanUseSystemFileDialog(false);
#if defined(WIN32) && !defined(GAME_EDITOR_HOME_EDITION)
button = AddButton("Get the newest tutorials", 58, listTutorialDir->Down() + 5, 0, 0, BT_UPDATE);
text = AddText("For more tutorials, select from Help Menu above", text->Left(), button->Down() + 5);
#else
text = AddText("For more tutorials, select from Help Menu above", text->Left(), listTutorialDir->Down() + 25);
#endif
listTutorialDir->SetPos((WIDTH_REMINDER - listTutorialDir->Width())/2, listTutorialDir->getImage()->Y());
listTutorialDir->AddFilter("gedt");
listTutorialDir->setShowDir(false);
listTutorialDir->setShowExtension(false);
//Help
y = DrawHLine(text->Down() + 5);
text = AddText("Get help:", 30, y);
button = AddButton("Read the documentation", 58, text->Down() + 10, 0, 0, BT_DOCS);
button = AddButton("Go to Game Editor's forum", 58, button->Down() + 5, 0, 0, BT_FORUM);
//Close
y = DrawHLine(button->Down() + 5);
button = AddButton("Close", (WIDTH_REMINDER-135)/2 - 30, y, 0, 0, BT_CLOSE);
button = AddButton(" Don't show again ", button->Right() + 10, y, 0, 0, BT_DONTSHOW);
//Logo
{
EditorDirectory dir;
logo = new Actor("ged_TutorialReminder_logo", this);
logo->AddAnimation("logo", "logo.png", 1, 1, 0, 0);
logo->SetPos(-logo->Width(), 0);
}
}
示例9: wxCHECK
bool wxTreeMultiXmlMapper::DoCreateControls(TiXmlElement *cat, wxTreeMultiItem &pitem, wxWindow *pwnd, wxSizer *szr)
{
bool allOk = true;
wxCHECK(cat, false);
wxString value;
wxWindow *wnd = 0;
// go through all siblings of this
TiXmlNode *node = cat->FirstChild();
while(node && allOk)
{
// cast to element. When it is an element, work this
TiXmlElement *el = node->ToElement();
if(el)
{
value = el->Value();
// when we are dealing with a <row> element, we introduce a wxBoxSizer + panel
// to add more on one row
if(value.IsSameAs(XMLMAP_TAG_ROW, false))
{
// we are in a row. All elements inside need to be parent
// of this element, and we use a sizer to layout
wxPanel *pnl = new wxPanel((pwnd != 0 ? pwnd : m_ctrl), -1);
wxBoxSizer *bsz = new wxBoxSizer(wxHORIZONTAL);
allOk = DoCreateControls(el, pitem, pnl, bsz);
if(allOk)
{
// ok now we have all added elements, set the sizer and
// add the item when we have no parent control nomore
pnl->SetSizerAndFit(bsz);
if(pwnd == 0)
{
// add the window
m_ctrl->AppendWindow(pitem, pnl);
}
}
else
delete bsz;
}
else if(value.IsSameAs(XMLMAP_TAG_CATEGORY, false)) // is it an <category> element?
{
if(!pwnd)
{
// only allow when we have no parent window
wxTreeMultiItem item = AddCategory(el, pitem);
allOk = DoCreateControls(el, item, 0, 0);
}
else
{
// we do not allow a category inside another window!
// so we report this as an error
wxLogError(_("Cannot have a <" XMLMAP_TAG_CATEGORY "> inside <" XMLMAP_TAG_ROW "> tags!"));
allOk = false;
}
}
else if(value.IsSameAs(XMLMAP_TAG_CHECKBOX, false))
// is it a <checkbox> element?
wnd = AddCheckBox(el, (pwnd != 0 ? pwnd : m_ctrl));
else if(value.IsSameAs(XMLMAP_TAG_BUTTON, false))
// is it a <button> element?
wnd = AddButton(el, (pwnd != 0 ? pwnd : m_ctrl));
else
// we encountered a strange element, just ignore
allOk = true;
// if we have a window to add, do this.
if(wnd)
{
// add to sizer when there is one, else
// do not add but trust the parent will be added
if(szr)
szr->Add(wnd, 0, wxALIGN_CENTER_VERTICAL);
else
m_ctrl->AppendWindow(pitem, wnd);
allOk = (wnd != 0);
wnd = 0;
}
}
// get next sibling on this level
if(allOk)
node = node->NextSibling();
}
return allOk;
}
示例10: SetText
bool TBMessageWindow::Show(const char *title, const char *message, TBMessageWindowSettings *settings)
{
TBWidget *target = m_target.Get();
if (!target)
return false;
TBMessageWindowSettings default_settings;
if (!settings)
settings = &default_settings;
TBWidget *root = target->GetParentRoot();
const char *source = "TBLayout: axis: y, distribution: available\n"
" TBLayout: distribution: available, size: available\n"
" TBSkinImage: id: 2\n"
" TBEditField: multiline: 1, readonly: 1, id: 1\n"
" TBLayout: distribution-position: right bottom, id: 3\n";
if (!g_widgets_reader->LoadData(GetContentRoot(), source))
return false;
SetText(title);
GetWidgetByIDAndType<TBSkinImage>(2)->SetSkinBg(settings->icon_skin);
TBEditField *editfield = GetWidgetByIDAndType<TBEditField>(1);
editfield->SetStyling(settings->styling);
editfield->SetText(message);
editfield->SetSkinBg("");
// Create buttons
if (settings->msg == TB_MSG_OK)
{
AddButton("TBMessageWindow.ok", true);
}
else if (settings->msg == TB_MSG_OK_CANCEL)
{
AddButton("TBMessageWindow.ok", true);
AddButton("TBMessageWindow.cancel", false);
}
else if (settings->msg == TB_MSG_YES_NO)
{
AddButton("TBMessageWindow.yes", true);
AddButton("TBMessageWindow.no", false);
}
// Size to fit content. This will use the default size of the textfield.
ResizeToFitContent();
TBRect rect = GetRect();
// Get how much we overflow the textfield has given the current width, and grow our height to show all we can.
// FIX: It would be better to use adapt-to-content on the editfield to achieve the most optimal size.
// At least when we do full blown multi pass size checking.
rect.h += editfield->GetStyleEdit()->GetOverflowY();
// Create background dimmer
if (settings->dimmer)
{
if (TBDimmer *dimmer = new TBDimmer)
{
root->AddChild(dimmer);
m_dimmer.Set(dimmer);
}
}
// Center and size to the new height
TBRect bounds(0, 0, root->GetRect().w, root->GetRect().h);
SetRect(rect.CenterIn(bounds).MoveIn(bounds).Clip(bounds));
root->AddChild(this);
return true;
}
示例11: create_SkinBrowser
GtkWidget * create_SkinBrowser( void )
{
GtkWidget * vbox5;
GtkWidget * scrolledwindow1;
GtkWidget * hbuttonbox4;
GtkWidget * Cancel;
GtkWidget * Ok;
GtkAccelGroup * accel_group;
accel_group = gtk_accel_group_new ();
SkinBrowser=gtk_window_new( GTK_WINDOW_TOPLEVEL );
gtk_widget_set_name( SkinBrowser,MSGTR_SkinBrowser );
gtk_object_set_data( GTK_OBJECT( SkinBrowser ),MSGTR_SkinBrowser,SkinBrowser );
gtk_widget_set_usize( SkinBrowser,256,320 );
gtk_container_set_border_width( GTK_CONTAINER( SkinBrowser ),1 );
GTK_WIDGET_SET_FLAGS( SkinBrowser,GTK_CAN_DEFAULT );
gtk_widget_set_events( SkinBrowser,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
gtk_window_set_title( GTK_WINDOW( SkinBrowser ),MSGTR_SkinBrowser );
gtk_window_set_position( GTK_WINDOW( SkinBrowser ),GTK_WIN_POS_CENTER );
gtk_window_set_policy( GTK_WINDOW( SkinBrowser ),FALSE,FALSE,TRUE );
gtk_window_set_wmclass( GTK_WINDOW( SkinBrowser ),"SkinBrowser","MPlayer" );
gtk_widget_realize( SkinBrowser );
gtkAddIcon( SkinBrowser );
vbox5=AddVBox( AddDialogFrame( SkinBrowser ),0 );
AddLabel( MSGTR_SKIN_LABEL,vbox5 );
AddHSeparator( vbox5 );
scrolledwindow1=gtk_scrolled_window_new( NULL,NULL );
gtk_widget_set_name( scrolledwindow1,"scrolledwindow1" );
gtk_widget_ref( scrolledwindow1 );
gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"scrolledwindow1",scrolledwindow1,(GtkDestroyNotify)gtk_widget_unref );
gtk_widget_show( scrolledwindow1 );
gtk_box_pack_start( GTK_BOX( vbox5 ),scrolledwindow1,TRUE,TRUE,0 );
gtk_container_set_border_width( GTK_CONTAINER( scrolledwindow1 ),2 );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolledwindow1 ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );
SkinList=gtk_clist_new( 1 );
gtk_widget_set_name( SkinList,"SkinList" );
gtk_widget_ref( SkinList );
gtk_object_set_data_full( GTK_OBJECT( SkinBrowser ),"SkinList",SkinList,(GtkDestroyNotify)gtk_widget_unref );
gtk_widget_show( SkinList );
gtk_container_add( GTK_CONTAINER( scrolledwindow1 ),SkinList );
gtk_clist_set_column_width( GTK_CLIST( SkinList ),0,80 );
gtk_clist_set_selection_mode( GTK_CLIST( SkinList ),GTK_SELECTION_SINGLE );
gtk_clist_column_titles_hide( GTK_CLIST( SkinList ) );
gtk_clist_set_shadow_type( GTK_CLIST( SkinList ),GTK_SHADOW_ETCHED_OUT );
AddHSeparator( vbox5 );
hbuttonbox4=AddHButtonBox( vbox5 );
gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox4 ),GTK_BUTTONBOX_SPREAD );
gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox4 ),10 );
Ok=AddButton( MSGTR_Ok,hbuttonbox4 );
Cancel=AddButton( MSGTR_Cancel,hbuttonbox4 );
gtk_widget_add_accelerator( Ok,"clicked",accel_group,GDK_Return,0,GTK_ACCEL_VISIBLE );
gtk_widget_add_accelerator( Cancel,"clicked",accel_group,GDK_Escape,0,GTK_ACCEL_VISIBLE );
gtk_signal_connect( GTK_OBJECT( SkinBrowser ),"destroy",GTK_SIGNAL_FUNC( WidgetDestroy ),&SkinBrowser );
gtk_signal_connect( GTK_OBJECT( SkinList ),"select_row",GTK_SIGNAL_FUNC( on_SkinList_select_row ),NULL );
gtk_signal_connect( GTK_OBJECT( Ok ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)1 );
gtk_signal_connect( GTK_OBJECT( Cancel ),"clicked",GTK_SIGNAL_FUNC( prButton ),(void *)0 );
if ( ( sbMPlayerDirInHome=calloc( 1,strlen( skinDirInHome ) + 4 ) ) != NULL )
{ strcpy( sbMPlayerDirInHome,skinDirInHome ); strcat( sbMPlayerDirInHome,"/*" ); }
if ( ( sbMPlayerPrefixDir=calloc( 1,strlen( skinMPlayerDir ) + 4 ) ) != NULL )
{ strcpy( sbMPlayerPrefixDir,skinMPlayerDir ); strcat( sbMPlayerPrefixDir,"/*" ); }
gtk_window_add_accel_group( GTK_WINDOW( SkinBrowser ),accel_group );
gtk_widget_grab_focus( SkinList );
return SkinBrowser;
}
示例12: Prepare
virtual void Prepare(ContainerWindow &parent,
const PixelRect &rc) override {
AddButton(_("Details"), *list, DETAILS);
AddButton(_("Close"), dialog, mrCancel);
}
示例13: BaseAction
ExpressionEditor::ExpressionEditor(Actor *actor, bool bOnCollision)
: BaseAction("Expression Editor", (GameControl::Get()->Width() - WIDTH)/2,
(GameControl::Get()->Height() - HEIGHT)/2,
WIDTH, HEIGHT)
{
expressionEditor = this;
SetModal();
SetToolTip(TIP_SCRIPTEDITOR);
eventActor = actionActor = actor;
this->bOnCollision = bOnCollision;
Text *text;
Button *button;
int y;
//Title: Script Editor: oi -> Key Down (left)
gedString title(EXPRESSION_EDITOR), actionDesc;
title += ": ";
actionDesc = actor->getActorName();
actionDesc += " -> ";
editAction = Action::getEditAction();
if(editAction)
{
actionDesc += Action::GetDescription(editAction, false);
MainPanel::AddLastScript(actionDesc);
}
else
{
stAction tmp;
tmp.eventData = Action::getActualEvent();
actionDesc += Action::GetDescription(&tmp, false);
}
title += actionDesc;
text = AddText(title, CENTER_TEXT, 5);
textLine = AddText("Ln 1 ", WIDTH-45, 5, ALIGN_LEFT);
y = DrawHLine(text->Down() + 2);
//Body
editExp = AddEditBox(10, y, WIDTH-34, HEIGHT-85, true);
listActor = AddListPop(10, editExp->Down()+4, 120, 0, LS_ACTOR, "actors"); listActor->SetToolTip(TIP_SCRIPTEDITOR_ACTORS);
listAutoComplete = AddListPop(listActor->Right(), listActor->Top(), 215, 0, LS_COMPLETE, "variables/functions"); listAutoComplete->SetToolTip(TIP_SCRIPTEDITOR_VARIABLES_FUNCTIONS);
button = AddButton("Variables", listAutoComplete->Right(), listAutoComplete->Top(), 0, 0, BT_CREATEVAR); button->SetToolTip(TIP_SCRIPTEDITOR_VARIABLES);
button = AddButton("Global code", button->Right(), button->Top(), 0, 0, BT_GLOBALS); button->SetToolTip(TIP_SCRIPTEDITOR_GLOBALCODE);
listFile = AddListPop(button->Right() + 2, button->Top(), 64, 0, LS_FILE, "File"); listFile->SetToolTip(TIP_SCRIPTEDITOR_FILE);
//button = AddButton("Web", listFile->Right() + 2, listFile->Top(), 35, 0, BT_WEB); button->SetToolTip(TIP_SCRIPTEDITOR_WEB);
//Close
y = DrawHLine(listAutoComplete->Down() + 2);
button = AddButton(Action::getEditAction()?"Ok":"Add", WIDTH/2 - 65, y, 0, 0, BT_ADD); button->SetToolTip(TIP_ACTION_ADD);
button = AddButton("Cancel", button->Right()+8, y, 0, 0, BT_CLOSE); button->SetToolTip(TIP_ACTION_CANCEL); //Don't exit on ESC (crash the editor)
//Populate actors
GameControl::Get()->PopulateActors(listActor);
if(bOnCollision) listActor->AddText("collide");
UpdateVars();
listFile->AddText("Save");
listFile->AddText("Load");
bDelimit = false;
editExp->SetSyntaxColorize(true);
editExp->ShowScrollBar();
pScript = NULL;
UpdateEdition();
if(!pScript) pScript = new Script();
}
示例14: AddHookSwitchDevice
/*****************************************************************************
** Procedure: CDSPhone::Init
**
** Arguments: 'pDev' - Device object this phone belongs to
** 'dwPhoneDeviceID' - Unique phone identifier within the TSP
** 'dwPos' - Index position of phone within device array
** 'dwItemData' - Used when line was dynamically created (P&P).
**
** Returns: void
**
** Description: This function is called by the device owner to initialize
** the phone object.
**
*****************************************************************************/
VOID CDSPhone::Init (CTSPIDevice* pDev, DWORD dwPhoneDeviceID, DWORD dwPos, DWORD /*dwItemData*/)
{
// Let the base class initialize first.
CTSPIPhoneConnection::Init (pDev, dwPhoneDeviceID, dwPos);
// Grab the settings from the emulator.
EMSETTINGS Settings;
if (!GetDeviceInfo()->DRV_GetSwitchSettings (&Settings))
return;
// Add the handset device to our hookswitch list.
AddHookSwitchDevice(PHONEHOOKSWITCHDEV_HANDSET, // Hookswitch device
(PHONEHOOKSWITCHMODE_ONHOOK | // Modes available to hookswitch
PHONEHOOKSWITCHMODE_MIC |
PHONEHOOKSWITCHMODE_SPEAKER |
PHONEHOOKSWITCHMODE_MICSPEAKER |
PHONEHOOKSWITCHMODE_UNKNOWN),
g_hsStates[Settings.wHandsetHookswitch], // States supported by hookswitch
Settings.wVolHandset, // Current Volume level of hookswitch (0-0xffff)
Settings.wGainHandset, // Current Gain level of hookswitch (0-0xffff)
0xffffffff, 0xffffffff, true, true); // Monitored/Set modes
// Setup the display buffer for the phone. It uses a standard line feed so don't
// change the default line break character.
SetupDisplay(DISPLAY_COLS, DISPLAY_ROWS);
// Add all the buttons to our phone.
for (int i = 0; i < BUTTON_COUNT; i++)
{
// If the button is one of our STANDARD buttons (0-9,A-D,#,*), then it is a keypad
// button.
if (i < TOTAL_STD_BUTTONS)
{
AddButton (PHONEBUTTONFUNCTION_NONE, // Button function
PHONEBUTTONMODE_KEYPAD, // Button mode
PHONELAMPMODE_DUMMY, // Available Lamp states (Dummy = None)
PHONELAMPMODE_DUMMY, // Current Lamp state (Dummy = None)
CString(g_szKeypad[i],1)); // Text name of button
}
// Otherwise the button is a "soft" button, the mode and function are determined
// by how the user sets up the emulator. The emulator reports the button functions
// through the EMSETTINGS structure.
else
{
// Determine the available lamp states based on the reported mode of the
// button from the emulator.
DWORD dwAvailLampStates = 0;
if (Settings.wButtonModes[i] == BUTTONFUNCTION_CALL)
dwAvailLampStates = (PHONELAMPMODE_OFF | PHONELAMPMODE_STEADY | PHONELAMPMODE_WINK | PHONELAMPMODE_FLASH);
else if (Settings.wLampStates[i] == LAMPSTATE_NONE)
dwAvailLampStates = PHONELAMPMODE_DUMMY;
else
dwAvailLampStates = (PHONELAMPMODE_OFF | PHONELAMPMODE_STEADY | PHONELAMPMODE_WINK);
// Add the button
AddButton (g_ButtonFunctions[Settings.wButtonModes[i]].dwFunction,
g_ButtonFunctions[Settings.wButtonModes[i]].dwMode,
dwAvailLampStates,
g_LampStates[Settings.wLampStates[i]],
g_ButtonFunctions[Settings.wButtonModes[i]].pszText);
}
}
// Setup the initial state of the display.
USES_CONVERSION;
SetDisplay (A2T(Settings.szDisplay));
// Setup the ringer modes
LPPHONECAPS pPhoneCaps = GetPhoneCaps();
LPPHONESTATUS pPhoneStatus = GetPhoneStatus();
pPhoneCaps->dwNumRingModes = 4;
pPhoneStatus->dwRingMode = (DWORD) Settings.wRingMode;
// Add the WAV devices which will be our handset I/O
if (waveInGetNumDevs() > 0)
AddDeviceClass(_T("wave/in"), (DWORD)0);
if (waveOutGetNumDevs() > 0)
AddDeviceClass(_T("wave/out"), (DWORD)0);
}// CDSPhone::Init
示例15: AddCategory
//.........這裏部分代碼省略.........
entries.push_back(std::make_pair(16317, VS_INTERLACEMETHOD_VDPAU_TEMPORAL_HALF));
entries.push_back(std::make_pair(16314, VS_INTERLACEMETHOD_VDPAU_INVERSE_TELECINE));
entries.push_back(std::make_pair(16325, VS_INTERLACEMETHOD_AUTO_ION));
entries.push_back(std::make_pair(16327, VS_INTERLACEMETHOD_VAAPI_BOB));
entries.push_back(std::make_pair(16328, VS_INTERLACEMETHOD_VAAPI_MADI));
entries.push_back(std::make_pair(16329, VS_INTERLACEMETHOD_VAAPI_MACI));
entries.push_back(std::make_pair(16330, VS_INTERLACEMETHOD_MMAL_ADVANCED));
entries.push_back(std::make_pair(16331, VS_INTERLACEMETHOD_MMAL_ADVANCED_HALF));
entries.push_back(std::make_pair(16332, VS_INTERLACEMETHOD_MMAL_BOB));
entries.push_back(std::make_pair(16333, VS_INTERLACEMETHOD_MMAL_BOB_HALF));
entries.push_back(std::make_pair(16334, VS_INTERLACEMETHOD_IMX_FASTMOTION));
entries.push_back(std::make_pair(16335, VS_INTERLACEMETHOD_IMX_FASTMOTION_DOUBLE));
/* remove unsupported methods */
for (StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
{
if (g_application.m_pPlayer->Supports((EINTERLACEMETHOD)it->second))
++it;
else
it = entries.erase(it);
}
if (!entries.empty())
{
AddSpinner(groupVideo, SETTING_VIDEO_INTERLACEMETHOD, 16038, 0, static_cast<int>(videoSettings.m_InterlaceMethod), entries);
}
entries.clear();
entries.push_back(std::make_pair(16301, VS_SCALINGMETHOD_NEAREST));
entries.push_back(std::make_pair(16302, VS_SCALINGMETHOD_LINEAR));
entries.push_back(std::make_pair(16303, VS_SCALINGMETHOD_CUBIC ));
entries.push_back(std::make_pair(16304, VS_SCALINGMETHOD_LANCZOS2));
entries.push_back(std::make_pair(16323, VS_SCALINGMETHOD_SPLINE36_FAST));
entries.push_back(std::make_pair(16315, VS_SCALINGMETHOD_LANCZOS3_FAST));
entries.push_back(std::make_pair(16322, VS_SCALINGMETHOD_SPLINE36));
entries.push_back(std::make_pair(16305, VS_SCALINGMETHOD_LANCZOS3));
entries.push_back(std::make_pair(16306, VS_SCALINGMETHOD_SINC8));
// entries.push_back(make_pair(?????, VS_SCALINGMETHOD_NEDI));
entries.push_back(std::make_pair(16307, VS_SCALINGMETHOD_BICUBIC_SOFTWARE));
entries.push_back(std::make_pair(16308, VS_SCALINGMETHOD_LANCZOS_SOFTWARE));
entries.push_back(std::make_pair(16309, VS_SCALINGMETHOD_SINC_SOFTWARE));
entries.push_back(std::make_pair(13120, VS_SCALINGMETHOD_VDPAU_HARDWARE));
entries.push_back(std::make_pair(16319, VS_SCALINGMETHOD_DXVA_HARDWARE));
entries.push_back(std::make_pair(16316, VS_SCALINGMETHOD_AUTO));
/* remove unsupported methods */
for(StaticIntegerSettingOptions::iterator it = entries.begin(); it != entries.end(); )
{
if (g_application.m_pPlayer->Supports((ESCALINGMETHOD)it->second))
++it;
else
it = entries.erase(it);
}
AddSpinner(groupVideo, SETTING_VIDEO_SCALINGMETHOD, 16300, 0, static_cast<int>(videoSettings.m_ScalingMethod), entries);
#ifdef HAS_VIDEO_PLAYBACK
AddVideoStreams(groupVideoStream, SETTING_VIDEO_STREAM);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_STRETCH) || g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO))
{
entries.clear();
for (int i = 0; i < 7; ++i)
entries.push_back(std::make_pair(630 + i, i));
AddSpinner(groupVideo, SETTING_VIDEO_VIEW_MODE, 629, 0, videoSettings.m_ViewMode, entries);
}
if (g_application.m_pPlayer->Supports(RENDERFEATURE_ZOOM))
AddSlider(groupVideo, SETTING_VIDEO_ZOOM, 216, 0, videoSettings.m_CustomZoomAmount, "%2.2f", 0.5f, 0.01f, 2.0f, 216, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_VERTICAL_SHIFT))
AddSlider(groupVideo, SETTING_VIDEO_VERTICAL_SHIFT, 225, 0, videoSettings.m_CustomVerticalShift, "%2.2f", -2.0f, 0.01f, 2.0f, 225, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_PIXEL_RATIO))
AddSlider(groupVideo, SETTING_VIDEO_PIXEL_RATIO, 217, 0, videoSettings.m_CustomPixelRatio, "%2.2f", 0.5f, 0.01f, 2.0f, 217, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_POSTPROCESS))
AddToggle(groupVideo, SETTING_VIDEO_POSTPROCESS, 16400, 0, videoSettings.m_PostProcess);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_BRIGHTNESS))
AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_BRIGHTNESS, 464, 0, static_cast<int>(videoSettings.m_Brightness), 14047, 1, 464, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_CONTRAST))
AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_CONTRAST, 465, 0, static_cast<int>(videoSettings.m_Contrast), 14047, 1, 465, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_GAMMA))
AddPercentageSlider(groupVideoPlayback, SETTING_VIDEO_GAMMA, 466, 0, static_cast<int>(videoSettings.m_Gamma), 14047, 1, 466, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_NOISE))
AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_NOISE, 16312, 0, videoSettings.m_NoiseReduction, "%2.2f", 0.0f, 0.01f, 1.0f, 16312, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_SHARPNESS))
AddSlider(groupVideoPlayback, SETTING_VIDEO_VDPAU_SHARPNESS, 16313, 0, videoSettings.m_Sharpness, "%2.2f", -1.0f, 0.02f, 1.0f, 16313, usePopup);
if (g_application.m_pPlayer->Supports(RENDERFEATURE_NONLINSTRETCH))
AddToggle(groupVideoPlayback, SETTING_VIDEO_NONLIN_STRETCH, 659, 0, videoSettings.m_CustomNonLinStretch);
#endif
// stereoscopic settings
entries.clear();
entries.push_back(std::make_pair(16316, RENDER_STEREO_MODE_OFF));
entries.push_back(std::make_pair(36503, RENDER_STEREO_MODE_SPLIT_HORIZONTAL));
entries.push_back(std::make_pair(36504, RENDER_STEREO_MODE_SPLIT_VERTICAL));
AddSpinner(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICMODE , 36535, 0, videoSettings.m_StereoMode, entries);
AddToggle(groupStereoscopic, SETTING_VIDEO_STEREOSCOPICINVERT, 36536, 0, videoSettings.m_StereoInvert);
// general settings
AddButton(groupSaveAsDefault, SETTING_VIDEO_MAKE_DEFAULT, 12376, 0);
AddButton(groupSaveAsDefault, SETTING_VIDEO_CALIBRATION, 214, 0);
}