Exemple #1
0
/** Signal the tray (needed for autohide). */
void SignalTray(const TimeType *now, int x, int y, Window w, void *data)
{
   TrayType *tp = (TrayType*)data;
   if(tp->autoHide != THIDE_OFF && !tp->hidden && !menuShown) {
      if(x < tp->x || x >= tp->x + tp->width
         || y < tp->y || y >= tp->y + tp->height) {
         HideTray(tp);
      }
   }
}
Exemple #2
0
/** Signal the tray (needed for autohide). */
void SignalTray(const TimeType *now, int x, int y) {

   TrayType *tp;

   for(tp = trays; tp; tp = tp->next) {
      if(tp->autoHide && !tp->hidden && !menuShown) {
         if(x < tp->x || x >= tp->x + tp->width
            || y < tp->y || y >= tp->y + tp->height) {
            HideTray(tp);
         }
      }
   }

}
void CTeenSpiritDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
	PrgAPI* pAPI = PRGAPI();
	int nnID = nID & 0xFFF0;
	//static LONG s_normalStyle = 0;
	switch (nnID)
	{
	case IDM_SHOWMINIPLAYER:
		pAPI->GetMiniPlayerDlg(TRUE)->Show();
		break;
	case IDM_ABOUTBOX:
		pAPI->GetActionManager()->ShowAboutDlg(this);
		break;
	case SC_MINIMIZE:
		CDialog::OnSysCommand(nID, lParam);
		if (pAPI->GetOption(OPT_GEN_MinimizeToTray))
		{
			ShowTray();
			ShowWindow(SW_HIDE);
		}
		if (pAPI->GetOption(OPT_MINIPLR_Automatic) == 1)//Automatic
			pAPI->GetMiniPlayerDlg(TRUE)->Show();
		break;
	case SC_MAXIMIZE:
		{
			CRect rc;
			GetWindowRect(&rc);
			MaximizeWindow(rc);
			if (pAPI->GetOption(OPT_MINIPLR_Automatic) == 1)//Automatic
			{
				CMiniPlayerDlg* pMPDlg = pAPI->GetMiniPlayerDlg(FALSE);
				if (pMPDlg != NULL)
					pMPDlg->Hide();
			}
		}
		break;
	case SC_RESTORE:
		{
			DWORD style = GetWindowLong(GetSafeHwnd(), GWL_STYLE);
			if ((style & WS_VISIBLE) == WS_VISIBLE)
			{
				ModifyStyle(0, WS_OVERLAPPEDWINDOW, 0);
				CDialog::OnSysCommand(nID, lParam);
			}
			else
			{
				HideTray();
				WINDOWPLACEMENT wp;
				GetWindowPlacement(&wp);
				if ((wp.flags & WPF_RESTORETOMAXIMIZED) == WPF_RESTORETOMAXIMIZED)
					MaximizeWindow(wp.rcNormalPosition);
				else
					ShowWindow(SW_RESTORE);
				if (pAPI->GetOption(OPT_MINIPLR_Automatic) == 1)//Automatic
				{
					CMiniPlayerDlg* pMPDlg = pAPI->GetMiniPlayerDlg(FALSE);
					if (pMPDlg != NULL)
						pMPDlg->Hide();
				}
			}
			SetForegroundWindow();
			UpdateWindow();
			Invalidate(TRUE);
			if (pAPI->GetOption(OPT_MINIPLR_Automatic) == 1)//Automatic
			{
				CMiniPlayerDlg* pMPDlg = pAPI->GetMiniPlayerDlg(FALSE);
				if (pMPDlg != NULL)
					pMPDlg->Hide();
			}

		}
		break;
	default:
		//if (nID == MENU_ToggleMiniPlayer)
		//	pAPI->GetActionManager()->ShowMiniPlayer(!pAPI->GetActionManager()->IsMiniPlayerVisible());
		//else
			CDialog::OnSysCommand(nID, lParam);
	}
}
Exemple #4
0
/** Resize a tray. */
void ResizeTray(TrayType *tp)
{

   TrayComponentType *cp;
   int variableSize;
   int variableRemainder;
   int xoffset, yoffset;
   int width, height;

   Assert(tp);

   LayoutTray(tp, &variableSize, &variableRemainder);

   /* Reposition items on the tray. */
   xoffset = 0;
   yoffset = 0;
   for(cp = tp->components; cp; cp = cp->next) {

      cp->x = xoffset;
      cp->y = yoffset;
      cp->screenx = tp->x + xoffset;
      cp->screeny = tp->y + yoffset;

      if(cp->Resize) {
         if(tp->layout == LAYOUT_HORIZONTAL) {
            height = tp->height;
            width = cp->width;
            if(width == 0) {
               width = variableSize;
               if(variableRemainder) {
                  width += 1;
                  variableRemainder -= 1;
               }
            }
         } else {
            width = tp->width;
            height = cp->height;
            if(height == 0) {
               height = variableSize;
               if(variableRemainder) {
                  height += 1;
                  variableRemainder -= 1;
               }
            }
         }
         cp->width = width;
         cp->height = height;
         (cp->Resize)(cp);
      }

      if(cp->window != None) {
         JXMoveWindow(display, cp->window, xoffset, yoffset);
      }

      if(tp->layout == LAYOUT_HORIZONTAL) {
         xoffset += cp->width;
      } else {
         yoffset += cp->height;
      }
   }

   JXMoveResizeWindow(display, tp->window, tp->x, tp->y,
                      tp->width, tp->height);

   RequireTaskUpdate();
   DrawSpecificTray(tp);

   if(tp->hidden) {
      HideTray(tp);
   }

}