Example #1
0
CSize CSizableReBar::CalcFixedLayout( BOOL bStretch, BOOL bHorz )
{
//    ASSERT( bStretch ); // the bar is stretched (is not the child of a dockbar)

    REBARBANDINFO rbbi;
    rbbi.cbSize = sizeof( rbbi );
    rbbi.fMask  = RBBIM_CHILD | RBBIM_STYLE;

    for ( UINT nBand = 0; nBand < m_rbCtrl.GetBandCount(); nBand++ )
    {
        VERIFY( m_rbCtrl.GetBandInfo( nBand, &rbbi ) );

        CControlBar* pBar = DYNAMIC_DOWNCAST( CControlBar, CWnd::FromHandlePermanent( rbbi.hwndChild ) );
        BOOL bWindowVisible = ( pBar != 0 ) ? pBar->IsVisible() : ( ( ::GetWindowLong( rbbi.hwndChild, GWL_STYLE ) & WS_VISIBLE ) != 0 );
        BOOL bBandVisible = !( rbbi.fStyle & RBBS_HIDDEN );
        if ( bWindowVisible != bBandVisible )
        {
            VERIFY( m_rbCtrl.ShowBand( nBand, bWindowVisible ) );
        }
    }

    CRect rcReBar;
    m_rbCtrl.GetWindowRect( rcReBar );

    CSize szCurrent(
        (  bHorz && bStretch ) ? 32767 : rcReBar.Width(),
        ( !bHorz && bStretch ) ? 32767 : rcReBar.Height() );

    if ( m_dwStyle & CBRS_ORIENT_VERT )
    {
        if ( !m_bLocked && ( szCurrent.cx > 0 ) )
        {
            szCurrent.cx += m_cxEdge;
        }
    }

    if ( m_dwStyle & CBRS_ORIENT_HORZ )
    {
        if ( !m_bLocked && ( szCurrent.cy > 0 ) )
        {
            szCurrent.cy += m_cyEdge;
        }
    }

    return szCurrent;
}
Example #2
0
	void DirectoryWriter::RecursiveList(string szPath, bool bRecursive)
	{
		DirectoryReader* reader = new DirectoryReader();
		DIR* pDir = NULL;

		pDir = reader->open(szPath, pDir);
		
		struct dirent* pEnt = NULL;

		int count = 0;
		while (pEnt = readdir(pDir))
		{
			if (strcmp(pEnt->d_name, ".") == 0 || strcmp(pEnt->d_name, "..") == 0)
				continue;

			string szCurrent(szPath);
			szCurrent.append("/");
			szCurrent.append(pEnt->d_name);
			szCurrent = ConvertPath(szCurrent);
			if (reader->isDir(szCurrent))
			{
				if (bRecursive)
				{
					// not sure...
					//delete reader;
					RecursiveList(ConvertPath(szCurrent), true);
				}
			}
			if (reader->isFile(szCurrent))
			{
				vector<string> segments = vector<string>();
				string currentPath = ConvertPath(szCurrent);
				StrSplit(currentPath, segments);

				string path = "";
				vector<string>temp = segments;
				for (size_t i = 0; i < temp.size(); i++)
				{
					if (strcmp(temp[i].c_str(),"mapje")==0)
					{
						break;
					}
					else
					{
						segments.erase(segments.begin());
					}
				}

				for (size_t i = 0; i < segments.size(); i++)
				{
					path.append(segments[i]);
					if (i!=segments.size()-1)
					{
						path.append("/");
					}
				}

				time_t iLastModified = reader->getLastModifiedTime(szCurrent);
				WriteNode(pEnt->d_name, path, to_string(iLastModified));
			}
			count++;
		}
		
		closedir(pDir);
		delete reader;
	}