예제 #1
0
void CuEditableListCtrlGenericDerived::EditValue (int iItem, int iSubItem, CRect rcCell)
{
	DERIVEDLINEINFO* lData = (DERIVEDLINEINFO*)GetItemData(iItem);
	if (!lData)
		return;
	if (iSubItem != 1 || iSubItem == 3)
		return;
	switch (lData->iunittype)
	{
	case GEN_LINE_TYPE_BOOL:
		break;
	case GEN_LINE_TYPE_NUM :
		SetEditNumber (iItem, iSubItem, rcCell);
		break;
	case GEN_LINE_TYPE_SPIN:
		SetEditSpin (iItem, iSubItem, rcCell);
		break;
	case GEN_LINE_TYPE_STRING:
		SetEditText   (iItem, iSubItem, rcCell);
		break;
	default:
		SetEditText   (iItem, iSubItem, rcCell);
		break;
	}
}
예제 #2
0
void CConfigRecord::OnKillfocusEdit(UINT nID) 
{
	// TODO: Add your control notification handler code here
	if (!m_bCheckEdit)
	{
		return;
	}
	
	UpdateData();
	
	int nNum = nID - IDC_EDIT_PRD1_S_HOUR;
	int nSect = nNum / 4;
	int nWitch = nNum % 4;
	
	BOOL bChange = FALSE;
	
	int nSectIndex = IDC_EDIT_PRD1_S_HOUR + nSect * 4;
	
	int StartHour = GetDlgItemInt(nSectIndex);
	int StartMin = GetDlgItemInt(nSectIndex + 1);
	int EndHour = GetDlgItemInt(nSectIndex + 2);
	int EndMin = GetDlgItemInt(nSectIndex + 3);

	if ( 0 == nWitch || 2 == nWitch )
	{
		if ( EndHour < StartHour )
		{
			EndHour = StartHour;
			bChange = TRUE;
		}
	}
	else
	{
		if ( StartHour == EndHour && EndMin < StartMin )
		{
			EndMin = StartMin;
			bChange = TRUE;
		}
	}
	
	if (bChange)
	{
		m_bCheckEdit = FALSE;
		SetEditText(nSectIndex, StartHour, "02");
		SetEditText(nSectIndex + 1, StartMin, "02");
		SetEditText(nSectIndex + 2, EndHour, "02");
		SetEditText(nSectIndex + 3, EndMin, "02");
		//((CEdit *)GetDlgItem(nID))->SetSel(0,2);
		((CEdit *)GetDlgItem(nID))->SetFocus();
	}
	m_bCheckEdit = TRUE;
}
예제 #3
0
void CGUIDialogKeyboardGeneric::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  m_bIsConfirmed = false;

  // set alphabetic (capitals)
  UpdateButtons();

  // set heading
  if (!m_strHeading.empty())
  {
    SET_CONTROL_LABEL(CTL_LABEL_HEADING, m_strHeading);
    SET_CONTROL_VISIBLE(CTL_LABEL_HEADING);
  }
  else
  {
    SET_CONTROL_HIDDEN(CTL_LABEL_HEADING);
  }
  // set type
  {
    CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CTL_EDIT, m_hiddenInput ? CGUIEditControl::INPUT_TYPE_PASSWORD : CGUIEditControl::INPUT_TYPE_TEXT);
    OnMessage(msg);
  }
  SetEditText(m_text);

  CVariant data;
  data["title"] = m_strHeading;
  data["type"] = !m_hiddenInput ? "keyboard" : "password";
  data["value"] = GetText();
  ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
예제 #4
0
static void LoadItem(HWND hWnd, PFolderItem item)
{
	if (!item)
		return;

	SetEditText(hWnd, item->GetFormat());
	RefreshPreview(hWnd);
}
예제 #5
0
int CALLBACK NameDlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
	HDC hdc,khdc;
	HBITMAP oldbmp,editbmp;
	PAINTSTRUCT paint;
	RECT rect;
	int x,y;
	switch(msg)
	{
	case WM_INITDIALOG:
		GetWindowRect(hWnd,&rect);
		x=GetSystemMetrics(SM_CXMAXIMIZED);
		y=GetSystemMetrics(SM_CYMAXIMIZED);
		MoveWindow(hWnd,(x-rect.right+rect.left)/2,(y-rect.bottom+rect.top)/2,rect.right-rect.left,rect.bottom-rect.top,TRUE);
		OldEditProc2 = (WNDPROC)SetWindowLong(GetDlgItem(hWnd,IDC_EDIT1),GWL_WNDPROC,(long)NewNoteProc);
		
		ShowWindow(hWnd,SW_SHOW);
		SetEditText(GetDlgItem(hWnd,IDC_EDIT1),changetype);
		break;
	case WM_CLOSE:
		
		EndDialog(hWnd,0);
		break;
	case WM_PAINT:
		hdc=BeginPaint(hWnd,&paint);
		GetClientRect(hWnd,&rect);
		editbmp = LoadBitmap(hin,MAKEINTRESOURCE(IDB_BITMAP2));		
		khdc = CreateCompatibleDC( hdc );
		oldbmp = (HBITMAP)SelectObject(khdc,(HGDIOBJ)editbmp);
		BitBlt(hdc,0,0,rect.right-rect.left,rect.bottom-rect.top,khdc,0,0,SRCCOPY);
		SelectObject(khdc,(HGDIOBJ)oldbmp);
		DeleteObject(khdc);
		DeleteObject((HGDIOBJ)editbmp);
		EndPaint(hWnd,&paint);
		break;
	case WM_CTLCOLOREDIT:
		hdc=(HDC)wParam;
		::SetBkMode(hdc,TRANSPARENT);
		SetTextColor(hdc,RGB(64,32,0));
		return (int)GetStockObject(HOLLOW_BRUSH);
	case WM_COMMAND:
		{
			switch(HIWORD(wParam))
			{
			case EN_VSCROLL:
			case EN_CHANGE:
				InvalidateRect((HWND)lParam,NULL,TRUE);
				DefWindowProc(hWnd,msg,wParam,lParam);
			}
		}
		break;
		
	}
	return 0;
}
void CGUIDialogKeyboardGeneric::OnInitWindow()
{
    CGUIDialog::OnInitWindow();

    m_bIsConfirmed = false;
    m_isKeyboardNavigationMode = false;

    // fill in the keyboard layouts
    m_currentLayout = 0;
    m_layouts.clear();
    const KeyboardLayouts& keyboardLayouts = CKeyboardLayoutManager::Get().GetLayouts();
    std::vector<CVariant> layoutNames = CSettings::Get().GetList("locale.keyboardlayouts");

    for (std::vector<CVariant>::const_iterator layoutName = layoutNames.begin(); layoutName != layoutNames.end(); ++layoutName)
    {
        KeyboardLayouts::const_iterator keyboardLayout = keyboardLayouts.find(layoutName->asString());
        if (keyboardLayout != keyboardLayouts.end())
            m_layouts.push_back(keyboardLayout->second);
    }

    // set alphabetic (capitals)
    UpdateButtons();

    // set heading
    if (!m_strHeading.empty())
    {
        SET_CONTROL_LABEL(CTL_LABEL_HEADING, m_strHeading);
        SET_CONTROL_VISIBLE(CTL_LABEL_HEADING);
    }
    else
    {
        SET_CONTROL_HIDDEN(CTL_LABEL_HEADING);
    }
    // set type
    {
        CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CTL_EDIT, m_hiddenInput ? CGUIEditControl::INPUT_TYPE_PASSWORD : CGUIEditControl::INPUT_TYPE_TEXT);
        OnMessage(msg);
    }
    SetEditText(m_text);

    CVariant data;
    data["title"] = m_strHeading;
    data["type"] = !m_hiddenInput ? "keyboard" : "password";
    data["value"] = GetText();
    ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
예제 #7
0
void CGUIDialogKeyboardGeneric::OnInitWindow()
{
  CGUIDialog::OnInitWindow();

  m_bIsConfirmed = false;

  // fill in the keyboard layouts
  m_currentLayout = 0;
  m_layouts.clear();
  std::vector<CKeyboardLayout> keyLayouts = CKeyboardLayout::LoadLayouts();
  const CSetting *setting = CSettings::Get().GetSetting("locale.keyboardlayouts");
  std::vector<std::string> layouts;
  if (setting)
    layouts = StringUtils::Split(setting->ToString(), '|');
  for (std::vector<CKeyboardLayout>::const_iterator j = keyLayouts.begin(); j != keyLayouts.end(); ++j)
  {
    if (std::find(layouts.begin(), layouts.end(), j->GetName()) != layouts.end())
      m_layouts.push_back(*j);
  }

  // set alphabetic (capitals)
  UpdateButtons();

  // set heading
  if (!m_strHeading.empty())
  {
    SET_CONTROL_LABEL(CTL_LABEL_HEADING, m_strHeading);
    SET_CONTROL_VISIBLE(CTL_LABEL_HEADING);
  }
  else
  {
    SET_CONTROL_HIDDEN(CTL_LABEL_HEADING);
  }
  // set type
  {
    CGUIMessage msg(GUI_MSG_SET_TYPE, GetID(), CTL_EDIT, m_hiddenInput ? CGUIEditControl::INPUT_TYPE_PASSWORD : CGUIEditControl::INPUT_TYPE_TEXT);
    OnMessage(msg);
  }
  SetEditText(m_text);

  CVariant data;
  data["title"] = m_strHeading;
  data["type"] = !m_hiddenInput ? "keyboard" : "password";
  data["value"] = GetText();
  ANNOUNCEMENT::CAnnouncementManager::Get().Announce(ANNOUNCEMENT::Input, "xbmc", "OnInputRequested", data);
}
예제 #8
0
BOOL CPagePosition::OnSetActive() 
{
   BOOL     b = CPositionDlgPageBase::OnSetActive();
   
   UncheckAll ();

   CButton  *pBut;

   if ((pBut = (CButton*)GetDlgItem (IDC_POSITION_NCH)) != NULL)
      pBut->SetCheck (1);

   if ((pBut = (CButton*)GetDlgItem (IDC_POSITION_NCV)) != NULL)
      pBut->SetCheck (1);
   
   SetEditText ();
   
   return b;
}
예제 #9
0
void CuEditableListCtrlComponent::OnOpenCellEditor(UINT nFlags, CPoint point) 
{
	int   index, iColumnNumber;
	int   iItem   = -1, iSubItem = -1;
	int   iNumMin = 0;
	int   iNumMax = UD_MAXVAL;
	CRect rect, rCell;
	UINT  flags;
	
	index = HitTest (point, &flags);
	if (index < 0)
		return;
	GetItemRect (index, rect, LVIR_BOUNDS);
	if (!GetCellRect (rect, point, rCell, iColumnNumber))
		return;

	rCell.top    -= 2;
	rCell.bottom += 2;

	// Emb Sept 24, 97: modify for preliminary test at low level side
	CuCbfListViewItem* pItemData = (CuCbfListViewItem*)GetItemData(index);
	LPCOMPONENTINFO lpComponentInfo = &pItemData->m_componentInfo;
	BOOL bCanEditName  = VCBFllCanNameBeEdited(lpComponentInfo);
	BOOL bCanEditCount = VCBFllCanCountBeEdited(lpComponentInfo);

	HideProperty();
	switch (iColumnNumber)
	{
	case 1:
		if (bCanEditName)
			SetEditText (index, iColumnNumber, rCell);
		else
			MessageBeep(MB_ICONEXCLAMATION);
		break;
	case 2:
		if (bCanEditCount)
			SetEditSpin (index, iColumnNumber, rCell, iNumMin, iNumMax);
		else
			MessageBeep(MB_ICONEXCLAMATION);
		break;
	default:
		break;
	}
}
void CGUIDialogKeyboardGeneric::OnIPAddress()
{
    // find any IP address in the current string if there is any
    // We match to #.#.#.#
    std::string text = GetText();
    std::string ip;
    CRegExp reg;
    reg.RegComp("[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+");
    int start = reg.RegFind(text.c_str());
    int length = 0;
    if (start > -1)
    {
        length = reg.GetSubLength(0);
        ip = text.substr(start, length);
    }
    else
        start = text.size();
    if (CGUIDialogNumeric::ShowAndGetIPAddress(ip, g_localizeStrings.Get(14068)))
        SetEditText(text.substr(0, start) + ip.c_str() + text.substr(start + length));
}
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& 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_LAYOUT:
            OnLayout();
            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:
            SetEditText("");
            break;
        case CTL_EDIT:
        {
            CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CTL_EDIT);
            OnMessage(msg);
            // update callback I guess?
            if (m_pCharCallback)
            {   // we did _something_, so make sure our search message filter is reset
                m_pCharCallback(this, msg.GetLabel());
            }
            m_text = msg.GetLabel();
            return true;
        }
        default:
            OnClickButton(iControl);
            break;
        }
    }
    break;

    case GUI_MSG_SET_TEXT:
    case GUI_MSG_INPUT_TEXT_EDIT:
    {
        // the edit control only handles these messages if it is either focues
        // or its specific control ID is set in the message. As neither is the
        // case here (focus is on one of the keyboard buttons) we have to force
        // the control ID of the message to the control ID of the edit control
        // (unfortunately we have to create a whole copy of the message object for that)
        CGUIMessage messageCopy(message.GetMessage(), message.GetSenderId(), CTL_EDIT, message.GetParam1(), message.GetParam2(), message.GetItem());
        messageCopy.SetLabel(message.GetLabel());

        // ensure this goes to the edit control
        CGUIControl *edit = GetControl(CTL_EDIT);
        if (edit)
            edit->OnMessage(messageCopy);

        // close the dialog if requested
        if (message.GetMessage() == GUI_MSG_SET_TEXT && message.GetParam1() > 0)
            OnOK();
        return true;
    }
    }

    return CGUIDialog::OnMessage(message);
}
예제 #12
0
static INT_PTR CALLBACK DlgProcOpts(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
	PFolderItem item;

	switch (msg) {
	case WM_INITDIALOG:
		lastItem = NULL;
		TranslateDialogDefault(hWnd);
		bInitializing = 1;
		LoadRegisteredFolderSections(hWnd);
		bInitializing = 0;
		break;

	case WM_COMMAND:
		switch (LOWORD(wParam)) {
		case IDC_FOLDER_EDIT:
			switch (HIWORD(wParam)) {
			case EN_CHANGE:
				RefreshPreview(hWnd);
				if (!bInitializing)
					SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0); //show the apply button.
			}
			break;

		case IDC_REFRESH_BUTTON:
			RefreshPreview(hWnd);
			break;

		case IDC_HELP_BUTTON:
			ShowWindow( CreateDialog(hInstance, MAKEINTRESOURCE(IDD_VARIABLES_HELP), hWnd, DlgProcVariables), SW_SHOW);
			break;

		case IDC_FOLDERS_SECTIONS_LIST:
			switch (HIWORD(wParam)) {
			case LBN_SELCHANGE:
				CheckForChanges(hWnd);
				LoadRegisteredFolderItems(hWnd);
				lastItem = NULL;
				SetEditText(hWnd, L"");
				RefreshPreview(hWnd);
			}
			break;

		case IDC_FOLDERS_ITEMS_LIST:
			switch (HIWORD(wParam)) {
			case LBN_SELCHANGE:
				item = GetSelectedItem(hWnd);
				if (item != NULL) {
					CheckForChanges(hWnd);
					LoadItem(hWnd, item);
				}
				lastItem = item;
			}
		}
		break;

	case WM_NOTIFY:
		switch(((LPNMHDR)lParam)->idFrom) {
		case 0:
			switch (((LPNMHDR)lParam)->code) {
			case PSN_APPLY:
				item = GetSelectedItem(hWnd);
				if (item) {
					SaveItem(hWnd, item, FALSE);
					LoadItem(hWnd, item);
				}

				for (int i=0; i < lstRegisteredFolders.getCount(); i++)
					lstRegisteredFolders[i].Save();
				CallPathChangedEvents();
			}
		}
		break;
	}

	return 0;
}
예제 #13
0
bool CGUIDialogKeyboardGeneric::OnMessage(CGUIMessage& 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:
        SetEditText("");
        break;
      case CTL_EDIT:
      {
        CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), CTL_EDIT);
        OnMessage(msg);
        // update callback I guess?
        if (m_pCharCallback)
        { // we did _something_, so make sure our search message filter is reset
          m_pCharCallback(this, msg.GetLabel());
        }
        m_text = msg.GetLabel();
        return true;
      }
      default:
        OnClickButton(iControl);
        break;
      }
    }
    break;

  case GUI_MSG_SET_TEXT:
  case GUI_MSG_INPUT_TEXT:
  case GUI_MSG_INPUT_TEXT_EDIT:
    {
      // ensure this goes to the edit control
      CGUIControl *edit = GetControl(CTL_EDIT);
      if (edit)
        edit->OnMessage(message);

      // close the dialog if requested
      if (message.GetMessage() == GUI_MSG_SET_TEXT && message.GetParam1() > 0)
        OnOK();
      return true;
    }
  }

  return CGUIDialog::OnMessage(message);
}
예제 #14
0
void CConfigRecord::SetEditText(UINT nID, int nText, CString strFormat)
{
	CString strText;
	strText.Format("%" + strFormat + "d", nText);
	SetEditText(nID, strText);
}
예제 #15
0
void CConfigRecord::SetEditText(UINT nID, double fText, CString strFormat)
{
	CString strText;
	strText.Format("%" + strFormat + "f", fText);
	SetEditText(nID, strText);
}