void *OpenURL(char *url) { DWORD c,r; g_static_mutex_lock(&lock); // make sure only 1 thread at a time can do the following r=++req; // increment the request counter for this request g_static_mutex_unlock(&lock); if (prebuftimer) { g_source_remove(prebuftimer); // stop prebuffer monitoring prebuftimer=0; } BASS_StreamFree(chan); // close old stream gdk_threads_enter(); gtk_label_set_text(GTK_LABEL(GetWidget("status1")),""); gtk_label_set_text(GTK_LABEL(GetWidget("status2")),"connecting..."); gtk_label_set_text(GTK_LABEL(GetWidget("status3")),""); gdk_threads_leave(); c=BASS_StreamCreateURL(url,0,BASS_STREAM_BLOCK|BASS_STREAM_STATUS|BASS_STREAM_AUTOFREE,StatusProc,0); free(url); // free temp URL buffer g_static_mutex_lock(&lock); if (r!=req) { // there is a newer request, discard this stream g_static_mutex_unlock(&lock); if (c) BASS_StreamFree(c); return NULL; } chan=c; // this is now the current stream g_static_mutex_unlock(&lock); if (!chan) { gdk_threads_enter(); gtk_label_set_text(GTK_LABEL(GetWidget("status2")),"not playing"); Error("Can't play the stream"); gdk_threads_leave(); } else prebuftimer=g_timeout_add(50,PrebufTimerProc,NULL); // start prebuffer monitoring return NULL; }
void CFWL_ComboBox::EditModifyStylesEx(uint32_t dwStylesExAdded, uint32_t dwStylesExRemoved) { if (GetWidget()) { ToComboBox(GetWidget()) ->EditModifyStylesEx(dwStylesExAdded, dwStylesExRemoved); } }
void SwapClicked(GtkButton *obj, gpointer data) { const gchar *objname=gtk_widget_get_name(GTK_WIDGET(obj)); int speaker=atoi(objname+4)-1; // get speaker pair number from button name ("swapX") { // swap handles HSTREAM temp=chan[speaker]; chan[speaker]=chan[speaker+1]; chan[speaker+1]=temp; } { // swap text GtkButton *open1,*open2; char bname[10],*temp; sprintf(bname,"open%d",1+speaker); open1=GTK_BUTTON(GetWidget(bname)); sprintf(bname,"open%d",1+speaker+1); open2=GTK_BUTTON(GetWidget(bname)); temp=strdup(gtk_button_get_label(open1)); gtk_button_set_label(open1,gtk_button_get_label(open2)); gtk_button_set_label(open2,temp); free(temp); } // update the channel devices BASS_ChannelFlags(chan[speaker],flags[speaker],BASS_SPEAKER_FRONT); BASS_ChannelFlags(chan[speaker+1],flags[speaker+1],BASS_SPEAKER_FRONT); }
void DialogClientView::PaintSizeBox(gfx::Canvas* canvas) { if(GetWidget()->widget_delegate()->CanResize() || GetWidget()->widget_delegate()->CanMaximize()) { gfx::NativeTheme::ExtraParams extra; gfx::Size gripper_size = gfx::NativeTheme::instance()->GetPartSize( gfx::NativeTheme::kWindowResizeGripper, gfx::NativeTheme::kNormal, extra); // TODO(beng): (http://b/1085509) In "classic" rendering mode, there isn't // a theme-supplied gripper. We should probably improvise // something, which would also require changing |gripper_size| // to have different default values, too... size_box_bounds_ = GetContentsBounds(); size_box_bounds_.set_x(size_box_bounds_.right() - gripper_size.width()); size_box_bounds_.set_y(size_box_bounds_.bottom() - gripper_size.height()); gfx::NativeTheme::instance()->Paint(canvas->AsCanvasSkia(), gfx::NativeTheme::kWindowResizeGripper, gfx::NativeTheme::kNormal, size_box_bounds_, extra); } }
gboolean PrebufTimerProc(gpointer data) { // monitor prebuffering progress DWORD progress=BASS_StreamGetFilePosition(chan,BASS_FILEPOS_BUFFER) *100/BASS_StreamGetFilePosition(chan,BASS_FILEPOS_END); // percentage of buffer filled if (progress>75 || !BASS_StreamGetFilePosition(chan,BASS_FILEPOS_CONNECTED)) { // over 75% full (or end of download) { // get the broadcast name and URL const char *icy=BASS_ChannelGetTags(chan,BASS_TAG_ICY); if (!icy) icy=BASS_ChannelGetTags(chan,BASS_TAG_HTTP); // no ICY tags, try HTTP if (icy) { for (;*icy;icy+=strlen(icy)+1) { if (!strncasecmp(icy,"icy-name:",9)) gtk_label_set_text_8859(GTK_LABEL(GetWidget("status2")),icy+9); if (!strncasecmp(icy,"icy-url:",8)) gtk_label_set_text_8859(GTK_LABEL(GetWidget("status3")),icy+8); } } else gtk_label_set_text(GTK_LABEL(GetWidget("status2")),""); } // get the stream title and set sync for subsequent titles DoMeta(); BASS_ChannelSetSync(chan,BASS_SYNC_META,0,&MetaSync,0); // Shoutcast BASS_ChannelSetSync(chan,BASS_SYNC_OGG_CHANGE,0,&MetaSync,0); // Icecast/OGG // set sync for end of stream BASS_ChannelSetSync(chan,BASS_SYNC_END,0,&EndSync,0); // play it! BASS_ChannelPlay(chan,FALSE); return FALSE; // stop monitoring } else { char text[20]; sprintf(text,"buffering... %d%%",progress); gtk_label_set_text(GTK_LABEL(GetWidget("status2")),text); return TRUE; // continue monitoring } }
void OpenClicked(GtkButton *obj, gpointer data) { int resp=gtk_dialog_run(GTK_DIALOG(filesel)); gtk_widget_hide(filesel); if (resp==GTK_RESPONSE_ACCEPT) { char *file=gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filesel)); // free both MOD and stream, it must be one of them! :) BASS_MusicFree(chan); BASS_StreamFree(chan); if (!(chan=BASS_StreamCreateFile(FALSE,file,0,0,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT)) && !(chan=BASS_MusicLoad(FALSE,file,0,0,BASS_MUSIC_RAMPS|BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT,1))) { // whatever it is, it ain't playable gtk_button_set_label(obj,"click here to open a file..."); Error("Can't play the file"); } else { BASS_CHANNELINFO info; BASS_ChannelGetInfo(chan,&info); if (info.chans!=2) { // the DSP expects stereo gtk_button_set_label(obj,"click here to open a file..."); BASS_MusicFree(chan); BASS_StreamFree(chan); Error("only stereo sources are supported"); } else { gtk_button_set_label(obj,file); // setup DSPs on new channel and play it RotateToggled(GTK_TOGGLE_BUTTON(GetWidget("rotate")),0); EchoToggled(GTK_TOGGLE_BUTTON(GetWidget("echo")),0); FlangerToggled(GTK_TOGGLE_BUTTON(GetWidget("flanger")),0); BASS_ChannelPlay(chan,FALSE); } } g_free(file); } }
void SurfaceDlg::ShowDlg(){ Dialog::ShowDlg(); if ( GetWidget() == NULL ) { Create(); } g_surfwin = GetWidget(); }
void OpPersonalbar::OnTreeChanged(OpTreeModel* tree_model) { if( tree_model == g_hotlist_manager->GetBookmarksModel() ) { for( INT32 i=GetWidgetCount()-1; i>=0; i-- ) { OpWidget* widget = GetWidget(i); if( widget && widget->GetType() != WIDGET_TYPE_SEARCH_EDIT ) { RemoveWidget(i); } } } #ifdef DESKTOP_UTIL_SEARCH_ENGINES else if( tree_model == g_searchEngineManager ) { for( INT32 i=GetWidgetCount()-1; i>=0; i-- ) { OpWidget* widget = GetWidget(i); if( widget && widget->GetType() == WIDGET_TYPE_SEARCH_EDIT ) { RemoveWidget(i); } } } #endif // DESKTOP_UTIL_SEARCH_ENGINES for (INT32 i = 0; i < tree_model->GetItemCount(); i++) { AddItem(tree_model, i, TRUE); } }
void DialogClientView::PaintChildren(gfx::Canvas* canvas) { View::PaintChildren(canvas); if(!GetWidget()->IsMaximized() && !GetWidget()->IsMinimized()) { PaintSizeBox(canvas); } }
void CALLBACK EndSync(HSYNC handle, DWORD channel, DWORD data, void *user) { gdk_threads_enter(); gtk_label_set_text(GTK_LABEL(GetWidget("status1")),""); gtk_label_set_text(GTK_LABEL(GetWidget("status2")),"not playing"); gtk_label_set_text(GTK_LABEL(GetWidget("status3")),""); gdk_threads_leave(); }
Layout* LayoutItem::ParentLayout() const { if(GetWidget()) { return GetWidget()->ParentLayout(); } else if(GetLayout()) { GetLayout()->ParentLayout(); } return nullptr; }
// Overridden from AxHostDelegate: HWND FlashView::GetAxHostWindow() const { if(!GetWidget()) { return NULL; } return GetWidget()->GetNativeView(); }
void PuttyView::OnFocus() { ::SetFocus(puttyController_->getNativePage()); if(GetWidget()) { GetWidget()->NotifyAccessibilityEvent( this, ui::AccessibilityTypes::EVENT_FOCUS, false); } }
// Overridden from AxHostDelegate: HWND SilverlightView::GetAxHostWindow() const { if(!GetWidget()) { return NULL; } return GetWidget()->GetNativeView(); }
// Overridden from AxHostDelegate: HWND MediaPlayerView::GetAxHostWindow() const { if(!GetWidget()) { return NULL; } return GetWidget()->GetNativeView(); }
// Overridden from AxHostDelegate: HWND WebBrowserView::GetAxHostWindow() const { if(!GetWidget()) { return NULL; } return GetWidget()->GetNativeView(); }
void CConsoleForm::OnPostLayoutLoad( void ) {GUCE_TRACE; CFormEx::OnPostLayoutLoad(); m_inputEditbox = static_cast< GUCEF::GUI::CEditbox* >( GetWidget( "InputEditbox" ) ); m_consoleTextbox = static_cast< GUCEF::GUI::CTextbox* >( GetWidget( "ConsoleTextbox" ) ); }
bool LayoutItem::IsEmpty() const { if(GetWidget() && GetWidget()->IsVisible()) { return false; } else if(GetLayout() && !GetLayout()->IsEmpty()) { return false; } else if(GetLayoutSpace()) { return false; } return true; }
// Create menubar bool wxMenuBar::CreateMenuBar(wxFrame* parent) { m_parent = parent; // bleach... override it! PreCreation(); m_parent = NULL; if (m_mainWidget) { XtVaSetValues((Widget) parent->GetMainWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL); /* if (!XtIsManaged((Widget) m_mainWidget)) XtManageChild((Widget) m_mainWidget); */ XtMapWidget((Widget) m_mainWidget); return true; } Widget menuBarW = XmCreateMenuBar ((Widget) parent->GetMainWidget(), wxMOTIF_STR("MenuBar"), NULL, 0); m_mainWidget = (WXWidget) menuBarW; size_t menuCount = GetMenuCount(); for (size_t i = 0; i < menuCount; i++) { wxMenu *menu = GetMenu(i); wxString title(m_titles[i]); menu->SetButtonWidget(menu->CreateMenu (this, menuBarW, menu, i, title, true)); if (strcmp (wxStripMenuCodes(title), "Help") == 0) XtVaSetValues ((Widget) menuBarW, XmNmenuHelpWidget, (Widget) menu->GetButtonWidget(), NULL); // tear off menu support #if (XmVersion >= 1002) if ( menu->IsTearOff() ) { XtVaSetValues(GetWidget(menu), XmNtearOffModel, XmTEAR_OFF_ENABLED, NULL); Widget tearOff = XmGetTearOffControl(GetWidget(menu)); wxDoChangeForegroundColour((Widget) tearOff, m_foregroundColour); wxDoChangeBackgroundColour((Widget) tearOff, m_backgroundColour, true); } #endif } PostCreation(); XtVaSetValues((Widget) parent->GetMainWidget(), XmNmenuBar, (Widget) m_mainWidget, NULL); XtRealizeWidget ((Widget) menuBarW); XtManageChild ((Widget) menuBarW); SetMenuBarFrame(parent); return true; }
nsresult nsIMEStateManager::OnChangeFocus(nsPresContext* aPresContext, nsIContent* aContent) { NS_ENSURE_ARG_POINTER(aPresContext); nsCOMPtr<nsIWidget> widget = GetWidget(aPresContext); if (!widget) { return NS_OK; } PRUint32 newState = GetNewIMEState(aPresContext, aContent); if (aPresContext == sPresContext && aContent == sContent) { // actual focus isn't changing, but if IME enabled state is changing, // we should do it. PRUint32 newEnabledState = newState & nsIContent::IME_STATUS_MASK_ENABLED; if (newEnabledState == 0) { // the enabled state isn't changing, we should do nothing. return NS_OK; } PRUint32 enabled; if (NS_FAILED(widget->GetIMEEnabled(&enabled))) { // this platform doesn't support IME controlling return NS_OK; } if (enabled == nsContentUtils::GetWidgetStatusFromIMEStatus(newEnabledState)) { // the enabled state isn't changing. return NS_OK; } } // Current IME transaction should commit if (sPresContext) { nsCOMPtr<nsIWidget> oldWidget; if (sPresContext == aPresContext) oldWidget = widget; else oldWidget = GetWidget(sPresContext); if (oldWidget) oldWidget->ResetInputState(); } if (newState != nsIContent::IME_STATUS_NONE) { // Update IME state for new focus widget SetIMEState(newState, widget); } sPresContext = aPresContext; sContent = aContent; return NS_OK; }
void Listbox::SelectionChanged() { if(listener_) { listener_->SelectionChanged(this); } if(GetWidget()) { GetWidget()->NotifyAccessibilityEvent(this, ui::AccessibilityTypes::EVENT_SELECTION_CHANGED, false); } }
//------------------------------------------------------------ void EditableTextUIComponent::OnInit() noexcept { m_textEntrySystem = ChilliSource::Application::Get()->GetSystem<ChilliSource::TextEntry>(); CS_ASSERT(m_textEntrySystem, "No active text entry system found."); m_textEntrySystem->SetTextBuffer(m_initialText); m_textComponent = GetWidget()->GetComponent<TextUIComponent>(); CS_ASSERT(m_textComponent, "No text component found in editable text widget."); m_textComponent->SetText(m_initialText); m_releasedInsideConnection = GetWidget()->GetReleasedInsideEvent().OpenConnection(MakeDelegate(this, &EditableTextUIComponent::OnReleasedInside)); m_releasedOutsideConnection = GetWidget()->GetReleasedOutsideEvent().OpenConnection(MakeDelegate(this, &EditableTextUIComponent::OnReleasedOutside)); }
void PresetClicked(GtkButton *obj, gpointer data) { const char *url; const gchar *objname=gtk_widget_get_name(GTK_WIDGET(obj)); if (!strcmp(objname,"customopen")) { // play a custom URL url=gtk_entry_get_text(GTK_ENTRY(GetWidget("customurl"))); } else { // play a preset int preset=atoi(objname+6)-1; // get preset from button name ("presetX") url=urls[preset]; } strcpy(proxy,gtk_entry_get_text(GTK_ENTRY(GetWidget("proxyurl")))); // get proxy server // open URL in a new thread (so that main thread is free) g_thread_create(OpenURL,strdup(url),FALSE,NULL); }
bool ParamWidget::GetBool(const QString& name) { QCheckBox* checkbox = dynamic_cast<QCheckBox*>(GetWidget(name)); if (!checkbox) { throw std::invalid_argument("Invalid bool parameter " + name.toStdString()); } return checkbox->checkState() == Qt::Checked; }
QString ParamWidget::GetEnumString(const QString& name) { QComboBox* combobox = dynamic_cast<QComboBox*>(GetWidget(name)); if (!combobox) { throw std::invalid_argument("Invalid enum parameter " + name.toStdString()); } return combobox->currentText(); }
/* xRichGetSelectedText - built-in function 'get-selected-text' */ static xlValue xRichGetSelectedText(void) { DWORD start,end,length; xlValue obj,str; Widget *widget; /* parse the arguments */ obj = xlGetArgInstance(c_basicEditText); xlLastArg(); /* get the widget structure */ widget = GetWidget(obj); /* get the selection */ SendMessage(widget->wnd,EM_GETSEL,(WPARAM)&start,(LPARAM)&end); /* compute the text length */ if ((length = end - start) < 0) return xlNil; /* allocate a string and get the selection */ xlCPush(obj); str = xlNewString((xlFIXTYPE)length); SendMessage(widget->wnd,EM_GETSELTEXT,0,(LPARAM)xlGetString(str)); xlDrop(1); /* return the string */ return str; }
// We can have the same identifier in search and bookmarks/contacts model. That will // lead to confusion so we test for model as well. INT32 OpPersonalbar::FindItem(INT32 id, OpTreeModel* model_that_id_belongs_to) { for (INT32 i = 0; i < GetWidgetCount(); i++) { OpWidget* widget = GetWidget(i); if (id == widget->GetID()) { if( model_that_id_belongs_to ) { BOOL is_search_template = widget->GetType() == WIDGET_TYPE_SEARCH_EDIT; #ifdef DESKTOP_UTIL_SEARCH_ENGINES BOOL is_search_model = g_searchEngineManager == model_that_id_belongs_to; if( is_search_template != is_search_model ) { continue; } #endif // DESKTOP_UTIL_SEARCH_ENGINES } return i; } } return -1; }
inline void RowFormWidget::Row::UpdateLayout(ContainerWindow &parent, const PixelRect &_position, int caption_width) { assert(type != Type::DUMMY); position = _position; if (type == Type::WIDGET) { Widget &widget = GetWidget(); if (shown) widget.Move(position); } else { Window &window = GetWindow(); if (type == Type::EDIT && GetControl().HasCaption()) GetControl().SetCaptionWidth(caption_width); /* finally move and resize */ window.Move(position); } if (visible) Show(parent); }
void OpPersonalbar::Write() { for (INT32 i = 0; i < GetWidgetCount(); i++) { OpTreeModel* model = (OpTreeModel*) GetUserData(i); INT32 id = GetWidget(i)->GetID(); #ifdef DESKTOP_UTIL_SEARCH_ENGINES if (model != g_searchEngineManager) { #endif // DESKTOP_UTIL_SEARCH_ENGINES g_hotlist_manager->SetPersonalBarPosition(id, i, FALSE); #ifdef DESKTOP_UTIL_SEARCH_ENGINES } else { OpTreeModelItem* search; g_searchEngineManager->GetItemByID(id, search); if(search) { ((SearchTemplate*)search)->SetPersonalbarPos(i); } } #endif // DESKTOP_UTIL_SEARCH_ENGINES } #ifdef DESKTOP_UTIL_SEARCH_ENGINES g_searchEngineManager->Write(); #endif // DESKTOP_UTIL_SEARCH_ENGINES }
void AddClicked(GtkButton *obj, gpointer data) { // add a channel int resp=gtk_dialog_run(GTK_DIALOG(filesel)); gtk_widget_hide(filesel); if (resp==GTK_RESPONSE_ACCEPT) { char *file=gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(filesel)); DWORD newchan; // Load a music or sample from "file" if ((newchan=BASS_MusicLoad(FALSE,file,0,0,BASS_MUSIC_RAMP|BASS_SAMPLE_LOOP|BASS_SAMPLE_3D,1)) || (newchan=BASS_SampleLoad(FALSE,file,0,0,1,BASS_SAMPLE_LOOP|BASS_SAMPLE_3D|BASS_SAMPLE_MONO))) { Channel *c; chanc++; chans=(Channel*)realloc((void*)chans,chanc*sizeof(Channel)); c=chans+chanc-1; memset(c,0,sizeof(Channel)); c->channel=newchan; BASS_SampleGetChannel(newchan,FALSE); // initialize sample channel { // add it to the list GtkTreeView *tree=GTK_TREE_VIEW(GetWidget("channels")); GtkListStore *tm=GTK_LIST_STORE(gtk_tree_view_get_model(tree)); GtkTreeIter it; gtk_list_store_append(tm,&it); gtk_list_store_set(tm,&it,0,strrchr(file,'/')+1,-1); } } else Error("Can't load file (note samples must be mono)"); g_free(file); } }