コード例 #1
0
void AndroidCardboardController::Update() {
  UpdateOrientation();
  UpdateButtons();
}
コード例 #2
0
void CGUIDialogKeyboardGeneric::OnShift()
{
  m_bShift = !m_bShift;
  UpdateButtons();
}
コード例 #3
0
ファイル: BigTrafficWidget.cpp プロジェクト: StefanL74/XCSoar
void
TrafficWidget::ZoomOut()
{
  view->ZoomOut();
  UpdateButtons();
}
コード例 #4
0
ファイル: MACRODLG.CPP プロジェクト: jimmccurdy/ArchiveGit
void CSmartFieldsDialog::OnIdleUpdate(void)
{
	UpdateButtons();
}
コード例 #5
0
ファイル: studio.cpp プロジェクト: CyborgMaster/colobot
bool CStudio::EventProcess(const Event &event)
{
    CWindow*    pw;
    CEdit*      edit;
    CSlider*    slider;

    if ( m_dialog != SD_NULL )  // dialogue exists?
    {
        return EventDialog(event);
    }

    if ( event.type == EVENT_FRAME )
    {
        EventFrame(event);
    }

    pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
    if ( pw == nullptr )  return false;

    edit = static_cast<CEdit*>(pw->SearchControl(EVENT_STUDIO_EDIT));
    if ( edit == nullptr )  return false;

    if ( event.type == pw->GetEventTypeClose() )
    {
        m_event->AddEvent(Event(EVENT_STUDIO_OK));
    }

    if ( event.type == EVENT_STUDIO_EDIT )  // text modifief?
    {
        ColorizeScript(edit);
    }

    if ( event.type == EVENT_STUDIO_LIST )  // list clicked?
    {
        m_main->StartDisplayInfo(m_helpFilename, -1);
    }

    if ( event.type == EVENT_STUDIO_NEW )  // new?
    {
        m_script->New(edit, "");
    }

    if ( event.type == EVENT_STUDIO_OPEN )  // open?
    {
        StartDialog(SD_OPEN);
    }
    if ( event.type == EVENT_STUDIO_SAVE )  // save?
    {
        StartDialog(SD_SAVE);
    }

    if ( event.type == EVENT_STUDIO_UNDO )  // undo?
    {
        edit->Undo();
    }
    if ( event.type == EVENT_STUDIO_CUT )  // cut?
    {
        edit->Cut();
    }
    if ( event.type == EVENT_STUDIO_COPY )  // copy?
    {
        edit->Copy();
    }
    if ( event.type == EVENT_STUDIO_PASTE )  // paste?
    {
        edit->Paste();
    }

    if ( event.type == EVENT_STUDIO_SIZE )  // size?
    {
        slider = static_cast< CSlider* >(pw->SearchControl(EVENT_STUDIO_SIZE));
        if ( slider == nullptr )  return false;
        m_settings->SetFontSize(9.0f+slider->GetVisibleValue()*15.0f);
        ViewEditScript();
    }

    if ( event.type == EVENT_STUDIO_TOOL &&  // instructions?
         m_dialog == SD_NULL )
    {
        m_main->StartDisplayInfo(SATCOM_HUSTON, false);
    }
    if ( event.type == EVENT_STUDIO_HELP &&  // help?
         m_dialog == SD_NULL )
    {
        m_main->StartDisplayInfo(SATCOM_PROG, false);
    }

    if ( event.type == EVENT_STUDIO_COMPILE )  // compile?
    {
        if ( m_script->GetScript(edit) )  // compile
        {
            std::string res;
            GetResource(RES_TEXT, RT_STUDIO_COMPOK, res);
            SetInfoText(res, false);
        }
        else
        {
            std::string error;
            m_script->GetError(error);
            SetInfoText(error, false);
        }
    }

    if ( event.type == EVENT_STUDIO_RUN )  // run/stop?
    {
        if ( m_script->IsRunning() )
        {
            m_event->AddEvent(Event(EVENT_OBJECT_PROGSTOP));
        }
        else
        {
            if ( m_script->GetScript(edit) )  // compile
            {
                SetInfoText("", false);

                m_event->AddEvent(Event(EVENT_OBJECT_PROGSTART));
            }
            else
            {
                std::string error;
                m_script->GetError(error);
                SetInfoText(error, false);
            }
        }
    }

    if ( event.type == EVENT_STUDIO_REALTIME )  // real time?
    {
        m_bRealTime = !m_bRealTime;
        m_script->SetStepMode(!m_bRealTime);
        UpdateFlux();
        UpdateButtons();
    }

    if ( event.type == EVENT_STUDIO_STEP )  // step?
    {
        m_script->Step();
    }

    if ( event.type == EVENT_WINDOW3 )  // window is moved?
    {
        m_editActualPos = m_editFinalPos = pw->GetPos();
        m_editActualDim = m_editFinalDim = pw->GetDim();
        m_settings->SetWindowPos(m_editActualPos);
        m_settings->SetWindowDim(m_editActualDim);
        AdjustEditScript();
    }
    if ( event.type == pw->GetEventTypeReduce() )
    {
        if ( m_bEditMinimized )
        {
            m_editFinalPos = m_settings->GetWindowPos();
            m_editFinalDim = m_settings->GetWindowDim();
            m_bEditMinimized = false;
            m_bEditMaximized = false;
        }
        else
        {
            m_editFinalPos.x =  0.00f;
            m_editFinalPos.y = -0.44f;
            m_editFinalDim.x =  1.00f;
            m_editFinalDim.y =  0.50f;
            m_bEditMinimized = true;
            m_bEditMaximized = false;
        }
        m_main->SetEditFull(m_bEditMaximized);
        pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
        if ( pw != nullptr )
        {
            pw->SetMaximized(m_bEditMaximized);
            pw->SetMinimized(m_bEditMinimized);
        }
    }
    if ( event.type == pw->GetEventTypeFull() )
    {
        if ( m_bEditMaximized )
        {
            m_editFinalPos = m_settings->GetWindowPos();
            m_editFinalDim = m_settings->GetWindowDim();
            m_bEditMinimized = false;
            m_bEditMaximized = false;
        }
        else
        {
            m_editFinalPos.x = 0.00f;
            m_editFinalPos.y = 0.00f;
            m_editFinalDim.x = 1.00f;
            m_editFinalDim.y = 1.00f;
            m_bEditMinimized = false;
            m_bEditMaximized = true;
        }
        m_main->SetEditFull(m_bEditMaximized);
        pw = static_cast< CWindow* >(m_interface->SearchControl(EVENT_WINDOW3));
        if ( pw != nullptr )
        {
            pw->SetMaximized(m_bEditMaximized);
            pw->SetMinimized(m_bEditMinimized);
        }
    }

    return true;
}
コード例 #6
0
AISTargetListDialog::AISTargetListDialog( wxWindow *parent, wxAuiManager *auimgr,
        AIS_Decoder *pdecoder ) :
        wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize( 780, 250 ), wxBORDER_NONE )
{
    m_pparent = parent;
    m_pAuiManager = auimgr;
    m_pdecoder = pdecoder;

    SetMinSize( wxSize(400,240));

    s_p_sort_decoder = pdecoder;
    m_pMMSI_array = new ArrayOfMMSI( ArrayItemCompareMMSI );

    wxBoxSizer* topSizer = new wxBoxSizer( wxHORIZONTAL );
    SetSizer( topSizer );

    //  Parse the global column width string as read from config file
    wxStringTokenizer tkz( g_AisTargetList_column_spec, _T(";") );
    wxString s_width = tkz.GetNextToken();
    int width;
    long lwidth;

    m_pListCtrlAISTargets = new OCPNListCtrl( this, ID_AIS_TARGET_LIST, wxDefaultPosition,
            wxDefaultSize,
            wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_HRULES | wxLC_VRULES | wxBORDER_SUNKEN
                    | wxLC_VIRTUAL );
    wxImageList *imglist = new wxImageList( 16, 16, true, 2 );

    ocpnStyle::Style* style = g_StyleManager->GetCurrentStyle();
    imglist->Add( style->GetIcon( _T("sort_asc") ) );
    imglist->Add( style->GetIcon( _T("sort_desc") ) );

    m_pListCtrlAISTargets->AssignImageList( imglist, wxIMAGE_LIST_SMALL );
    m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_ITEM_SELECTED,
            wxListEventHandler( AISTargetListDialog::OnTargetSelected ), NULL, this );
    m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_ITEM_DESELECTED,
            wxListEventHandler( AISTargetListDialog::OnTargetSelected ), NULL, this );
    m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_ITEM_ACTIVATED,
            wxListEventHandler( AISTargetListDialog::OnTargetDefaultAction ), NULL, this );
    m_pListCtrlAISTargets->Connect( wxEVT_COMMAND_LIST_COL_CLICK,
            wxListEventHandler( AISTargetListDialog::OnTargetListColumnClicked ), NULL, this );

    width = 105;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlNAME, _("Name"), wxLIST_FORMAT_LEFT, width );
    s_width = tkz.GetNextToken();

    width = 55;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlCALL, _("Call"), wxLIST_FORMAT_LEFT, width );
    s_width = tkz.GetNextToken();

    width = 80;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlMMSI, _("MMSI"), wxLIST_FORMAT_LEFT, width );
    s_width = tkz.GetNextToken();

    width = 55;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlCLASS, _("Class"), wxLIST_FORMAT_CENTER, width );
    s_width = tkz.GetNextToken();

    width = 80;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlTYPE, _("Type"), wxLIST_FORMAT_LEFT, width );
    s_width = tkz.GetNextToken();

    width = 90;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlNAVSTATUS, _("Nav Status"), wxLIST_FORMAT_LEFT, width );
    s_width = tkz.GetNextToken();

    width = 45;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlBRG, _("Brg"), wxLIST_FORMAT_RIGHT, width );
    s_width = tkz.GetNextToken();

    width = 62;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlRNG, _("Range"), wxLIST_FORMAT_RIGHT, width );
    s_width = tkz.GetNextToken();

    width = 50;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlCOG, _("CoG"), wxLIST_FORMAT_RIGHT, width );
    s_width = tkz.GetNextToken();

    width = 50;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlSOG, _("SoG"), wxLIST_FORMAT_RIGHT, width );

    width = 55;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlCPA, _("CPA"), wxLIST_FORMAT_RIGHT, width );

    width = 65;
    if( s_width.ToLong( &lwidth ) ) {
        width = wxMax(20, lwidth);
        width = wxMin(width, 250);
    }
    m_pListCtrlAISTargets->InsertColumn( tlTCPA, _("TCPA"), wxLIST_FORMAT_RIGHT, width );
    wxListItem item;
    item.SetMask( wxLIST_MASK_IMAGE );
    item.SetImage( g_bAisTargetList_sortReverse ? 1 : 0 );
    g_AisTargetList_sortColumn = wxMax(g_AisTargetList_sortColumn, 0);
    m_pListCtrlAISTargets->SetColumn( g_AisTargetList_sortColumn, item );

    topSizer->Add( m_pListCtrlAISTargets, 1, wxEXPAND | wxALL, 0 );

    wxBoxSizer* boxSizer02 = new wxBoxSizer( wxVERTICAL );
    boxSizer02->AddSpacer( 22 );

    m_pButtonInfo = new wxButton( this, wxID_ANY, _("Target info"), wxDefaultPosition,
            wxDefaultSize, wxBU_AUTODRAW );
    m_pButtonInfo->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
            wxCommandEventHandler( AISTargetListDialog::OnTargetQuery ), NULL, this );
    boxSizer02->Add( m_pButtonInfo, 0, wxALL, 0 );
    boxSizer02->AddSpacer( 5 );

    m_pButtonJumpTo = new wxButton( this, wxID_ANY, _("Center View"), wxDefaultPosition,
            wxDefaultSize, wxBU_AUTODRAW );
    m_pButtonJumpTo->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
            wxCommandEventHandler( AISTargetListDialog::OnTargetScrollTo ), NULL, this );
    boxSizer02->Add( m_pButtonJumpTo, 0, wxALL, 0 );

    m_pButtonCreateWpt = new wxButton( this, wxID_ANY, _("Create WPT"), wxDefaultPosition,
            wxDefaultSize, wxBU_AUTODRAW );
    m_pButtonCreateWpt->Connect( wxEVT_COMMAND_BUTTON_CLICKED,
            wxCommandEventHandler( AISTargetListDialog::OnTargetCreateWpt ), NULL, this );
    boxSizer02->Add( m_pButtonCreateWpt, 0, wxALL, 0 );
    boxSizer02->AddSpacer( 10 );

    m_pStaticTextRange = new wxStaticText( this, wxID_ANY, _("Limit range: NM"), wxDefaultPosition,
            wxDefaultSize, 0 );
    boxSizer02->Add( m_pStaticTextRange, 0, wxALL, 0 );
    boxSizer02->AddSpacer( 2 );
    m_pSpinCtrlRange = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition,
            wxSize( 50, -1 ), wxSP_ARROW_KEYS, 1, 20000, g_AisTargetList_range );
    m_pSpinCtrlRange->Connect( wxEVT_COMMAND_SPINCTRL_UPDATED,
            wxCommandEventHandler( AISTargetListDialog::OnLimitRange ), NULL, this );
    m_pSpinCtrlRange->Connect( wxEVT_COMMAND_TEXT_UPDATED,
            wxCommandEventHandler( AISTargetListDialog::OnLimitRange ), NULL, this );
    boxSizer02->Add( m_pSpinCtrlRange, 0, wxEXPAND | wxALL, 0 );
    topSizer->Add( boxSizer02, 0, wxEXPAND | wxALL, 2 );

    boxSizer02->AddSpacer( 10 );
    m_pStaticTextCount = new wxStaticText( this, wxID_ANY, _("Target Count"), wxDefaultPosition,
            wxDefaultSize, 0 );
    boxSizer02->Add( m_pStaticTextCount, 0, wxALL, 0 );

    boxSizer02->AddSpacer( 2 );
    m_pTextTargetCount = new wxTextCtrl( this, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize,
            wxTE_READONLY );
    boxSizer02->Add( m_pTextTargetCount, 0, wxALL, 0 );

    topSizer->Layout();

    //    This is silly, but seems to be required for __WXMSW__ build
    //    If not done, the SECOND invocation of AISTargetList fails to expand the list to the full wxSizer size....
    SetSize( GetSize().x, GetSize().y - 1 );

    SetColorScheme();
    UpdateButtons();

    if( m_pAuiManager ) {
        wxAuiPaneInfo pane =
                wxAuiPaneInfo().Name( _T("AISTargetList") ).CaptionVisible( true ).
                        DestroyOnClose( true ).Float().FloatingPosition( 50, 200 ).TopDockable( false ).
                        BottomDockable( true ).LeftDockable( false ).RightDockable( false ).Show( true );
        m_pAuiManager->LoadPaneInfo( g_AisTargetList_perspective, pane );

        bool b_reset_pos = false;

#ifdef __WXMSW__
        //  Support MultiMonitor setups which an allow negative window positions.
        //  If the requested window title bar does not intersect any installed monitor,
        //  then default to simple primary monitor positioning.
        RECT frame_title_rect;
        frame_title_rect.left = pane.floating_pos.x;
        frame_title_rect.top = pane.floating_pos.y;
        frame_title_rect.right = pane.floating_pos.x + pane.floating_size.x;
        frame_title_rect.bottom = pane.floating_pos.y + 30;

        if( NULL == MonitorFromRect( &frame_title_rect, MONITOR_DEFAULTTONULL ) ) b_reset_pos =
                true;
#else

        //    Make sure drag bar (title bar) of window intersects wxClient Area of screen, with a little slop...
        wxRect window_title_rect;// conservative estimate
        window_title_rect.x = pane.floating_pos.x;
        window_title_rect.y = pane.floating_pos.y;
        window_title_rect.width = pane.floating_size.x;
        window_title_rect.height = 30;

        wxRect ClientRect = wxGetClientDisplayRect();
        ClientRect.Deflate(60, 60);// Prevent the new window from being too close to the edge
        if(!ClientRect.Intersects(window_title_rect))
        b_reset_pos = true;

#endif

        if( b_reset_pos ) pane.FloatingPosition( 50, 200 );

        //    If the list got accidentally dropped on top of the chart bar, move it away....
        if( pane.IsDocked() && ( pane.dock_row == 0 ) ) {
            pane.Float();
            pane.Row( 1 );
            pane.Position( 0 );

            g_AisTargetList_perspective = m_pAuiManager->SavePaneInfo( pane );
            pConfig->UpdateSettings();
        }

        pane.Caption( wxGetTranslation( _("AIS target list") ) );
        m_pAuiManager->AddPane( this, pane );
        m_pAuiManager->Update();

        m_pAuiManager->Connect( wxEVT_AUI_PANE_CLOSE,
                wxAuiManagerEventHandler( AISTargetListDialog::OnPaneClose ), NULL, this );
    }
}
コード例 #7
0
ファイル: ScreenHostLevels.cpp プロジェクト: Arc0re/lithtech
uint32 CScreenHostLevels::OnCommand(uint32 dwCommand, uint32 dwParam1, uint32 dwParam2)
{
	switch(dwCommand)
	{
	case CMD_ADD_LEVEL:
		{
			if (m_pAvailMissions->GetSelectedIndex() >= 0 && (m_pSelMissions->GetNumControls() < MAX_GAME_LEVELS))
			{
				CLTGUITextCtrl *pCtrl = (CLTGUITextCtrl *)m_pAvailMissions->GetSelectedControl();
				if (pCtrl)
				{
					AddMissionToList(pCtrl->GetParam1(),true,false);
					m_pSelMissions->ClearSelection();
				}
			}
			UpdateButtons();
		} break;
	case CMD_ADD_ALL:
		{
			if (m_pAvailMissions->GetNumControls())
			{
				for (uint32 i = 0; i < m_pAvailMissions->GetNumControls() && (m_pSelMissions->GetNumControls() < MAX_GAME_LEVELS); i++)
				{
					CLTGUITextCtrl *pCtrl = (CLTGUITextCtrl *)m_pAvailMissions->GetControl(i);
					if (pCtrl)
					{
						AddMissionToList(pCtrl->GetParam1(),false,false);
					}
				}
			}
			m_pSelMissions->ClearSelection();
			UpdateButtons();
		} break;
	case CMD_REMOVE_LEVEL:
		{
			int nIndex = m_pSelMissions->GetSelectedIndex();
			if (nIndex >= 0)
			{
				m_pSelMissions->ClearSelection();
				m_pSelMissions->RemoveControl(nIndex);
				int numLeft = m_pSelMissions->GetNumControls();
				if (numLeft > 0)
				{
					if (nIndex >= numLeft)
						nIndex = numLeft-1;
					m_pSelMissions->SetSelection(nIndex);
				}
			}
			UpdateButtons();

		} break;
	case CMD_REMOVE_ALL:
		{
			if (m_pSelMissions->GetNumControls() > 0)
			{
				m_pSelMissions->ClearSelection();
				m_pSelMissions->RemoveAll();
			}
			UpdateButtons();
		} break;
	default:
		return CBaseScreen::OnCommand(dwCommand,dwParam1,dwParam2);
	}
	return 1;
};
コード例 #8
0
/**
 * Update the button enabliness if the selected location changes
 * to prevent the up being on for the topmost and the down being on for the bottommost
 * @param event
 */
void EditLocationsDialog::OnSelectionChanges(wxCommandEvent &) {
    UpdateButtons();
}
コード例 #9
0
/*
=============================
idGameBearShootWindow::UpdateGame
=============================
*/
void idGameBearShootWindow::UpdateGame()
{
	int i;

	if (onNewGame) {
		ResetGameState();

		goal->position.x = 550;
		goal->position.y = 164;
		goal->velocity.Zero();
		helicopter->position.x = 550;
		helicopter->position.y = 100;
		helicopter->velocity.Zero();
		bear->SetVisible(false);

		bearTurretAngle.SetFloat(0.f);
		bearTurretForce.SetFloat(200.f);

		gamerunning = true;
	}

	if (onContinue) {
		gameOver = false;
		timeRemaining = 60.f;

		onContinue = false;
	}

	if (gamerunning == true) {
		int current_time = gui->GetTime();
		idRandom rnd(current_time);

		// Check for button presses
		UpdateButtons();

		if (bear) {
			UpdateBear();
		}

		if (helicopter && goal) {
			UpdateHelicopter();
		}

		// Update Wind
		if (windUpdateTime < current_time) {
			float	scale;
			int		width;

			windForce = rnd.CRandomFloat() * (MAX_WINDFORCE * 0.75f);

			if (windForce > 0) {
				windForce += (MAX_WINDFORCE * 0.25f);
				wind->rotation = 0;
			} else {
				windForce -= (MAX_WINDFORCE * 0.25f);
				wind->rotation = 180;
			}

			scale = 1.f - ((MAX_WINDFORCE - idMath::Fabs(windForce)) / MAX_WINDFORCE);
			width = 100*scale;

			if (windForce < 0) {
				wind->position.x = 500 - width + 1;
			} else {
				wind->position.x = 500;
			}

			wind->SetSize(width, 40);

			windUpdateTime = current_time + 7000 + rnd.RandomInt(5000);
		}

		// Update turret rotation angle
		if (turret) {
			turretAngle = bearTurretAngle.GetFloat();
			turret->rotation = turretAngle;
		}

		for (i = 0; i < entities.Num(); i++) {
			entities[i]->Update(timeSlice);
		}

		// Update countdown timer
		timeRemaining -= timeSlice;
		timeRemaining = idMath::ClampFloat(0.f, 99999.f, timeRemaining);
		gui->SetStateString("time_remaining", va("%2.1f", timeRemaining));

		if (timeRemaining <= 0.f && !gameOver) {
			gameOver = true;
			updateScore = true;
		}

		if (updateScore) {
			UpdateScore();
			updateScore = false;
		}
	}
}
コード例 #10
0
/**
 * Event handler for when the user wants to edit a name by activating an item
 * 
 * @param event
 */
void EditLocationsDialog::OnEditItem(wxCommandEvent &) {
    list_locations->EditLabel(GetSelected());
    editing = true;
    UpdateButtons();
}
コード例 #11
0
void EditLocationsDialog::OnRemove(wxCommandEvent &) {
    settings.locations.erase(settings.locations.begin() + GetSelected());

    RefillList(GetSelected());
    UpdateButtons();
}
コード例 #12
0
ファイル: ScrollBar.cpp プロジェクト: Xandev/XAGUI
void ScrollBar::SetOrientation(Orientation orientation)
{
    Slider::SetOrientation(orientation);
    UpdateButtons();
}
コード例 #13
0
void MultiFuncSelectorWidget::OnClickButton(multifuncfunc_t f)
{
	m_active = int(f);
	UpdateButtons();
	onSelect.emit(f);
}
コード例 #14
0
ファイル: FindDlg.cpp プロジェクト: mavrus95/windjview-subpix
void CFindDlg::OnEnChangeFind()
{
	UpdateButtons();
}
コード例 #15
0
ファイル: formatta.cpp プロジェクト: BraveStone/wordpad
void CFormatTabDlg::OnEditChange()
{
	UpdateButtons();
}
コード例 #16
0
AISTargetListDialog::AISTargetListDialog( wxWindow *parent, wxAuiManager *auimgr,
        AIS_Decoder *pdecoder ) :
        wxPanel( parent, wxID_ANY, wxDefaultPosition, wxSize( -1, -1/*780, 250*/ ), wxBORDER_NONE )
{
    m_pparent = parent;
    m_pAuiManager = auimgr;
    m_pdecoder = pdecoder;
    g_bsort_once = false;
    m_bautosort_force = false;
    
    wxFont *qFont = GetOCPNScaledFont(_("Dialog"));
    SetFont( *qFont );

    s_p_sort_decoder = pdecoder;
    m_pMMSI_array = new ArrayOfMMSI( ArrayItemCompareMMSI );

    CreateControls();

    SetColorScheme();
    UpdateButtons();

    if( m_pAuiManager ) {
        wxAuiPaneInfo pane =
                wxAuiPaneInfo().Name( _T("AISTargetList") ).CaptionVisible( true ).Float().FloatingPosition( 50, 50 )
                .FloatingSize(400, 200).BestSize(700, GetCharHeight() * 10);
        m_pAuiManager->LoadPaneInfo( g_AisTargetList_perspective, pane );

        //      Force and/or override any perspective information that is not applicable
        pane.Name( _T("AISTargetList") );
        pane.DestroyOnClose( true );
        pane.TopDockable( false ).BottomDockable( true ).LeftDockable( false ).RightDockable( false );
        pane.Show( true );
        
        bool b_reset_pos = false;
        if( (pane.floating_size.x != -1) && (pane.floating_size.y != -1)){
#ifdef __WXMSW__
            //  Support MultiMonitor setups which an allow negative window positions.
            //  If the requested window title bar does not intersect any installed monitor,
            //  then default to simple primary monitor positioning.
            RECT frame_title_rect;
            frame_title_rect.left = pane.floating_pos.x;
            frame_title_rect.top = pane.floating_pos.y;
            frame_title_rect.right = pane.floating_pos.x + pane.floating_size.x;
            frame_title_rect.bottom = pane.floating_pos.y + 30;

            if( NULL == MonitorFromRect( &frame_title_rect, MONITOR_DEFAULTTONULL ) )
                b_reset_pos = true;
#else

            //    Make sure drag bar (title bar) of window intersects wxClient Area of screen, with a little slop...
            wxRect window_title_rect;// conservative estimate
            window_title_rect.x = pane.floating_pos.x;
            window_title_rect.y = pane.floating_pos.y;
            window_title_rect.width = pane.floating_size.x;
            window_title_rect.height = 30;

            wxRect ClientRect = wxGetClientDisplayRect();
            ClientRect.Deflate(60, 60);// Prevent the new window from being too close to the edge
            if(!ClientRect.Intersects(window_title_rect))
                b_reset_pos = true;

#endif

            if( b_reset_pos )
                pane.FloatingPosition( 50, 50 );
        }

        //    If the list got accidentally dropped on top of the chart bar, move it away....
        if( pane.IsDocked() && ( pane.dock_row == 0 ) ) {
            pane.Float();
            pane.Row( 1 );
            pane.Position( 0 );

        }
        pane.Caption( wxGetTranslation( _("AIS target list") ) );
        pane.Show();
        
        //  Some special setup for touch screens
        if(g_btouch){
            pane.Float();
            pane.Dockable( false );
            
            wxSize screen_size = ::wxGetDisplaySize();
            pane.FloatingSize(screen_size.x * 6/10, screen_size.y * 8/10);
            pane.FloatingPosition(screen_size.x * 2/10, screen_size.y * 1/10);
        }
        
        
        m_pAuiManager->AddPane( this, pane );
        m_pAuiManager->Update();

        g_AisTargetList_perspective = m_pAuiManager->SavePaneInfo( pane );
        pConfig->UpdateSettings();
        
        m_pAuiManager->Connect( wxEVT_AUI_PANE_CLOSE,
                wxAuiManagerEventHandler( AISTargetListDialog::OnPaneClose ), NULL, this );
    }
    else {
        //  Make an estimate of the default dialog size
        //  for the case when the AUI Perspective for this dialog is undefined
        wxSize esize;
        esize.x = 700;
        esize.y = GetCharHeight() * 10; //18;
        SetSize( esize );    
    }
    
    RecalculateSize();
}
コード例 #17
0
void CGUIDialogSmartPlaylistRule::OnBrowse()
{
  CFileItemList items;
  CMusicDatabase database;
  database.Open();
  CVideoDatabase videodatabase;
  videodatabase.Open();

  std::string basePath;
  if (CSmartPlaylist::IsMusicType(m_type))
    basePath = "musicdb://";
  else
    basePath = "videodb://";

  VIDEODB_CONTENT_TYPE type = VIDEODB_CONTENT_MOVIES;
  if (m_type == "movies")
    basePath += "movies/";
  else if (m_type == "tvshows")
  {
    type = VIDEODB_CONTENT_TVSHOWS;
    basePath += "tvshows/";
  }
  else if (m_type == "musicvideos")
  {
    type = VIDEODB_CONTENT_MUSICVIDEOS;
    basePath += "musicvideos/";
  }
  else if (m_type == "episodes")
  {
    if (m_rule.m_field == FieldGenre || m_rule.m_field == FieldYear ||
        m_rule.m_field == FieldStudio)
      type = VIDEODB_CONTENT_TVSHOWS;
    else
      type = VIDEODB_CONTENT_EPISODES;
    basePath += "tvshows/";
  }

  int iLabel = 0;
  if (m_rule.m_field == FieldGenre)
  {
    if (m_type == "tvshows" ||
        m_type == "episodes" ||
        m_type == "movies")
      videodatabase.GetGenresNav(basePath + "genres/", items, type);
    else if (m_type == "songs" ||
             m_type == "albums" ||
             m_type == "artists" ||
             m_type == "mixed")
      database.GetGenresNav("musicdb://genres/",items);
    if (m_type == "musicvideos" ||
        m_type == "mixed")
    {
      CFileItemList items2;
      videodatabase.GetGenresNav("videodb://musicvideos/genres/",items2,VIDEODB_CONTENT_MUSICVIDEOS);
      items.Append(items2);
    }
    iLabel = 515;
  }
  else if (m_rule.m_field == FieldRole)
  {
    if (m_type == "artists" || m_type == "mixed")
    {
      database.GetRolesNav("musicdb://songs/", items);
      iLabel = 38033;
    }
  }
  else if (m_rule.m_field == FieldCountry)
  {
    videodatabase.GetCountriesNav(basePath, items, type);
    iLabel = 574;
  }
  else if (m_rule.m_field == FieldArtist || m_rule.m_field == FieldAlbumArtist)
  {
    if (CSmartPlaylist::IsMusicType(m_type))
      database.GetArtistsNav("musicdb://artists/", items, m_rule.m_field == FieldAlbumArtist, -1);
    if (m_type == "musicvideos" ||
        m_type == "mixed")
    {
      CFileItemList items2;
      videodatabase.GetMusicVideoArtistsByName("", items2);
      items.Append(items2);
    }
    iLabel = 557;
  }
  else if (m_rule.m_field == FieldAlbum)
  {
    if (CSmartPlaylist::IsMusicType(m_type))
      database.GetAlbumsNav("musicdb://albums/", items);
    if (m_type == "musicvideos" ||
        m_type == "mixed")
    {
      CFileItemList items2;
      videodatabase.GetMusicVideoAlbumsByName("", items2);
      items.Append(items2);
    }
    iLabel = 558;
  }
  else if (m_rule.m_field == FieldActor)
  {
    videodatabase.GetActorsNav(basePath + "actors/",items,type);
    iLabel = 20337;
  }
  else if (m_rule.m_field == FieldYear)
  {
    if (CSmartPlaylist::IsMusicType(m_type))
      database.GetYearsNav("musicdb://years/", items);
    if (CSmartPlaylist::IsVideoType(m_type))
    {
      CFileItemList items2;
      videodatabase.GetYearsNav(basePath + "years/", items2, type);
      items.Append(items2);
    }
    iLabel = 562;
  }
  else if (m_rule.m_field == FieldDirector)
  {
    videodatabase.GetDirectorsNav(basePath + "directors/", items, type);
    iLabel = 20339;
  }
  else if (m_rule.m_field == FieldStudio)
  {
    videodatabase.GetStudiosNav(basePath + "studios/", items, type);
    iLabel = 572;
  }
  else if (m_rule.m_field == FieldWriter)
  {
    videodatabase.GetWritersNav(basePath, items, type);
    iLabel = 20417;
  }
  else if (m_rule.m_field == FieldTvShowTitle ||
          (m_type == "tvshows" && m_rule.m_field == FieldTitle))
  {
    videodatabase.GetTvShowsNav(basePath + "titles/", items);
    iLabel = 20343;
  }
  else if (m_rule.m_field == FieldTitle)
  {
    if (m_type == "songs" || m_type == "mixed")
    {
      database.GetSongsNav("musicdb://songs/", items, -1, -1, -1);
      iLabel = 134;
    }
    if (m_type == "movies")
    {
      videodatabase.GetMoviesNav(basePath + "titles/", items);
      iLabel = 20342;
    }
    if (m_type == "episodes")
    {
      videodatabase.GetEpisodesNav(basePath + "titles/-1/-1/", items);
      // we need to replace the db label (<season>x<episode> <title>) with the title only
      CLabelFormatter format("%T", "");
      for (int i = 0; i < items.Size(); i++)
        format.FormatLabel(items[i].get());
      iLabel = 20360;
    }
    if (m_type == "musicvideos" || m_type == "mixed")
    {
      videodatabase.GetMusicVideosNav(basePath + "titles/", items);
      iLabel = 20389;
    }
  }
  else if (m_rule.m_field == FieldPlaylist || m_rule.m_field == FieldVirtualFolder)
  {
    // use filebrowser to grab another smart playlist

    // Note: This can cause infinite loops (playlist that refers to the same playlist) but I don't
    //       think there's any decent way to deal with this, as the infinite loop may be an arbitrary
    //       number of playlists deep, eg playlist1 -> playlist2 -> playlist3 ... -> playlistn -> playlist1
    if (CSmartPlaylist::IsVideoType(m_type))
      XFILE::CDirectory::GetDirectory("special://videoplaylists/", items, ".xsp", XFILE::DIR_FLAG_NO_FILE_DIRS);
    if (CSmartPlaylist::IsMusicType(m_type))
    {
      CFileItemList items2;
      XFILE::CDirectory::GetDirectory("special://musicplaylists/", items2, ".xsp", XFILE::DIR_FLAG_NO_FILE_DIRS);
      items.Append(items2);
    }

    for (int i = 0; i < items.Size(); i++)
    {
      CFileItemPtr item = items[i];
      CSmartPlaylist playlist;
      // don't list unloadable smartplaylists or any referenceable smartplaylists
      // which do not match the type of the current smartplaylist
      if (!playlist.Load(item->GetPath()) ||
         (m_rule.m_field == FieldPlaylist &&
         (!CSmartPlaylist::CheckTypeCompatibility(m_type, playlist.GetType()) ||
         (!playlist.GetGroup().empty() || playlist.IsGroupMixed()))))
      {
        items.Remove(i);
        i -= 1;
        continue;
      }

      if (!playlist.GetName().empty())
        item->SetLabel(playlist.GetName());
    }
    iLabel = 559;
  }
  else if (m_rule.m_field == FieldPath)
  {
    VECSOURCES sources;
    if (m_type == "songs" || m_type == "mixed")
      sources = *CMediaSourceSettings::GetInstance().GetSources("music");
    if (CSmartPlaylist::IsVideoType(m_type))
    {
      VECSOURCES sources2 = *CMediaSourceSettings::GetInstance().GetSources("video");
      sources.insert(sources.end(),sources2.begin(),sources2.end());
    }
    g_mediaManager.GetLocalDrives(sources);
    
    std::string path = m_rule.GetParameter();
    CGUIDialogFileBrowser::ShowAndGetDirectory(sources, g_localizeStrings.Get(657), path, false);
    if (!m_rule.m_parameter.empty())
      m_rule.m_parameter.clear();
    if (!path.empty())
      m_rule.m_parameter.emplace_back(std::move(path));

    UpdateButtons();
    return;
  }
  else if (m_rule.m_field == FieldSet)
  {
    videodatabase.GetSetsNav("videodb://movies/sets/", items, VIDEODB_CONTENT_MOVIES);
    iLabel = 20434;
  }
  else if (m_rule.m_field == FieldTag)
  {
    VIDEODB_CONTENT_TYPE type = VIDEODB_CONTENT_MOVIES;
    if (m_type == "tvshows" ||
        m_type == "episodes")
      type = VIDEODB_CONTENT_TVSHOWS;
    else if (m_type == "musicvideos")
      type = VIDEODB_CONTENT_MUSICVIDEOS;
    else if (m_type != "movies")
      return;

    videodatabase.GetTagsNav(basePath + "tags/", items, type);
    iLabel = 20459;
  }
  else
  { //! @todo Add browseability in here.
    assert(false);
  }

  // sort the items
  items.Sort(SortByLabel, SortOrderAscending, CServiceBroker::GetSettings().GetBool(CSettings::SETTING_FILELISTS_IGNORETHEWHENSORTING) ? SortAttributeIgnoreArticle : SortAttributeNone);

  CGUIDialogSelect* pDialog = g_windowManager.GetWindow<CGUIDialogSelect>();
  pDialog->Reset();
  pDialog->SetItems(items);
  std::string strHeading = StringUtils::Format(g_localizeStrings.Get(13401).c_str(), g_localizeStrings.Get(iLabel).c_str());
  pDialog->SetHeading(CVariant{std::move(strHeading)});
  pDialog->SetMultiSelection(m_rule.m_field != FieldPlaylist && m_rule.m_field != FieldVirtualFolder);

  if (!m_rule.m_parameter.empty())
    pDialog->SetSelected(m_rule.m_parameter);

  pDialog->Open();
  if (pDialog->IsConfirmed())
  {
    m_rule.m_parameter.clear();
    for (int i : pDialog->GetSelectedItems())
      m_rule.m_parameter.push_back(items.Get(i)->GetLabel());

    UpdateButtons();
  }
  pDialog->Reset();
}
コード例 #18
0
ファイル: InputDialog.cpp プロジェクト: ssaue/soundspace
void CInputDialog::OnSelectType()
{
    UpdateData(TRUE);
    UpdateButtons();
}
コード例 #19
0
void AISTargetListDialog::OnTargetSelected( wxListEvent &event )
{
    UpdateButtons();
}
コード例 #20
0
void SelectWeightsDlg::InitNormal()
{
	panel = new wxPanel(this);
	panel->SetBackgroundColour(*wxWHITE);
	SetBackgroundColour(*wxWHITE);
	
	ok_btn = new wxButton(panel, XRCID("wxID_OK"), "OK",
						  wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	cancel_btn = new wxButton(panel, XRCID("wxID_CANCEL"), "Cancel",
							  wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
	
	Connect(XRCID("wxID_OK"), wxEVT_BUTTON,
			wxCommandEventHandler(SelectWeightsDlg::OnOkClick));
	Connect(XRCID("wxID_CANCEL"), wxEVT_BUTTON,
			wxCommandEventHandler(SelectWeightsDlg::OnCancelClick));
	
	w_list = new wxListCtrl(panel, XRCID("ID_W_LIST"), wxDefaultPosition,
							wxSize(-1, 100), wxLC_REPORT);
	// Note: search for "ungrouped_list" for examples of wxListCtrl usage.
	w_list->AppendColumn("Weights Name");
	w_list->SetColumnWidth(TITLE_COL, 300);
	InitWeightsList();
	
	Connect(XRCID("ID_W_LIST"), wxEVT_LIST_ITEM_ACTIVATED,
			wxListEventHandler(SelectWeightsDlg::OnWListItemDblClick));
	Connect(XRCID("ID_W_LIST"), wxEVT_LIST_ITEM_SELECTED,
			wxListEventHandler(SelectWeightsDlg::OnWListItemSelect));
	Connect(XRCID("ID_W_LIST"), wxEVT_LIST_ITEM_DESELECTED,
			wxListEventHandler(SelectWeightsDlg::OnWListItemDeselect));
	
	details_win = wxWebView::New(panel, wxID_ANY, wxWebViewDefaultURLStr,
								 wxDefaultPosition,
								 wxSize(-1, 200));
	
	// Arrange above widgets in panel using sizers.
	// Top level panel sizer will be panel_h_szr
	// Below that will be panel_v_szr
	// panel_v_szr will directly receive widgets
	
	wxBoxSizer* btns_row1_h_szr = new wxBoxSizer(wxHORIZONTAL);
	btns_row1_h_szr->Add(ok_btn, 0, wxALIGN_CENTER_VERTICAL);
	btns_row1_h_szr->AddSpacer(10);
	btns_row1_h_szr->Add(cancel_btn, 0, wxALIGN_CENTER_VERTICAL);
	
	wxBoxSizer* wghts_list_h_szr = new wxBoxSizer(wxHORIZONTAL);
	wghts_list_h_szr->Add(w_list);
	
	wxBoxSizer* panel_v_szr = new wxBoxSizer(wxVERTICAL);
	panel_v_szr->Add(wghts_list_h_szr, 0,
					 wxALIGN_CENTER_HORIZONTAL);
	
	panel_v_szr->Add(details_win, 1, wxEXPAND);
	
	panel_v_szr->Add(btns_row1_h_szr, 0,
					 wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
	
	wxBoxSizer* panel_h_szr = new wxBoxSizer(wxHORIZONTAL);
	panel_h_szr->Add(panel_v_szr, 1, wxEXPAND);
	
	panel->SetSizer(panel_h_szr);
	
	boost::uuids::uuid default_id = w_man_int->GetDefault();
	SelectId(default_id);
	UpdateButtons();
	
	// Top Sizer
	wxBoxSizer* top_h_sizer = new wxBoxSizer(wxHORIZONTAL);
	top_h_sizer->Add(panel, 1, wxEXPAND|wxALL, 8);
	
	SetSizerAndFit(top_h_sizer);
	w_list->SetFocus();
}
コード例 #21
0
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& message)
{
  CGUIDialog::OnMessage(message);


  switch ( message.GetMessage() )
  {
  case GUI_MSG_CLICKED:
    {
      int iControl = message.GetSenderId();

      switch (iControl)
      {
      case CTL_BUTTON_DONE:
        OnOK();
        break;
      case CTL_BUTTON_CANCEL:
        Close();
        break;
      case CTL_BUTTON_SHIFT:
        OnShift();
        break;
      case CTL_BUTTON_CAPS:
        if (m_keyType == LOWER)
          m_keyType = CAPS;
        else if (m_keyType == CAPS)
          m_keyType = LOWER;
        UpdateButtons();
        break;
      case CTL_BUTTON_SYMBOLS:
        OnSymbols();
        break;
      case CTL_BUTTON_LEFT:
        MoveCursor( -1);
        break;
      case CTL_BUTTON_RIGHT:
        MoveCursor(1);
        break;
      case CTL_BUTTON_IP_ADDRESS:
        OnIPAddress();
        break;
      case CTL_BUTTON_CLEAR:
        SetText("");
        break;
      default:
        m_lastRemoteKeyClicked = 0;
        OnClickButton(iControl);
        break;
      }
    }
    break;

  case GUI_MSG_SET_TEXT:
    SetText(message.GetLabel());

    // close the dialog if requested
    if (message.GetParam1() > 0)
      OnOK();
    break;

  case GUI_MSG_INPUT_TEXT:
    InputText(message.GetLabel());
    break;

  case GUI_MSG_INPUT_TEXT_EDIT:
    InputTextEditing(message.GetLabel(), message.GetParam1(), message.GetParam2());
    break;
  }

  return true;
}
コード例 #22
0
ファイル: win32_fullscreen.cpp プロジェクト: kingctan/fbvlc
LRESULT VLCControlsWnd::WindowProc(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
    switch(uMsg){
        case WM_CREATE:{
            const int ControlsHeight = 21+3;
            const int ButtonsWidth = ControlsHeight;

            int HorizontalOffset = xControlsSpace;
            int ControlWidth = ButtonsWidth;
            hPlayPauseButton =
                CreateWindow(TEXT("BUTTON"), TEXT("Play/Pause"),
                             WS_CHILD|WS_VISIBLE|BS_BITMAP|BS_FLAT,
                             HorizontalOffset, xControlsSpace,
                             ControlWidth, ControlsHeight, hWnd(),
                             (HMENU)ID_FS_PLAY_PAUSE, 0, 0);
            SendMessage(hPlayPauseButton, BM_SETIMAGE,
                        (WPARAM)IMAGE_BITMAP, (LPARAM)RC().hPauseBitmap);
            HorizontalOffset+=ControlWidth+xControlsSpace;

            ControlWidth = 200;
            int VideoPosControlHeight = 10;
            hVideoPosScroll =
                CreateWindow(PROGRESS_CLASS, TEXT("Video Position"),
                             WS_CHILD|WS_DISABLED|WS_VISIBLE|SBS_HORZ|SBS_TOPALIGN|PBS_SMOOTH,
                             HorizontalOffset, xControlsSpace+(ControlsHeight-VideoPosControlHeight)/2,
                             ControlWidth, VideoPosControlHeight, hWnd(),
                             (HMENU)ID_FS_VIDEO_POS_SCROLL, 0, 0);
            HMODULE hThModule = LoadLibrary(TEXT("UxTheme.dll"));
            if(hThModule){
                FARPROC proc = GetProcAddress(hThModule, "SetWindowTheme");
                typedef HRESULT (WINAPI* SetWindowThemeProc)(HWND, LPCWSTR, LPCWSTR);
                if(proc){
                    ((SetWindowThemeProc)proc)(hVideoPosScroll, L"", L"");
                }
                FreeLibrary(hThModule);
            }
            HorizontalOffset+=ControlWidth+xControlsSpace;

            ControlWidth = ButtonsWidth;
            hMuteButton =
                CreateWindow(TEXT("BUTTON"), TEXT("Mute"),
                             WS_CHILD|WS_VISIBLE|BS_AUTOCHECKBOX|BS_PUSHLIKE|BS_BITMAP, //BS_FLAT
                             HorizontalOffset, xControlsSpace,
                             ControlWidth, ControlsHeight,
                             hWnd(), (HMENU)ID_FS_MUTE, 0, 0);
            SendMessage(hMuteButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
                        (LPARAM)RC().hVolumeBitmap);
            HorizontalOffset+=ControlWidth+xControlsSpace;

            ControlWidth = 100;
            hVolumeSlider =
                CreateWindow(TRACKBAR_CLASS, TEXT("Volume"),
                             WS_CHILD|WS_VISIBLE|TBS_HORZ|TBS_BOTTOM|TBS_AUTOTICKS,
                             HorizontalOffset, xControlsSpace,
                             ControlWidth, ControlsHeight - 4, hWnd(),
                             (HMENU)ID_FS_VOLUME, 0, 0);
            HorizontalOffset+=ControlWidth+xControlsSpace;
            SendMessage(hVolumeSlider, TBM_SETRANGE, FALSE, (LPARAM) MAKELONG (0, 100));
            SendMessage(hVolumeSlider, TBM_SETTICFREQ, (WPARAM) 10, 0);

            ControlWidth = ButtonsWidth;
            DWORD dwFSBtnStyle = WS_CHILD|BS_BITMAP|BS_FLAT;
            if( !PO() || PO()->get_enable_fs() ){
                dwFSBtnStyle |= WS_VISIBLE;
            }
            hFSButton =
                CreateWindow(TEXT("BUTTON"), TEXT("Toggle fullscreen"),
                             dwFSBtnStyle,
                             HorizontalOffset, xControlsSpace,
                             ControlWidth, ControlsHeight, hWnd(),
                             (HMENU)ID_FS_SWITCH_FS, 0, 0);
            SendMessage(hFSButton, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
                        (LPARAM)RC().hDeFullscreenBitmap);
            HorizontalOffset+=ControlWidth+xControlsSpace;

            RECT rect;
            GetClientRect(GetParent(hWnd()), &rect);

            int ControlWndWidth = HorizontalOffset;
            int ControlWndHeight = xControlsSpace+ControlsHeight+xControlsSpace;
            SetWindowPos(hWnd(), 0,
                         0, (rect.bottom - rect.top) - ControlWndWidth,
                         rect.right-rect.left, ControlWndHeight,
                         SWP_NOZORDER|SWP_NOOWNERZORDER|SWP_NOACTIVATE);

            //new message blinking timer
            SetTimer(hWnd(), 2, 500, NULL);

            CreateToolTip();

            break;
        }
        case WM_SHOWWINDOW:{
            if(FALSE!=wParam){ //showing
                UpdateButtons();
            }
            break;
        }
        case WM_LBUTTONUP:{
            POINT BtnUpPoint = {LOWORD(lParam), HIWORD(lParam)};
            RECT VideoPosRect;
            GetWindowRect(hVideoPosScroll, &VideoPosRect);
            ClientToScreen(hWnd(), &BtnUpPoint);
            if(PtInRect(&VideoPosRect, BtnUpPoint)){
                SetVideoPos(float(BtnUpPoint.x-VideoPosRect.left)/(VideoPosRect.right-VideoPosRect.left));
            }
            break;
        }
        case WM_TIMER:{
            switch(wParam){
                case 1:{
                    POINT MousePoint;
                    GetCursorPos(&MousePoint);
                    RECT ControlWndRect;
                    GetWindowRect(hWnd(), &ControlWndRect);
                    if(PtInRect(&ControlWndRect, MousePoint)||GetCapture()==hVolumeSlider){
                        //do not allow control window to close while mouse is within
                        NeedShowControls();
                    }
                    else{
                        NeedHideControls();
                    }
                    break;
                }
                case 2:{
                    UpdateButtons();
                    break;
                }
            }
            break;
        }
        case WM_SETCURSOR:{
            RECT VideoPosRect;
            GetWindowRect(hVideoPosScroll, &VideoPosRect);
            DWORD dwMsgPos = GetMessagePos();
            POINT MsgPosPoint = {LOWORD(dwMsgPos), HIWORD(dwMsgPos)};
            if(PtInRect(&VideoPosRect, MsgPosPoint)){
                SetCursor(LoadCursor(NULL, IDC_HAND));
                return TRUE;
            }
            else{
                return VLCWnd::WindowProc(uMsg, wParam, lParam);
            }
            break;
        }
        case WM_NCDESTROY:
            break;
        case WM_COMMAND:{
            WORD NCode = HIWORD(wParam);
            WORD Control = LOWORD(wParam);
            switch(NCode){
                case BN_CLICKED:{
                    switch(Control){
                        case ID_FS_SWITCH_FS:
                            WM().ToggleFullScreen();
                            break;
                        case ID_FS_PLAY_PAUSE:{
                            if( VP() ){
                                if( IsPlaying() )
                                    VP()->pause();
                                else
                                    VP()->play();
                            }
                            break;
                        }
                        case ID_FS_MUTE:{
                            if( VP() ){
                                VP()->audio().set_mute( IsDlgButtonChecked(hWnd(), ID_FS_MUTE) != FALSE );
                                SyncVolumeSliderWithVLCVolume();
                            }
                            break;
                        }
                    }
                    break;
                }
            }
            break;
        }
        case WM_SIZE:{
            if( (GetWindowLong(hWnd(), GWL_STYLE) & WS_VISIBLE) &&
                ( !PO() ||
                  ( !WM().IsFullScreen() && !PO()->get_show_toolbar() ) ||
                  ( WM().IsFullScreen() && !PO()->get_show_fs_toolbar() ) ) )
            {
                //hide controls when they are not allowed
                NeedHideControls();
            }

            const int new_client_width = LOWORD(lParam);

            bool isFSBtnVisible =
                (GetWindowLong(hFSButton, GWL_STYLE) & WS_VISIBLE) != 0;

            HDWP hDwp = BeginDeferWindowPos(4);

            int VideoScrollWidth = new_client_width;

            POINT pt = {0, 0};
            RECT rect;
            GetWindowRect(hPlayPauseButton, &rect);
            pt.x = rect.right;
            ScreenToClient(hWnd(), &pt);
            VideoScrollWidth -= pt.x;
            VideoScrollWidth -= xControlsSpace;

            RECT VideoSrcollRect;
            GetWindowRect(hVideoPosScroll, &VideoSrcollRect);

            RECT MuteRect;
            GetWindowRect(hMuteButton, &MuteRect);
            VideoScrollWidth -= xControlsSpace;
            VideoScrollWidth -= (MuteRect.right - MuteRect.left);

            RECT VolumeRect;
            GetWindowRect(hVolumeSlider, &VolumeRect);
            VideoScrollWidth -= xControlsSpace;
            VideoScrollWidth -= (VolumeRect.right - VolumeRect.left);

            RECT FSRect = {0, 0, 0, 0};
            if( isFSBtnVisible ) {
                GetWindowRect(hFSButton, &FSRect);
                VideoScrollWidth -= xControlsSpace;
                VideoScrollWidth -= (FSRect.right - FSRect.left);
                VideoScrollWidth -= xControlsSpace;
            }

            pt.x = VideoSrcollRect.left;
            pt.y = VideoSrcollRect.top;
            ScreenToClient(hWnd(), &pt);
            hDwp = DeferWindowPos(hDwp, hVideoPosScroll, 0, pt.x, pt.y,
                                  VideoScrollWidth,
                                  VideoSrcollRect.bottom - VideoSrcollRect.top,
                                  SWP_NOACTIVATE|SWP_NOOWNERZORDER);

            int HorizontalOffset =
                pt.x + VideoScrollWidth + xControlsSpace;
            pt.x = 0;
            pt.y = MuteRect.top;
            ScreenToClient(hWnd(), &pt);
            hDwp = DeferWindowPos(hDwp, hMuteButton, 0,
                                  HorizontalOffset, pt.y, 0, 0,
                                  SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOOWNERZORDER);
            HorizontalOffset +=
                MuteRect.right - MuteRect.left + xControlsSpace;

            pt.x = 0;
            pt.y = VolumeRect.top;
            ScreenToClient(hWnd(), &pt);
            hDwp = DeferWindowPos(hDwp, hVolumeSlider, 0,
                                  HorizontalOffset, pt.y, 0, 0,
                                  SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOOWNERZORDER);
            HorizontalOffset +=
                VolumeRect.right - VolumeRect.left + xControlsSpace;

            if( isFSBtnVisible ) {
                pt.x = 0;
                pt.y = FSRect.top;
                ScreenToClient(hWnd(), &pt);
                hDwp = DeferWindowPos(hDwp, hFSButton, 0,
                                      HorizontalOffset, pt.y, 0, 0,
                                      SWP_NOSIZE|SWP_NOACTIVATE|SWP_NOOWNERZORDER);
            }

            EndDeferWindowPos(hDwp);
            break;
        }
        case WM_HSCROLL:
        case WM_VSCROLL: {
            if( VP() ){
                if(hVolumeSlider==(HWND)lParam){
                    LRESULT SliderPos = SendMessage(hVolumeSlider, (UINT) TBM_GETPOS, 0, 0);
                    SetVLCVolumeBySliderPos(SliderPos);
                }
            }
            break;
        }
        default:
            return VLCWnd::WindowProc(uMsg, wParam, lParam);
    }
    return 0L;
}
コード例 #23
0
ファイル: MACRODLG.CPP プロジェクト: jimmccurdy/ArchiveGit
void CSmartFieldsDialog::OnSelchangeMacroList()
{
	UpdateButtons();
	m_pList->BeginEdit();
}
コード例 #24
0
	void FavoriteVolumesDialog::OnRemoveAllButtonClick (wxCommandEvent& event)
	{
		FavoritesListCtrl->DeleteAllItems();
		UpdateButtons();
	}
コード例 #25
0
bool CGUIWindowMusicSongs::OnMessage(CGUIMessage& message)
{
  switch ( message.GetMessage() )
  {
  case GUI_MSG_WINDOW_DEINIT:
    if (m_thumbLoader.IsLoading())
      m_thumbLoader.StopThread();
    break;
  case GUI_MSG_WINDOW_INIT:
    {
      // removed the start window check from files view
      // the window translator does it by using a virtual window id (5)

      // is this the first time the window is opened?
      if (m_vecItems->GetPath() == "?" && message.GetStringParam().IsEmpty())
        message.SetStringParam(g_settings.m_defaultMusicSource);

      return CGUIWindowMusicBase::OnMessage(message);
    }
    break;

  case GUI_MSG_DIRECTORY_SCANNED:
    {
      CFileItem directory(message.GetStringParam(), true);

      // Only update thumb on a local drive
      if (directory.IsHD())
      {
        CStdString strParent;
        URIUtils::GetParentPath(directory.GetPath(), strParent);
        if (directory.GetPath() == m_vecItems->GetPath() || strParent == m_vecItems->GetPath())
        {
          Update(m_vecItems->GetPath());
        }
      }
    }
    break;

  case GUI_MSG_NOTIFY_ALL:
    {
      if (message.GetParam1()==GUI_MSG_REMOVED_MEDIA)
        DeleteRemoveableMediaDirectoryCache();
    }
    break;

  case GUI_MSG_CLICKED:
    {
      int iControl = message.GetSenderId();

      if (iControl == CONTROL_BTNPLAYLISTS)
      {
        if (!m_vecItems->GetPath().Equals("special://musicplaylists/"))
          Update("special://musicplaylists/");
      }
      else if (iControl == CONTROL_BTNSCAN)
      {
        OnScan(-1);
      }
      else if (iControl == CONTROL_BTNREC)
      {
        if (g_application.IsPlayingAudio() )
        {
          if (g_application.m_pPlayer->CanRecord() )
          {
            bool bIsRecording = g_application.m_pPlayer->IsRecording();
            g_application.m_pPlayer->Record(!bIsRecording);
            UpdateButtons();
          }
        }
      }
      else if (iControl == CONTROL_BTNRIP)
      {
        OnRipCD();
      }
    }
    break;
  }

  return CGUIWindowMusicBase::OnMessage(message);
}
コード例 #26
0
JXFSBindingTable::JXFSBindingTable
	(
	JFSBindingList*		list,
	JXTextButton*		addButton,
	JXTextButton*		removeButton,
	JXTextButton*		duplicateButton,
	JXScrollbarSet*		scrollbarSet,
	JXContainer*		enclosure,
	const HSizingOption hSizing,
	const VSizingOption vSizing,
	const JCoordinate	x,
	const JCoordinate	y,
	const JCoordinate	w,
	const JCoordinate	h
	)
	:
	JXEditTable(1,1, scrollbarSet, enclosure, hSizing, vSizing, x, y, w, h),
	itsBindingList(list),
	itsAddButton(addButton),
	itsRemoveButton(removeButton),
	itsDuplicateButton(duplicateButton),
	itsTextInput(NULL)
{
	// row height

	const JSize rowHeight = 2*kVMarginWidth + JMax(
		GetFontManager()->GetDefaultFont().GetLineHeight(),
		GetFontManager()->GetDefaultMonospaceFont().GetLineHeight());
	SetDefaultRowHeight(rowHeight);

	// buttons

	ListenTo(itsAddButton);
	ListenTo(itsRemoveButton);
	ListenTo(itsDuplicateButton);

	// type menu

	itsTypeMenu = jnew JXTextMenu("", this, kFixedLeft, kFixedTop, 0,0, 10,10);
	assert( itsTypeMenu != NULL );
	itsTypeMenu->Hide();
	itsTypeMenu->SetToHiddenPopupMenu(kJTrue);
	itsTypeMenu->SetMenuItems(kTypeMenuStr);
	itsTypeMenu->SetUpdateAction(JXMenu::kDisableNone);
	ListenTo(itsTypeMenu);

	// regex for testing

	itsTestRegex = jnew JRegex;
	assert( itsTestRegex != NULL );

	// data

	for (JIndex i=1; i<=kColCount; i++)
		{
		AppendCols(1, kInitColWidth[i-1]);
		}
	UpdateColWidths();

	const JSize rowCount = itsBindingList->GetElementCount();
	AppendRows(rowCount);

	UpdateButtons();
	ListenTo(&(GetTableSelection()));
}
コード例 #27
0
 /* virtual methods from class ListCursorHandler */
 void OnCursorMoved(unsigned index) override {
   UpdateButtons();
 }
コード例 #28
0
ファイル: formatta.cpp プロジェクト: BraveStone/wordpad
void CFormatTabDlg::OnClickedSet()
{
	Set();
	UpdateButtons();
	SetEditFocus();
}
コード例 #29
0
ファイル: DlgEventLog.cpp プロジェクト: justinlynn/boinc-v2
/*!
 * called from CMainDocument::HandleCompletedRPC() after wxEVT_RPC_FINISHED event
 */
void CDlgEventLog::OnRefresh() {
    bool isConnected;
    static wxString strLastMachineName = wxEmptyString;
    wxString strNewMachineName = wxEmptyString;
    CMainDocument* pDoc     = wxGetApp().GetDocument();
    wxASSERT(pDoc);
    wxASSERT(wxDynamicCast(pDoc, CMainDocument));
    
    if (!IsShown()) return;

    if (!m_bProcessingRefreshEvent) {
        m_bProcessingRefreshEvent = true;
        wxASSERT(m_pList);

        wxInt32 iRowCount = GetDocCount();
        long topItem = m_pList->GetTopItem();
        
        if (0 >= iRowCount) {
            m_pList->DeleteAllItems();
            ResetMessageFiltering();
            m_iPreviousFirstMsgSeqNum = 0;
            m_iPreviousLastMsgSeqNum = 0;
        } else {
            // If connected computer changed, reset message filtering
            isConnected = wxGetApp().GetDocument()->IsConnected();
            if (isConnected) {
                pDoc->GetConnectedComputerName(strNewMachineName);
                if (strLastMachineName != strNewMachineName) {
                    strLastMachineName = strNewMachineName;
                    m_bWasConnected = false;
                    ResetMessageFiltering();
                    m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
                    m_iPreviousLastMsgSeqNum = m_iPreviousFirstMsgSeqNum - 1;
                    iRowCount = m_iTotalDocCount;   // In case we had filtering set
                }
            }

            // If connection status changed, adjust color of messages display
            if (m_bWasConnected != isConnected) {
                m_bWasConnected = isConnected;
                SetTextColor();

                // Force a complete update
                m_pList->DeleteAllItems();
                m_pList->SetItemCount(iRowCount);
                m_iPreviousRowCount = 0;    // Force scrolling to bottom

            } else {
                // Connection status didn't change
                if (m_iPreviousLastMsgSeqNum != pDoc->GetLastMsgSeqNum()) {
                    if (m_iPreviousRowCount == iRowCount) {
                        m_pList->Refresh();
                    } else {
                        m_pList->SetItemCount(iRowCount);
                    }
                }
            }
        }

        if ((iRowCount > 1) && (m_iPreviousLastMsgSeqNum != pDoc->GetLastMsgSeqNum())) {
            if (EnsureLastItemVisible()) {
                m_pList->EnsureVisible(iRowCount - 1);
            } else if (topItem > 0) {
                int n = topItem - m_iNumDeletedFilteredRows;
                if (n < 0) n = 0;
                Freeze();   // Avoid flicker if selected rows are visible
                m_pList->EnsureVisible(n);
                Thaw();
            }
        }

        m_iPreviousRowCount = iRowCount;
        if (m_iTotalDocCount > 0) {
            m_iPreviousFirstMsgSeqNum = pDoc->GetFirstMsgSeqNum();
            m_iPreviousLastMsgSeqNum = pDoc->GetLastMsgSeqNum();
        }
        
        UpdateButtons();

        m_bProcessingRefreshEvent = false;
    }
}
コード例 #30
0
 void RefreshView() {
   UpdateList();
   UpdateButtons();
 }