コード例 #1
0
ファイル: LotusNote.cpp プロジェクト: crespo2014/cpp-lib
DWORD CLotusNote::Item_GetAllListEntries(char *item_name, char *ptext, WORD max_size, WORD *text_size)
{
	//char		text[256];
	NOTE_ITEM	item;
	int			i;
	DWORD		dwr;
	char		*cptr;
	WORD		slen;
	dwr = ItemInfo(item_name,NULL,&item.type,NULL,&item.dwsize); if (dwr != ERR_OK) return dwr;
	cptr = ptext;
	if (item.type != TYPE_TEXT_LIST)
	{
		ItemGetText(item_name,ptext,max_size,text_size);
		cptr += strlen(ptext);
		cptr++;*cptr=0;
		return ERR_OK;
	}
	dwr = Item_GetTextListEntries(item_name,&item.count);		 if (dwr != ERR_OK) return dwr;
	for (i=0;i<item.count;i++)
	{
		Item_GetTextListEntry(item_name,i,cptr,max_size-(cptr-ptext),&slen);
		if (slen > max_size-(cptr-ptext)) return SetError(true,ERR_FATAL,"CLotusNote::Item_GetAllListEntries ... buffer so short");
		cptr += (slen+1);
	}
	*cptr = 0;
	if (text_size != NULL) *text_size = (cptr-ptext);
	return ERR_OK;
}
コード例 #2
0
ファイル: netcode.cpp プロジェクト: FerryT/OGO-2.3
void Sync(Player::Id pid)
{
	NodeID nid = nodes[pid];
	TeamInfo(nid);
	PlayerInfo(nid);
	StructInfo(nid);
	ItemInfo(nid);
}
コード例 #3
0
void
TBarWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kFindButton:
		{
			BMessenger tracker(kTrackerSignature);
			tracker.SendMessage(message);
			break;
		}

		case 'gloc':
			GetLocation(message);
			break;

		case 'sloc':
			SetLocation(message);
			break;

		case 'gexp':
			IsExpanded(message);
			break;

		case 'sexp':
			Expand(message);
			break;

		case 'info':
			ItemInfo(message);
			break;

		case 'exst':
			ItemExists(message);
			break;

		case 'cwnt':
			CountItems(message);
			break;

		case 'adon':
		case 'icon':
			AddItem(message);
			break;

		case 'remv':
			RemoveItem(message);
			break;

		case 'iloc':
			GetIconFrame(message);
			break;

		default:
			BWindow::MessageReceived(message);
			break;
	}
}
コード例 #4
0
ファイル: DirectoryWatcher.cpp プロジェクト: Moqi/uWebKit
	void scan(ItemInfoMap& entries)
	{
		DirectoryIterator it(owner().directory());
		DirectoryIterator end;
		while (it != end)
		{
			entries[it.path().getFileName()] = ItemInfo(*it);
			++it;
		}
	}
コード例 #5
0
void AutoSearchFrame::addItem(const AutoSearchPtr& as) {
	if (!as)
		return;
	auto ui = itemInfos.find(as->getToken());
	if (ui == itemInfos.end()) {
		auto x = itemInfos.emplace(as->getToken(), ItemInfo(as)).first;
		ctrlAutoSearch.SetRedraw(FALSE);
		addListEntry(&x->second);
		ctrlAutoSearch.resort();
		ctrlAutoSearch.SetRedraw(TRUE);
	}
}
コード例 #6
0
//--------------------------------
void LevelPackInfo::init()
{
  score = localScore = 0;
  level = 1;

  //time_bonus = speed_bonus = score_bonus = 0;
  //speed_mag_bonus = 2;

  //next_tool = 2;
  activeToolIndex = 0;

  longest_chain = 3;
  toolScore = 0;

  for (int i = 0; i < items.count(); i++)
    items[i] = ItemInfo();
}
コード例 #7
0
ファイル: netcode.cpp プロジェクト: FerryT/OGO-2.3
RECEIVE(ENTER, id, msg, reliable)
{
	if (!tokenring->authorized()) return;
	unsigned char team = (unsigned char) (long) msg[1];
	string name = msg[2];
	
	Player::Id pid = game.topId++;
	ObjectHandle player = Player(pid, team, name);
	game.root->children.insert(player);
	game.players[pid] = player;
	nodes[id] = pid;
	
	Welcome(pid);
	
	// Send game state
	TeamInfo(id);
	PlayerInfo(id);
	StructInfo(id);
	ItemInfo(id);
	
	Join(findNode(pid), pid, team, name);
}
コード例 #8
0
	void MenuControl::_wrapItem(MenuItem* _item, size_t _index, const UString& _name, MenuItemType _type, const std::string& _id, Any _data)
	{
		_item->setAlign(mVerticalAlignment ? Align::Top | Align::HStretch : Align::Default);
		_item->eventRootKeyChangeFocus += newDelegate(this, &MenuControl::notifyRootKeyChangeFocus);
		_item->eventMouseButtonClick += newDelegate(this, &MenuControl::notifyMouseButtonClick);
		_item->eventMouseSetFocus += newDelegate(this, &MenuControl::notifyMouseSetFocus);

		_item->setImageName(getIconIndexByType(_type ));

		MenuControl* submenu = nullptr;

		ItemInfo info = ItemInfo(_item, _name, _type, submenu, _id, _data);

		mItemsInfo.insert(mItemsInfo.begin() + _index, info);

		mChangeChildSkin = true;
		_item->changeWidgetSkin(getSkinByType(_type));
		mChangeChildSkin = false;

		// его сет капшен, обновит размер
		_item->setCaption(_name);

		update();
	}
コード例 #9
0
ファイル: sv_repositories.cpp プロジェクト: breton75/niirpi
bool SvRepositories::readRepositories()
{
  
  QSqlQuery* q = new QSqlQuery(SQLITE->db);
  
  try {
    
    // rootItem создается при создании объекта модели
    // кол-во столбцов задается TREE_HEADERS и должно соответствовать кол-ву полей в таблице sensors
    TreeItem *root = _model->rootItem();

    int child_count = root->childCount();
    int column_count = root->columnCount();
    
    for(int i = 0; i < column_count; i++)
      root->setInfo(i, ItemInfo());
    
    
    QSqlError serr = SQLITE->execSQL(SQL_SELECT_REPOSITORIES_LIST, q);
    
    if(serr.type() != QSqlError::NoError) _exception.raise(serr.text());
    
    // заполняем модель выбранными данными
    while(q->next()) { 
      
      child_count = root->childCount();
      
      root->insertChildren(child_count, 1, column_count);

      root->child(child_count)->id = q->value("repository_id").toInt();
      root->child(child_count)->parent_id = root->id;
      root->child(child_count)->is_main_row = false;
//        root->child(child_count)->item_state = q->value("last_state").toInt();
      root->child(child_count)->item_type = itRepository;

      root->child(child_count)->setData(0, q->value("repository_name"));
      root->child(child_count)->setInfo(0, ItemInfo(itRepositoryName, "repository_name"));
      
      root->child(child_count)->setData(1, q->value("repository_host"));
      root->child(child_count)->setInfo(1, ItemInfo(itRepositoryHost, "repository_host"));
      
      root->child(child_count)->setData(2, q->value("repository_port"));
      root->child(child_count)->setInfo(2, ItemInfo(itRepositoryPort, "repository_port"));\
      
      root->child(child_count)->setData(3, q->value("repository_login"));
      root->child(child_count)->setInfo(3, ItemInfo(itRepositoryLogin, "repository_login"));
      
      root->child(child_count)->setData(4, q->value("repository_dbname"));
      root->child(child_count)->setInfo(4, ItemInfo(itRepositoryDBName, "repository_dbname"));
      
      root->child(child_count)->setData(5, q->value("repository_table_name"));
      root->child(child_count)->setInfo(5, ItemInfo(itRepositoryTableName, "repository_table_name"));

    }
    q->finish();
    
    return true;
    
  }
  
  catch(SvException& e) {
    
    delete q;
    _log << svlog::Time << svlog::Critical << e.error << svlog::endl;
    return false;
    
  }

}
コード例 #10
0
ファイル: BarWindow.cpp プロジェクト: looncraz/haiku
void
TBarWindow::MessageReceived(BMessage* message)
{
	switch (message->what) {
		case kFindButton:
		{
			BMessenger tracker(kTrackerSignature);
			tracker.SendMessage(message);
			break;
		}

		case kMsgLocation:
			GetLocation(message);
			break;

		case kMsgSetLocation:
			SetLocation(message);
			break;

		case kMsgIsExpanded:
			IsExpanded(message);
			break;

		case kMsgExpand:
			Expand(message);
			break;

		case kMsgGetItemInfo:
			ItemInfo(message);
			break;

		case kMsgHasItem:
			ItemExists(message);
			break;

		case kMsgCountItems:
			CountItems(message);
			break;

		case kMsgMaxItemSize:
			MaxItemSize(message);
			break;

		case kMsgAddAddOn:
		case kMsgAddView:
			AddItem(message);
			break;

		case kMsgRemoveItem:
			RemoveItem(message);
			break;

		case 'iloc':
			GetIconFrame(message);
			break;

		default:
			BWindow::MessageReceived(message);
			break;
	}
}
コード例 #11
0
// ---------------------------------------------------------------------------
// CAppMngr2ListContainer::PopulateItemArrayL()
// ---------------------------------------------------------------------------
//
void CAppMngr2ListContainer::PopulateItemArrayL()
    {
    FLOG( "CAppMngr2ListContainer::PopulateItemArrayL()" );
    
    CArrayPtr<CGulIcon>* iconArray = iListBox->ItemDrawer()->ColumnData()->IconArray();
    DeleteItemSpecificIcons( *iconArray );
    
    TInt count = ItemCount();
    for( TInt index = 0; index < count; index++ )
        {
        const CAppMngr2InfoBase& appInfo = ItemInfo( index );

        // Get name and details
        TPtrC name = appInfo.Name();
        TPtrC size = appInfo.Details();

        // Get icon indexes that plugin loaded in LoadIconsL()
        TInt iconIndexBase;
        TInt iconIndexMax;
        Model().GetIconIndexesL( appInfo.Runtime().RuntimeUid(),
                iconIndexBase, iconIndexMax );
        
        // Get list icon index from plugin
        TInt iconIndex = appInfo.IconIndex();
        
        // Convert index into the range of 0 .. (icons - 1)
        if( iconIndex == EAppMngr2UseSpecificIcon )
            {
            CGulIcon* icon = NULL;
            TRAP_IGNORE( icon = appInfo.SpecificIconL() );
            if( icon )
                {
                CleanupStack::PushL( icon );
                iconIndex = iconArray->Count();
                iconArray->AppendL( icon );
                CleanupStack::Pop( icon );
                iItemSpecificIcons++;
                }
            else
                {
                iconIndex = EAppMngr2IconIndex_QgnPropUnknown;
                }
            }
        else
            {
            // There are no default list icons that plugins could use, so
            // this must be list icon that plugin has loaded in LoadIconsL().
            // Icons (of this plugin) are indexed from iconIndexBase.
            iconIndex += iconIndexBase;

            // Plugin should use only those icons it has provided. Use
            // default unknown icon if plugin tries to use icons that
            // another plugin has loaded.
            if( iconIndex < iconIndexBase || iconIndex >= iconIndexMax )
                {
                iconIndex = EAppMngr2IconIndex_QgnPropUnknown;
                }
            }
        // Sanity check - index must be in range, otherwise list panics 
        if( iconIndex < 0 || iconIndex >= iconArray->Count() )
            {
            iconIndex = EAppMngr2IconIndex_QgnPropUnknown;
            }

        // Get indicator icon index from plugin
        TInt indIconIndex = appInfo.IndicatorIconIndex();
        
        // Convert indicator icon index into the range of 0 .. (icons-1) or
        // leave special value EAppMngr2NoIndicatorIcon in it
        if( indIconIndex == EAppMngr2UseSpecificIcon )
            {
            CGulIcon* icon = NULL;
            TRAP_IGNORE( icon = appInfo.SpecificIndicatorIconL() );
            if( icon )
                {
                CleanupStack::PushL( icon );
                indIconIndex = iconArray->Count();
                iconArray->AppendL( icon );
                CleanupStack::Pop( icon );
                iItemSpecificIcons++;
                }
            else
                {
                indIconIndex = EAppMngr2NoIndicatorIcon;
                }
            }
        else
            {
            // EAppMngr2NoIndicatorIcon is special value that is handled later
            if( indIconIndex != EAppMngr2NoIndicatorIcon )
                {
                // Default icon indexes (starting from EAppMngr2NoIndicatorIcon) are
                // all above the icon index range reserved for plugins
                if( indIconIndex > EAppMngr2NoIndicatorIcon )
                    {
                    // Use default icons, indexes start from zero
                    indIconIndex -= ( EAppMngr2NoIndicatorIcon + 1 );
                    }
                else
                    {
                    // Use item specific icons, indexes start from iconIndexBase
                    indIconIndex += iconIndexBase;
                    }
                }
            }
        // Sanity check - icon index must be in range, otherwise list panics
        if( ( indIconIndex != EAppMngr2NoIndicatorIcon ) &&
                ( indIconIndex < 0 || indIconIndex >= iconArray->Count() ) )
            {
            indIconIndex = EAppMngr2NoIndicatorIcon;
            }

        // Construct line to be displayed
        HBufC* temp = HBufC::NewLC( name.Length() + size.Length() + KSpaceForTabsAndIconIndexes );
        TPtr line = temp->Des();
        if( indIconIndex == EAppMngr2NoIndicatorIcon )
            {
            line.AppendFormat( KItemFormatNoInd, iconIndex, &name, &size );
            }
        else
            {
            line.AppendFormat( KItemFormatFull, iconIndex, &name, &size, indIconIndex );
            }
        iItemArray->AppendL( line );
        FLOG( "CAppMngr2ListContainer::PopulateItemArrayL(): %S", temp );
        CleanupStack::PopAndDestroy( temp );
        }
    }
コード例 #12
0
LRESULT AutoSearchFrame::onCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled) {
	
	CreateSimpleStatusBar(ATL_IDS_IDLEMESSAGE, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | SBARS_SIZEGRIP);
	ctrlStatus.Attach(m_hWndStatusBar);

	ctrlAutoSearch.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | 
		WS_HSCROLL | WS_VSCROLL | LVS_REPORT | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS, WS_EX_CLIENTEDGE, IDC_AUTOSEARCH);
	ctrlAutoSearch.SetExtendedListViewStyle(LVS_EX_LABELTIP | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES | LVS_EX_HEADERDRAGDROP | LVS_EX_DOUBLEBUFFER | LVS_EX_INFOTIP);	
	ctrlAutoSearch.SetBkColor(WinUtil::bgColor);
	ctrlAutoSearch.SetTextBkColor(WinUtil::bgColor);
	ctrlAutoSearch.SetTextColor(WinUtil::textColor);

	// Insert columns
	WinUtil::splitTokens(columnIndexes, SETTING(AUTOSEARCHFRAME_ORDER), COLUMN_LAST);
	WinUtil::splitTokens(columnSizes, SETTING(AUTOSEARCHFRAME_WIDTHS), COLUMN_LAST);
	
	for(int j=0; j<COLUMN_LAST; j++) {
		int fmt = LVCFMT_LEFT;
		ctrlAutoSearch.InsertColumn(j, CTSTRING_I(columnNames[j]), fmt, columnSizes[j], j);
	}
	
	ctrlAutoSearch.SetColumnOrderArray(COLUMN_LAST, columnIndexes);
	ctrlAutoSearch.SetImageList(ResourceLoader::getAutoSearchStatuses(), LVSIL_SMALL);
	ctrlAutoSearch.setVisible(SETTING(AUTOSEARCHFRAME_VISIBLE));
	ctrlAutoSearch.setSortColumn(COLUMN_VALUE);

		//create buttons
	ctrlAdd.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
		BS_PUSHBUTTON , 0, IDC_ADD);
	ctrlAdd.SetWindowText(CTSTRING(ADD));
	ctrlAdd.SetFont(WinUtil::systemFont);

	ctrlRemove.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
		BS_PUSHBUTTON , 0, IDC_REMOVE);
	ctrlRemove.SetWindowText(CTSTRING(REMOVE));
	ctrlRemove.SetFont(WinUtil::systemFont);

	ctrlChange.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
		BS_PUSHBUTTON , 0, IDC_CHANGE);
	ctrlChange.SetWindowText(CTSTRING(SETTINGS_CHANGE));
	ctrlChange.SetFont(WinUtil::systemFont);

	ctrlDuplicate.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
		BS_PUSHBUTTON , 0, IDC_DUPLICATE);
	ctrlDuplicate.SetWindowText(CTSTRING(DUPLICATE));
	ctrlDuplicate.SetFont(WinUtil::systemFont);

	ctrlManageGroups.Create(m_hWnd, rcDefault, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN |
		BS_PUSHBUTTON, 0, IDC_MANAGE_GROUPS);
	ctrlManageGroups.SetWindowText(CTSTRING(MANAGE_GROUPS));
	ctrlManageGroups.SetFont(WinUtil::systemFont);

	AutoSearchManager::getInstance()->addListener(this);
	SettingsManager::getInstance()->addListener(this);

	{
		//Create itemInfos
		RLock l(AutoSearchManager::getInstance()->getCS());
		auto& lst = AutoSearchManager::getInstance()->getSearchItems();
		for (auto as : lst | map_values) {
			itemInfos.emplace(as->getToken(), ItemInfo(as, false));
		}
	}
	//fill the list
	callAsync([=] { updateList(); });

	WinUtil::SetIcon(m_hWnd, IDI_AUTOSEARCH);
	::SetTimer(m_hWnd, 0, 1000, 0);

	memzero(statusSizes, sizeof(statusSizes));
	statusSizes[0] = 16;
	ctrlStatus.SetParts(5, statusSizes);

	loading = false;
	bHandled = FALSE;
	return TRUE;

}