]> git.sesse.net Git - vlc/commitdiff
* display useful information in the tooltip
authorAnil Daoud <anil@videolan.org>
Tue, 15 Mar 2005 11:29:46 +0000 (11:29 +0000)
committerAnil Daoud <anil@videolan.org>
Tue, 15 Mar 2005 11:29:46 +0000 (11:29 +0000)
modules/gui/wxwindows/interface.cpp
modules/gui/wxwindows/timer.cpp
modules/gui/wxwindows/wxwindows.h

index f0d3e878012cdb833b35fc96f3ece4c2fa6a2dd8..4072b125599b14a7b8ec21654da03223b9f3e40f 100644 (file)
@@ -101,27 +101,6 @@ BEGIN_EVENT_TABLE(wxVolCtrl, wxWindow)
     EVT_MOTION(wxVolCtrl::OnChange)
 END_EVENT_TABLE()
 
-/* Systray integration */
-#ifdef wxHAS_TASK_BAR_ICON
-class Systray: public wxTaskBarIcon
-{
-public:
-    Systray( Interface* p_main_interface );
-    virtual ~Systray() {};
-    wxMenu* CreatePopupMenu();
-
-private:
-    void OnLeftClick( wxTaskBarIconEvent& event );
-    void OnPlayStream ( wxCommandEvent& event );
-    void OnStopStream ( wxCommandEvent& event );
-    void OnPrevStream ( wxCommandEvent& event );
-    void OnNextStream ( wxCommandEvent& event );
-    void OnExit(  wxCommandEvent& event );
-    Interface* p_main_interface;
-    DECLARE_EVENT_TABLE()
-};
-#endif
-
 /*****************************************************************************
  * Event Table.
  *****************************************************************************/
@@ -228,20 +207,6 @@ BEGIN_EVENT_TABLE(Interface, wxFrame)
 
 END_EVENT_TABLE()
 
-#ifdef wxHAS_TASK_BAR_ICON
-BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
-    /* Mouse events */
-    EVT_TASKBAR_LEFT_DOWN(Systray::OnLeftClick)
-    /* Menu events */
-    EVT_MENU(Iconize_Event, Systray::OnLeftClick)
-    EVT_MENU(Exit_Event, Systray::OnExit)
-    EVT_MENU(PlayStream_Event, Systray::OnPlayStream)
-    EVT_MENU(NextStream_Event, Systray::OnNextStream)
-    EVT_MENU(PrevStream_Event, Systray::OnPrevStream)
-    EVT_MENU(StopStream_Event, Systray::OnStopStream)
-END_EVENT_TABLE()
-#endif
-
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
@@ -1305,10 +1270,27 @@ void wxVolCtrl::UpdateVolume()
 }
 
 /*****************************************************************************
- * Definition of Systray class.
+ * Systray class.
  *****************************************************************************/
 
 #ifdef wxHAS_TASK_BAR_ICON
+
+BEGIN_EVENT_TABLE(Systray, wxTaskBarIcon)
+    /* Mouse events */
+#ifdef WIN32
+    EVT_TASKBAR_LEFT_DCLICK(Systray::OnLeftClick)
+#else
+    EVT_TASKBAR_LEFT_DOWN(Systray::OnLeftClick)
+#endif
+    /* Menu events */
+    EVT_MENU(Iconize_Event, Systray::OnLeftClick)
+    EVT_MENU(Exit_Event, Systray::OnExit)
+    EVT_MENU(PlayStream_Event, Systray::OnPlayStream)
+    EVT_MENU(NextStream_Event, Systray::OnNextStream)
+    EVT_MENU(PrevStream_Event, Systray::OnPrevStream)
+    EVT_MENU(StopStream_Event, Systray::OnStopStream)
+END_EVENT_TABLE()
+
 Systray::Systray( Interface *_p_main_interface )
 {
     p_main_interface = _p_main_interface;
@@ -1318,6 +1300,7 @@ Systray::Systray( Interface *_p_main_interface )
 void Systray::OnLeftClick( wxTaskBarIconEvent& event )
 {
     p_main_interface->Show( ! p_main_interface->IsShown() );
+    if ( p_main_interface->IsShown() ) p_main_interface->Raise();
 }
 
 void Systray::OnExit( wxCommandEvent& event )
@@ -1359,5 +1342,10 @@ wxMenu* Systray::CreatePopupMenu()
     systray_menu->Append( Iconize_Event, wxU(_("Show/Hide interface")) );
     return systray_menu;
 }
+
+void Systray::UpdateTooltip( const wxChar* tooltip )
+{
+    SetIcon( wxIcon( vlc16x16_xpm ), tooltip );
+}
 #endif
 
index 62ad84dd9db6e4ddbafe6dac3968991d31543e9b..1e1c4a284e691441526f44b16b7a3162707f2490 100644 (file)
@@ -137,6 +137,12 @@ void Timer::Notify()
                 wxU(p_intf->p_sys->p_input->input.p_item->psz_name), 2 );
 
             p_main_interface->TogglePlayButton( PLAYING_S );
+#ifdef wxHAS_TASK_BAR_ICON
+            if( p_main_interface->p_systray )
+            {
+                p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));
+            }
+#endif
             i_old_playing_status = PLAYING_S;
         }
     }
@@ -161,6 +167,12 @@ void Timer::Notify()
         p_main_interface->statusbar->SetStatusText( wxT(""), 0 );
         p_main_interface->statusbar->SetStatusText( wxT(""), 2 );
 
+#ifdef wxHAS_TASK_BAR_ICON
+        if( p_main_interface->p_systray )
+        {
+            p_main_interface->p_systray->UpdateTooltip( wxString(wxT("VLC media player - ")) + wxU(_("Stopped")) );
+        }
+#endif
         vlc_object_release( p_intf->p_sys->p_input );
         p_intf->p_sys->p_input = NULL;
     }
@@ -347,6 +359,19 @@ void Timer::Notify()
                 {
                     p_main_interface->TogglePlayButton( PLAYING_S );
                 }
+#ifdef wxHAS_TASK_BAR_ICON
+                if( p_main_interface->p_systray )
+                {
+                    if( val.i_int == PAUSE_S )
+                    {
+                        p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Paused")));
+                    }
+                    else
+                    {
+                        p_main_interface->p_systray->UpdateTooltip( wxU(p_intf->p_sys->p_input->input.p_item->psz_name) + wxString(wxT(" - ")) + wxU(_("Playing")));
+                    }
+                }
+#endif
                 i_old_playing_status = val.i_int;
             }
 
index 96d980a923a0bd76f1349d6b5fae36a5fe80d4ba..8cadcece5d33e4a464c9930e90f9e6ad8fa88182 100644 (file)
@@ -93,9 +93,6 @@ class DialogsProvider;
 class PrefsTreeCtrl;
 class AutoBuiltPanel;
 class VideoWindow;
-#ifdef wxHAS_TASK_BAR_ICON
-class Systray;
-#endif
 
 /*****************************************************************************
  * intf_sys_t: description and status of wxwindows interface
@@ -287,6 +284,28 @@ private:
 };
 #endif
 
+/* Systray integration */
+#ifdef wxHAS_TASK_BAR_ICON
+class Systray: public wxTaskBarIcon
+{
+public:
+    Systray( Interface* p_main_interface );
+    virtual ~Systray() {};
+    wxMenu* CreatePopupMenu();
+    void UpdateTooltip( const wxChar* tooltip );
+
+private:
+    void OnLeftClick( wxTaskBarIconEvent& event );
+    void OnPlayStream ( wxCommandEvent& event );
+    void OnStopStream ( wxCommandEvent& event );
+    void OnPrevStream ( wxCommandEvent& event );
+    void OnNextStream ( wxCommandEvent& event );
+    void OnExit(  wxCommandEvent& event );
+    Interface* p_main_interface;
+    DECLARE_EVENT_TABLE()
+};
+#endif
+
 /* Main Interface */
 class Interface: public wxFrame
 {