コード例 #1
0
void CSpritePage::SetState()
{
	m_SpriteTree.EnableWindow(m_View && !m_View->m_Playing);

	CBFrame* frame = NULL;
	if(m_View && m_View->m_Sprite->m_CurrentFrame >= 0 && m_View->m_Sprite->m_CurrentFrame < m_View->m_Sprite->m_Frames.GetSize())
		frame = m_View->m_Sprite->m_Frames[m_View->m_Sprite->m_CurrentFrame];

	m_FrameUp.EnableWindow(m_View && !m_View->m_Playing && m_View->m_Sprite->m_CurrentFrame > 0);
	m_FrameDown.EnableWindow(m_View && !m_View->m_Playing && m_View->m_Sprite->m_CurrentFrame < m_View->m_Sprite->m_Frames.GetSize()-1);

	m_SubframeUp.EnableWindow(frame && !m_View->m_Playing && frame->m_EditorExpanded && m_View->m_SelectedSubframe && m_View->m_SelectedSubframe!=frame->m_Subframes[0]);
	m_SubframeDown.EnableWindow(frame && !m_View->m_Playing && frame->m_EditorExpanded && m_View->m_SelectedSubframe && m_View->m_SelectedSubframe!=frame->m_Subframes[frame->m_Subframes.GetSize()-1]);

	m_AddFrame.EnableWindow(m_View &&!m_View->m_Playing);
	m_AddSubframe.EnableWindow(frame && !m_View->m_Playing);
	m_Looping.EnableWindow(frame && !m_View->m_Playing);


	if(m_View && m_View->m_Playing)
		SetupButton(&m_PlayStop, "Stop", IDB_STOP);
	else
		SetupButton(&m_PlayStop, "Play", IDB_PLAY);

	m_RemoveFrame.EnableWindow(m_View && !m_View->m_Playing && m_View->m_SelectedSubframe);

	m_PlayStop.EnableWindow(m_View && m_View->m_Sprite->m_Frames.GetSize()>0);
	m_FirstFrame.EnableWindow(m_View && !m_View->m_Playing && m_View->m_Sprite->m_CurrentFrame>0);
	m_LastFrame.EnableWindow(m_View && !m_View->m_Playing && m_View->m_Sprite->m_CurrentFrame>=0 && m_View->m_Sprite->m_CurrentFrame<m_View->m_Sprite->m_Frames.GetSize()-1);

	m_PrevFrame.EnableWindow(m_View && !m_View->m_Playing && m_View->m_Sprite->m_Frames.GetSize()>1);
	m_NextFrame.EnableWindow(m_View && !m_View->m_Playing && m_View->m_Sprite->m_Frames.GetSize()>1);
}
コード例 #2
0
ファイル: GUIDialogSelect.cpp プロジェクト: EternalStare/xbmc
void CGUIDialogSelect::OnInitWindow()
{
  m_viewControl.SetItems(*m_vecList);
  m_selectedItems->Clear();
  if (m_iSelected == -1)
  {
    for(int i = 0 ; i < m_vecList->Size(); i++)
    {
      if (m_vecList->Get(i)->IsSelected())
      {
        m_iSelected = i;
        break;
      }
    }
  }
  m_viewControl.SetCurrentView(m_useDetails ? CONTROL_DETAILS : CONTROL_LIST);

  CStdString items;
  items.Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str());
  SET_CONTROL_LABEL(CONTROL_NUMBEROFFILES, items);
  
  if (m_multiSelection)
    EnableButton(true, 186);

  SetupButton();
  CGUIDialogBoxBase::OnInitWindow();

  // if m_iSelected < 0 focus first item
  m_viewControl.SetSelectedItem(std::max(m_iSelected, 0));
}
コード例 #3
0
ファイル: GUIDialogSelect.cpp プロジェクト: krattai/sht_tv
void CGUIDialogSelect::OnInitWindow()
{
  m_viewControl.SetItems(*m_vecList);
  m_selectedItems.clear();
  for(int i = 0 ; i < m_vecList->Size(); i++)
  {
    auto item = m_vecList->Get(i);
    if (item->IsSelected())
    {
      m_selectedItems.push_back(i);
      if (m_selectedItem == nullptr)
        m_selectedItem = item;
    }
  }
  m_viewControl.SetCurrentView(m_useDetails ? CONTROL_DETAILS : CONTROL_LIST);

  std::string items = StringUtils::Format("%i %s", m_vecList->Size(), g_localizeStrings.Get(127).c_str());
  SET_CONTROL_LABEL(CONTROL_NUMBEROFFILES, items);
  
  if (m_multiSelection)
    EnableButton(true, 186);

  SetupButton();
  CGUIDialogBoxBase::OnInitWindow();

  // if nothing is selected, focus first item
  m_viewControl.SetSelectedItem(std::max(GetSelectedLabel(), 0));
}
コード例 #4
0
ファイル: GUIDialogSelect.cpp プロジェクト: EternalStare/xbmc
void CGUIDialogSelect::EnableButton(bool enable, int string)
{
  m_bButtonEnabled = enable;
  m_buttonString = string;

  if (IsActive())
    SetupButton();
}
コード例 #5
0
ファイル: FDCButton.cpp プロジェクト: naroya/freedownload
int CFDCButton::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
	if (CWnd::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	SetupButton ();
	
	return 0;
}
コード例 #6
0
void Windows7ThumbBar::ActionChanged() {
#ifdef Q_OS_WIN32
  if (!taskbar_list_)
    return;
  ITaskbarList3* taskbar_list = reinterpret_cast<ITaskbarList3*>(taskbar_list_);

  THUMBBUTTON buttons[kMaxButtonCount];
  for (int i=0 ; i<actions_.count() ; ++i) {
    const QAction* action = actions_[i];
    THUMBBUTTON* button = &buttons[i];

    button->iId = i;
    SetupButton(action, button);
    if (buttons->hIcon > 0)
      DestroyIcon(buttons->hIcon);
  }

  taskbar_list->ThumbBarUpdateButtons(widget_->winId(), actions_.count(), buttons);
#endif // Q_OS_WIN32
}
コード例 #7
0
BOOL CSoundPage::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	SetupButton(&m_Play, "Play/stop sound", IDB_PLAY);

	m_Events.m_nFlatStyle = CBCGButton::BUTTONSTYLE_SEMIFLAT;
	m_BrowseSound.m_nFlatStyle = CBCGButton::BUTTONSTYLE_SEMIFLAT;	
	m_Custom.m_nFlatStyle = CBCGButton::BUTTONSTYLE_SEMIFLAT;	
	m_Play.m_nFlatStyle = CBCGButton::BUTTONSTYLE_SEMIFLAT;	

	LOGFONT logFont;
	CFont* pFont = GetFont();
	pFont->GetLogFont(&logFont);
	logFont.lfWeight = FW_BOLD;
	m_BoldFont.CreateFontIndirect(&logFont);

	m_VolumeSpin.SetRange(0, 100);
	
	return TRUE;
}
コード例 #8
0
void Windows7ThumbBar::HandleWinEvent(MSG* msg) {
#ifdef Q_OS_WIN32
  if (button_created_message_id_ == 0) {
    // Compute the value for the TaskbarButtonCreated message
    button_created_message_id_ = RegisterWindowMessage("TaskbarButtonCreated");
    qLog(Debug) << "TaskbarButtonCreated message ID registered" << button_created_message_id_;
  }

  if (msg->message == button_created_message_id_) {
    HRESULT hr;
    qLog(Debug) << "Button created";
    // Unref the old taskbar list if we had one
    if (taskbar_list_) {
      qLog(Debug) << "Releasing old taskbar list";
      reinterpret_cast<ITaskbarList3*>(taskbar_list_)->Release();
      taskbar_list_ = NULL;
    }

    // Create the taskbar list
    hr = CoCreateInstance(CLSID_ITaskbarList, NULL, CLSCTX_ALL,
                         IID_ITaskbarList3, (void**) &taskbar_list_);
    if (hr != S_OK) {
      qLog(Warning) << "Error creating the ITaskbarList3 interface" << hex << DWORD (hr);
      return;
    }

    ITaskbarList3* taskbar_list = reinterpret_cast<ITaskbarList3*>(taskbar_list_);
    hr = taskbar_list->HrInit();
    if (hr != S_OK) {
      qLog(Warning) << "Error initialising taskbar list" << hex << DWORD (hr);
      taskbar_list->Release();
      taskbar_list_ = NULL;
      return;
    }

    // Add the buttons
    qLog(Debug) << "Initialising" << actions_.count() << "buttons";
    THUMBBUTTON buttons[kMaxButtonCount];
    for (int i=0 ; i<actions_.count() ; ++i) {
      const QAction* action = actions_[i];
      THUMBBUTTON* button = &buttons[i];
      button->iId = i;
      SetupButton(action, button);
    }

    qLog(Debug) << "Adding buttons";
    hr = taskbar_list->ThumbBarAddButtons(widget_->winId(), actions_.count(), buttons);
    if (hr != S_OK)
      qLog(Debug) << "Failed to add buttons" << hex << DWORD (hr);
    for (int i = 0; i < actions_.count(); i++) {
      if (buttons[i].hIcon > 0)
        DestroyIcon (buttons[i].hIcon);
    }
  } else if (msg->message == WM_COMMAND) {
    const int button_id = LOWORD(msg->wParam);

    if (button_id >= 0 && button_id < actions_.count()) {
      if (actions_[button_id]) {
        qLog(Debug) << "Button activated";
        actions_[button_id]->activate(QAction::Trigger);
      }
    }
  }
#endif // Q_OS_WIN32
}
コード例 #9
0
BOOL CSpritePage::OnInitDialog() 
{
	CDialog::OnInitDialog();
	

	SetupButton(&m_FrameUp,       "Frame up",         IDB_MOVE_UP);
	SetupButton(&m_FrameDown,     "Frame down",       IDB_MOVE_DOWN);
	SetupButton(&m_SubframeUp,    "Subframe up",      IDB_SUB_UP);
	SetupButton(&m_SubframeDown,  "Subframe down",    IDB_SUB_DOWN);
	SetupButton(&m_AddFrame,      "Add frame(s)",     IDB_NEW_FRAME);
	SetupButton(&m_AddSubframe,   "Add subframe",     IDB_NEW_SUBFRAME);
	SetupButton(&m_RemoveFrame,   "Remove frame",     IDB_BCGBARRES_DELETE);

	SetupButton(&m_FirstFrame,    "First frame",      IDB_FIRST_FRAME);
	SetupButton(&m_LastFrame,     "Last frame",       IDB_LAST_FRAME);
	SetupButton(&m_PrevFrame,     "Previous frame",   IDB_PREV_FRAME);
	SetupButton(&m_NextFrame,     "Next frame",       IDB_NEXT_FRAME);
	SetupButton(&m_PlayStop,      "Play",             IDB_PLAY);

	SetState();

	return TRUE;
}