Example #1
0
void CView::OnSize(wxSizeEvent&)
{
	wxSize size = GetClientSize();
	wxRect rect(size);

	Arrange(m_pHeader, rect, true);
	Arrange(m_pFooter, rect, false);
	Arrange(m_pStatusBar, rect, false);

	if (m_pWnd) {
		m_pWnd->SetSize(rect);
	}
}
Example #2
0
// called when either the window size changed (as a result
// of WM_SIZE) or when the content of the window changes
void HwndWrapper::TopLevelLayout()
{
    CrashIf(!hwndParent);
    ClientRect rc(hwndParent);
    Size availableSize(rc.dx, rc.dy);
    //lf("(%3d,%3d) HwndWrapper::TopLevelLayout()", rc.dx, rc.dy);
    Size s = Measure(availableSize);

    if (firstLayout && sizeToFit) {
        firstLayout = false;
        desiredSize = s;
        ResizeHwndToClientArea(hwndParent, s.Width, s.Height, false);
    } else {
        desiredSize = availableSize;
        Rect r(0, 0, availableSize.Width, availableSize.Height);
        SetPosition(r);
        if (centerContent) {
            int n = availableSize.Width - s.Width;
            if (n > 0) {
                r.X = n / 2;
                r.Width = s.Width;
            }
            n = availableSize.Height - s.Height;
            if (n > 0) {
                r.Y = n / 2;
                r.Height = s.Height;
            }
        }
        Arrange(r);
    }
    layoutRequested = false;
}
void CXTPMarkupUIElement::InvalidateMeasureOverride(CXTPMarkupDrawingContext* pDC)
{
	if (!m_bMeasureInProgress && !m_bNeverMeasured)
	{
		m_bMeasureDirty = TRUE;
		m_bArrangeDirty = TRUE;

		CSize sz = GetDesiredSize();

		Measure(pDC, m_szPreviousAvailableSize);

		if (sz != GetDesiredSize())
		{
			m_bMeasureDirty = TRUE;
			m_bArrangeDirty = TRUE;

			CXTPMarkupUIElement* pParent = MARKUP_DYNAMICCAST(CXTPMarkupUIElement, GetVisualParent());
			if (pParent)
			{
				pParent->InvalidateMeasureOverride(pDC);
			}
			else if (m_pMarkupContext)
			{
				m_pMarkupContext->OnInvalidateArrange(this);
			}
		}
		else
		{
			Arrange(m_rcFinalRect);
			InvalidateVisual();
		}
	}
}
Example #4
0
BOOL CFolderListCtrl::SetViewType( FLViewType vt )
{
	if( vt == m_flvtViewType )
		return TRUE;

	if( m_ListStyles[m_flvtViewType] != m_ListStyles[vt] )
		if( !ModifyStyle( m_ListStyles[m_flvtViewType], m_ListStyles[vt], SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER ) )
			return FALSE;
	switch( vt )
	{
		case flvtThumbnail:
			SetImageList( m_pimlThumbnails, LVSIL_NORMAL );
			break;
		case flvtLargeIcon:
			SetImageList( &m_imlLargeIcons, LVSIL_NORMAL );
			break;
	case flvtSmallIcon: break;
	case flvtList: break;
	case flvtDetails: break;
	case flvtSize: break;
	default: break;
	}
	m_flvtViewType = vt;

	for( int i = GetItemCount() - 1; i >= 0; i-- )
		SetValidItemImage( i );
	SortItems( m_flciColumns[m_nCurColumn].m_fnCmp, m_bSortAscending );
	Arrange( LVA_DEFAULT );

	return TRUE;
}
Example #5
0
BOOL MyListCtrl::init()
{
	//Create Image list. 
	
	m_ImageListThumb.DeleteImageList();
	m_IconWidth=2;
	m_IconHeight=27;
	m_ImageListThumb.Create(m_IconWidth, m_IconHeight, ILC_COLOR24, 0, 1);
	SetImageList(&m_ImageListThumb, LVSIL_SMALL);
	m_ShowIcons=FALSE;
	Arrange(LVSCW_AUTOSIZE);
	//LVSCW_AUTOSIZE
	FreeListItems();
	
	// For the resize problem...... 
	m_iNumberOfColumns=2;
	m_iColumnWidthArray[0]=60;
	m_iColumnWidthArray[1]=40;
	m_iColumnWidthArray[2]=110;
	m_iColumnWidthArray[3]=100;
	
	
	
	InsertColumn(0,"Name",LVCFMT_LEFT,m_iColumnWidthArray[0]);
	InsertColumn(1,"Address",LVCFMT_LEFT,m_iColumnWidthArray[1]);
	// nice flat list-  	
	SetExtendedStyle(LVS_EX_GRIDLINES | LVS_EX_FLATSB |
		LVS_EX_FULLROWSELECT );
	
	
	//
	// Setting the header INFO
	//
	
	// Loading header images.. 
	m_HeaderImages.DeleteImageList();
	m_HeaderImages.Create(IDB_HEADER, 9*2, 1, RGB(255,255,255));
	
	CHeaderCtrl* pHeader=GetHeaderCtrl();
	if(pHeader)
	{
		
		pHeader->SetImageList(&m_HeaderImages);
		
		for (int i=0; i < pHeader->GetItemCount(); i++)
		{
			SetHeaderIcon(i,-1);
		}
		
		SetBkColor(RGB(255,255,255));
		SetTextBkColor(RGB(255,255,255));
		SetTextColor(RGB(0,0,0));
		SetHeaderIcon(0,0);
		m_iCurrentSortColumn=0;
    }
	
	ResizeColumns();
	
	return TRUE;
}
Example #6
0
void AlbumView::FrameResized(float width, float height)
{
	if (fColumns == 0)
		Arrange(true);
	UpdateScrollbars(width, height);
	
	// update the splash message
	if (CountItems() == 0)
		Invalidate();	
}
Example #7
0
void AlbumView::DeleteSelected()
{
	AlbumItem *item = NULL;
	for  (int i = CountItems()-1; (item = ItemAt(i)); i--)
		if (item->IsSelected())
			fItems.RemoveItem(item, true);
	
	Arrange(false);
	Invalidate();
}
void CXTPMarkupUIElement::InvalidateArrange()
{
	if (!m_bArrangeInProgress && !m_bNeverArranged)
	{
		m_bArrangeDirty = TRUE;

		Arrange(m_rcFinalRect);
		InvalidateVisual();
	}
}
Example #9
0
void main()
{
  RedType d[N]={{49,1},{38,2},{65,3},{97,4},{76,5},{13,6},{27,7},{49,8}};
  SLinkListType l1;
  int *adr,i;
  TableInsert(&l1,d,N);
  printf("排序前:\n");
  print(l1);
  Arrange(&l1);
  printf("l1排序后:\n");
  print(l1);
}
Example #10
0
 void main()
 {
   RedType d[N]={{49,1},{38,2},{65,3},{97,4},{76,5},{13,6},{27,7},{49,8}};
   SLinkListType l1,l2;
   int *adr,i;
   TableInsert(&l1,d,N);
   l2=l1; /* 复制静态链表l2与l1相同 */
   printf("排序前:\n");
   print(l1);
   Arrange(&l1);
   printf("l1排序后:\n");
   print(l1);
   adr=(int*)malloc((l2.length+1)*sizeof(int));
   Sort(l2,adr);
   for(i=1;i<=l2.length;i++)
     printf("adr[%d]=%d ",i,adr[i]);
   printf("\n");
   Rearrange(&l2,adr);
   printf("l2排序后:\n");
   print(l2);
 }
Example #11
0
/**
	Sets visibility mask.
	Only items with Flags() bits in Mask() are visible. 	
*/
void AlbumView::SetMask(uint32 mask)
{
	fMask = mask;
	Arrange(false);
	Invalidate();
}
Example #12
0
void AlbumView::SetColumns(int16 cols)
{
	fColumns = cols;
	Arrange(false);
	Invalidate();
}
Example #13
0
/**
	Uses app_server for actual scaling.
*/
void AlbumView::SetZoom(float scale)
{
	fZoom = scale;
	Arrange(false);
	Invalidate();
}
Example #14
0
/**
	Arranges children.	
*/
void SplitView::AllAttached()
{
	Arrange();
}
Example #15
0
void DisplayCanvas::OnKeyPress(wxKeyEvent& event)
{
    //wxMessageBox(wxT(" You pressed a key "),wxT("Bravoo "));

    int Key = event.GetUnicodeKey();
    if(Key == 13)
    {
        //wxMessageBox(wxT(" You pressed enter "),wxT(" Ain't that great ??"));
        ShuffleCards();
        Scrambled = true;
    }
    else if (Key >= '1' and Key <= '9')
    {
        ActiveCard = Key - '1';
        //wxMessageBox(wxT("And yo pressed one "),wxT(" that's great "));
    }
    else if(Key == 'f' or Key == 'F')
	{
		Flipped = (Flipped ? false : true);
	}
	else if(Key == 'u' or Key == 'U')
	{
		//wxMessageBox(wxT(" Unscrambling trying now "),wxT(" Tyring tto unscrambe"));
		if(Scrambled){
				//wxMessageBox(wxT(" Unscrambling now "),wxT(" Tyring to unscrambe"));

                Scrambled = false;
                Arrange(Card,Image);
				//wxMessageBox(wxT(" Unscrambling done"),wxT(" done"));
            }
	}
	else if(Key == 'r' or Key == 'R')
	{
		BackId = (BackId ? 0 : 1);
	}
    switch(event.GetKeyCode())
    {
    case WXK_LEFT:
        if(ActiveCard<8 && ActiveCard>=0)
        {
            tmp=Card[ActiveCard];
            Card[ActiveCard]=Card[ActiveCard+1];
            Card[ActiveCard+1]=tmp;
            ActiveCard++;
        }
        break;
    case WXK_RIGHT:
        if(ActiveCard>0)
        {
            tmp=Card[ActiveCard];
            Card[ActiveCard]=Card[ActiveCard-1];
            Card[ActiveCard-1]=tmp;
            ActiveCard--;
        }

        break;
    case WXK_UP:
        ActiveCard = 8;
        break;
    case WXK_DOWN:
        ActiveCard = -1;
    default:
        break;

    }
    wxPaintEvent Dummy = wxPaintEvent();
    OnPaint(Dummy);
}