Esempio n. 1
0
void CPWL_ComboBox::OnNotify(CPWL_Wnd* pWnd,
                             FX_DWORD msg,
                             intptr_t wParam,
                             intptr_t lParam) {
  switch (msg) {
    case PNM_LBUTTONDOWN:
      if (pWnd == m_pButton) {
        SetPopup(!m_bPopup);
        return;
      }
      break;
    case PNM_LBUTTONUP:
      if (m_pEdit && m_pList) {
        if (pWnd == m_pList) {
          SetSelectText();
          SelectAll();
          m_pEdit->SetFocus();
          SetPopup(FALSE);
          return;
        }
      }
  }

  CPWL_Wnd::OnNotify(pWnd, msg, wParam, lParam);
}
Esempio n. 2
0
void PaletteSubDialog::UpdatePopup(Int32 current)
{
    BaseContainer bc;
    bc.SetString(ACTION_LOAD, "Load palette");
    bc.SetString(ACTION_NEW,  "New palette");
    bc.SetString(ACTION_SAVE, "Save palette");
    bc.InsData(0, String(""));
    if(m_showControls){
        bc.SetString(ACTION_LABEL, "Show controls&c&");
    }else{
        bc.SetString(ACTION_LABEL, "Show controls");
    }
    bc.InsData(0, String(""));
    GeDynamicArray<Palette> pals;
    Palette::GetPalettes(pals);
    for(Int32 i=0;i<pals.GetCount();i++){
        String str;
        if(i==current){
            str = "&c&";
        }
        bc.SetString(ACTION_COUNT+i,pals[i].m_name+str);
    }
    SetPopup(m_actionPopup,bc);

}
Esempio n. 3
0
GColourSelect::GColourSelect(GArray<COLOUR> *col32) :
	ResObject(Res_Custom), GDropDown(-1, 0, 0, 10, 10, 0)
{
	c32 = Rgb32(0, 0, 255);

	SetPopup(new GColourSelectPopup(this));
	if (col32)
		SetColourList(col32);
}
Esempio n. 4
0
//---------------------------------------------------------------------------
void __fastcall TFileViewDlg::FormResize(TObject *Sender)
{
	if( m_DisEvent ) return;

	int WW = m_RectS.Right + 6;
	int HH = m_RectS.Bottom + 6;
	if( BorderStyle == bsNone ){
		int ch = m_Line * HH;
		int cw = m_Col * WW;
		m_DisEvent++;
		ClientHeight = GetCH(ch);
		ClientWidth = cw;
		m_DisEvent--;
		return;
	}
	int OldMax = m_Max;
	int h = (pTabS != NULL) ? ClientHeight - pTabS->TabHeight - 6 : ClientHeight;
	h = int((double(h - Panel->Height)/ HH) + 0.5);
	if( !h ) h = 1;
	int w = int((double(ClientWidth)/ WW) + 0.5);
	if( !w ) w = 1;
	while( (h * w) > AHDMAX ){
		if( w > 1 ){
			w--;
		}
		else if( h > 1 ){
			h--;
		}
	}
	int ch = h * HH;
	int cw = w * WW;
	if( cw < (UD->Left + UD->Width) ){
		w++;
		cw += WW;
	}
	m_Col = w;
	m_Line = h;
	m_Max = h * w;
	SetBitmapSize();
	TWinControl *pCtr = this;
	if( (m_MaxPage > 1) && (pTabS == NULL) ){
		Panel->Align = alNone;
		RemoveControl(Panel);
		pTabS = new TTabControl(this);
		pTabS->Width = ClientWidth;
		pTabS->Height = ClientHeight;
		pTabS->TabPosition = KBP->Checked ? tpBottom : tpTop;
		InsertControl(pTabS);
		pTabS->Parent = this;
		pTabS->Align = alClient;
		for( int j = 0; j < m_MaxPage; j++ ){
			AnsiString as;
			GetPageName(as, j);
			pTabS->Tabs->Add(as);
		}
		pTabS->Font->Height = -16;
		pTabS->TabHeight = 20;
		pTabS->InsertControl(Panel);
		Panel->Parent = pTabS;
		if( KBP->Checked ){
			Panel->Top = 0;
		}
		else {
			Panel->Top = pTabS->TabHeight + 3;
		}
		pTabS->TabIndex = m_CurPage;
		pTabS->OnChange = TabSChange;
		pCtr = pTabS;
	}
	pCurPage = pFileV[m_CurPage];
	if( UD->Max < pCurPage->m_CurPage ) UD->Max = SHORT(pCurPage->m_CurPage + 1);
	UD->Position = SHORT(pCurPage->m_CurPage);
	int i;
	for( i = 0; i < m_Max; i++ ){
		if( pPanel[i] == NULL ){
			pPanel[i] = new TPanel(this);
			TPanel *pn = pPanel[i];
			pn->BorderStyle = bsSingle;
			pn->Width = WW;
			pn->Height = HH;
			pCtr->InsertControl(pn);
			pn->Parent = pCtr;
			pBox[i] = new TPaintBox(this);
			TPaintBox *pb = pBox[i];
			pn->InsertControl(pb);
			pb->Parent = pn;
			pb->Align = alClient;
			pb->OnPaint = PBPaint;
			pb->OnMouseDown = PBMouseDown;
			pb->OnMouseMove = PBMouseMove;
			pb->OnDblClick = PBDblClick;
			pb->OnDragOver = PanelDragOver;
			pb->OnDragDrop = PanelDragDrop;
			pb->PopupMenu = pPopup;
		}
		else {
			pPanel[i]->Visible = FALSE;
			pPanel[i]->Width = WW;
			pPanel[i]->Height = HH;
		}
		MultProc();
	}
	for( ; i < AHDMAX; i++ ){
		if( pPanel[i] != NULL ){
			pPanel[i]->Visible = FALSE;
		}
		MultProc();
	}
	m_DisEvent++;
	ClientHeight = GetCH(ch);
	ClientWidth = cw;
	for( i = 0; i < m_Max; i++ ){
		pPanel[i]->Left = (i % m_Col) * WW;
		pPanel[i]->Top = Panel->Top + Panel->Height + (i / m_Col) * HH;
		pPanel[i]->Visible = TRUE;
	}
	if( pTabS != NULL ) Panel->Width = pTabS->ClientWidth;
	m_DisEvent--;
	if( m_Max != OldMax ){
		for( i = 0; i < m_MaxPage; i++ ){
			if( i != m_CurPage ){
				delete pFileV[i]->pList;
				pFileV[i]->pList = NULL;
			}
		}
		LoadImage();
	}
	SetPopup(Popup);
}
Esempio n. 5
0
void CPWL_ComboBox::KillFocus() {
  SetPopup(FALSE);
  CPWL_Wnd::KillFocus();
}
Esempio n. 6
0
void CPWL_ComboBox::KillFocus() {
  SetPopup(false);
  CPWL_Wnd::KillFocus();
}