Exemplo n.º 1
0
BOOL CEnEdit::SetButtonWidthDLU(UINT nID, int nDLU)
{
	ASSERT (GetSafeHwnd());

	int nWidth = CDlgUnits(*GetTopLevelParent()).ToPixelsX(nDLU);
	return SetButtonWidth(nID, nWidth);
}
CLuaProgressDialog::CLuaProgressDialog(int r) : CBaseLuaProgressDialog(r)
{
    const int windoww = 500, windowh = 140, widgetw = windoww - 20, x = 10;
    m_pDialog = new Fl_Window(windoww, windowh);
    m_pDialog->set_modal();
    m_pDialog->begin();
    m_pDialog->callback(CancelCB, this);
    
    m_pTitle = new Fl_Box(x, 0, widgetw, WidgetHeight());
    
    m_pProgBar = new Fl_Progress(x, 0, widgetw, WidgetHeight());
    m_pProgBar->minimum(0.0f);
    m_pProgBar->maximum(100.0f);
    
    m_pSecTitle = new Fl_Box(x, 0, widgetw, WidgetHeight());
    m_pSecTitle->hide();
    
    m_pSecProgBar = new Fl_Progress(x, 0, widgetw, WidgetHeight());
    m_pSecProgBar->minimum(0.0f);
    m_pSecProgBar->maximum(100.0f);
    m_pSecProgBar->hide();
    
    m_pCancelButton = new Fl_Button(0, windowh - WidgetHeight() - 5, 0, WidgetHeight(), GetTranslation("Cancel"));
    SetButtonWidth(m_pCancelButton);
    m_pCancelButton->position((windoww - m_pCancelButton->w()) / 2, m_pCancelButton->y());
    m_pCancelButton->callback(CancelCB, this);
    m_pCancelButton->deactivate();
    
    UpdateWidgets();
    
    m_pDialog->end();
    m_pDialog->show();
}
void CLuaDirSelector::UpdateLayout()
{
    SetButtonWidth(m_pBrowseButton);
    
    int inputw = GetGroup()->w() - Spacing() - m_pBrowseButton->w();
    m_pDirInput->size(inputw, m_pDirInput->h());
    m_pBrowseButton->position(m_pDirInput->x() + inputw + Spacing(), m_pBrowseButton->y());
}
void CLuaCFGMenu::UpdateDirChooser(int w)
{
    SetButtonWidth(m_pBrowseButton);
    
    int inputw = w - DirChooserSpacing() - m_pBrowseButton->w();
    m_pDirInput->size(inputw, m_pDirInput->h());
    m_pBrowseButton->position(m_pDirInput->x() + inputw + DirChooserSpacing(), m_pBrowseButton->y());
}
Exemplo n.º 5
0
void
BAlert::_Init(const char* text, const char* button0, const char* button1,
	const char* button2, button_width buttonWidth, button_spacing spacing,
	alert_type type)
{
	fIconView = new TAlertView();

	fTextView = new BTextView("_tv_");
	fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
	rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
	fTextView->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
	fTextView->MakeEditable(false);
	fTextView->MakeSelectable(false);
	fTextView->SetWordWrap(true);
	fTextView->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED));

	fButtonLayout = new BGroupLayout(B_HORIZONTAL, B_USE_HALF_ITEM_SPACING);

	SetType(type);
	SetButtonWidth(buttonWidth);
	SetButtonSpacing(spacing);
	SetText(text);

	BLayoutBuilder::Group<>(this, B_HORIZONTAL, 0)
		.Add(fIconView)
		.AddGroup(B_VERTICAL, B_USE_HALF_ITEM_SPACING)
			.SetInsets(B_USE_HALF_ITEM_INSETS)
			.Add(fTextView)
			.AddGroup(B_HORIZONTAL, 0)
				.AddGlue()
				.Add(fButtonLayout);

	AddButton(button0);
	AddButton(button1);
	AddButton(button2);

	AddCommonFilter(new(std::nothrow) _BAlertFilter_(this));
}
CLuaCFGMenu::CLuaCFGMenu(const char *desc) : CBaseLuaWidget(desc)
{
    m_ColumnWidths[0] = m_ColumnWidths[1] = 0;
    
    const int inputh = 25, dirinputh = 35, inputspacing = 10;
    GetGroup()->begin();
    
    m_pVarListView = new Fl_Hold_Browser(0, 0, 0, GroupHeight() - (inputspacing+dirinputh));
    m_pVarListView->callback(SelectionCB, this);
    
    m_pInputField = new Fl_Input(0, 0, 0, inputh);
    m_pInputField->callback(InputChangedCB, this);
    m_pInputField->when(FL_WHEN_CHANGED);
    m_pInputField->hide();
    
    m_pChoiceMenu = new Fl_Choice(0, 0, 0, inputh);
    m_pChoiceMenu->callback(ChoiceChangedCB, this);
    m_pChoiceMenu->hide();
    
    // Group for placing widgets next to eachother
    Fl_Group *dirgroup = new Fl_Group(0, 0, 0, dirinputh);
    dirgroup->resizable(NULL);
    
    m_pDirInput = new Fl_File_Input(0, 0, 0, dirinputh);
    m_pDirInput->callback(InputChangedCB, this);
    m_pDirInput->when(FL_WHEN_CHANGED);
    m_pDirInput->hide();
    
    m_pBrowseButton = new Fl_Button(0, (dirinputh-inputh) / 2, 0, inputh, GetTranslation("Browse"));
    SetButtonWidth(m_pBrowseButton);
    m_pBrowseButton->callback(BrowseCB, this);
    m_pBrowseButton->hide();
    
    dirgroup->end();
    
    GetGroup()->end();
}
Exemplo n.º 7
0
void CInstaller::Init(int argc, char **argv)
{
    const int buttonsy = WindowH()-ButtonHeight()-ButtonHSpacing();
    
    m_pMainWindow = new Fl_Double_Window(WindowW(), WindowH(), "Nixstaller");
    m_pMainWindow->callback(CancelCB, this);

    Fl_Group *maingroup = new Fl_Group(0, 0, WindowW(), WindowH());
    maingroup->resizable(NULL);
    maingroup->box(FL_FLAT_BOX);
    maingroup->color(fl_lighter(FL_BACKGROUND_COLOR));

    Fl_Pack *mainpack = new Fl_Pack(0, 0, WindowW(), WindowH()-90);
    mainpack->resizable(NULL);
    mainpack->type(Fl_Pack::VERTICAL);
    
    CreateHeader();
    
    m_pWizard = new Fl_Wizard(0, m_pHeaderGroup->h(), WindowW(),
                              (buttonsy-m_pHeaderGroup->h()-ButtonHSpacing()));
    m_pWizard->box(FL_ENGRAVED_BOX);
    m_pWizard->end();

    mainpack->end();

    m_pCancelButton = new Fl_Button(ButtonWOffset(), buttonsy, 0, ButtonHeight(), GetTranslation("Cancel"));
    SetButtonWidth(m_pCancelButton);
    m_pCancelButton->callback(CancelCB, this);
    
    m_pButtonPack = new Fl_Pack(0, buttonsy, 0, ButtonHeight());
    m_pButtonPack->type(Fl_Pack::HORIZONTAL);
    m_pButtonPack->spacing(ButtonWSpacing());
    
    m_pBackButton = new Fl_Button(0, buttonsy, 0, ButtonHeight(),
                                  CreateText("@<-    %s", GetTranslation("Back")));
    SetButtonWidth(m_pBackButton);
    m_pBackButton->callback(BackCB, this);
    
    m_pNextButton = new Fl_Button(0, buttonsy, 0, ButtonHeight(),
                                  CreateText("%s    @->", GetTranslation("Next")));
    SetButtonWidth(m_pNextButton);
    m_pNextButton->callback(NextCB, this);
    
    m_pButtonPack->end();
    UpdateButtonPack();
    
    maingroup->end();
    
    CBaseInstall::Init(argc, argv);
    
    Fl_Shared_Image *img = Fl_Shared_Image::get(GetLogoFName());
    if (img)
    {
        m_pLogoBox = new Fl_Box(HeaderSpacing(), HeaderSpacing(), img->w()+HeaderSpacing(), img->h());
        m_pLogoBox->align(FL_ALIGN_TOP | FL_ALIGN_INSIDE);
        m_pLogoBox->image(img);
        m_pHeaderGroup->add(m_pLogoBox);
    }

    int size = m_pWizard->children();
    for (int i=0; i<size; i++)
    {
        CInstallScreen *screen = GetScreen(m_pWizard->child(i));
        if (screen->CanActivate())
        {
            ActivateScreen(screen);
            break;
        }
    }
    
    m_pMainWindow->end();
    m_pMainWindow->show(argc, argv);
}
Exemplo n.º 8
0
void CMuleToolbarCtrl::SetAllButtonsWidth()
{
	if (GetButtonCount() == 0)
		return;

	if (m_eLabelType == LabelsBelow)
	{
		CDC *pDC = GetDC();
		CFont *pFnt = GetFont();
		CFont *pOldFnt = pDC->SelectObject(pFnt);
		CRect r(0,0,0,0);

		// calculate the max. possible button-size
		int iCalcSize = 0;
		for (int i = 0; i < m_buttoncount ; i++)
		{
			if (!IsButtonHidden(IDC_TOOLBARBUTTON + i))
			{
				pDC->DrawText(TBStrings[i], -1, r, DT_SINGLELINE | DT_CALCRECT);
 				if (r.Width() > iCalcSize)
					iCalcSize = r.Width();
			}
		}
		iCalcSize += 10;

		pDC->SelectObject(pOldFnt);
		ReleaseDC(pDC);

		if (!thePrefs.GetUseReBarToolbar())
		{
			GetClientRect(&r);
			int bc = GetButtonCount();
			if (bc == 0)
				bc = 1;
			int iMaxPossible = r.Width() / bc;

			// if the buttons are to big, reduze their size
			if (iCalcSize > iMaxPossible)
				iCalcSize = iMaxPossible;
		}
		else
		{
			if (iCalcSize < 56)
				iCalcSize = 56;
			else if (iCalcSize > 72)
				iCalcSize = 72;
		}
		SetButtonWidth(iCalcSize, iCalcSize);
	}
	else
	{
		int iSmallIconsButtonHeight;
		if (theApp.m_ullComCtrlVer < MAKEDLLVERULL(6, 0, 0, 0)) {
			// Win98,WinME,Win2000: Comtrl32 prior to 6.0 cannot make a toolbar smaller than 22 pixels
			// in height and if it gets larger than 22 pixels the icons do not get centered vertically.
			iSmallIconsButtonHeight = 22;
		}
		else
			iSmallIconsButtonHeight = GetSystemMetrics(SM_CYSCREEN) <= 600 ? 16 : 28;

		if (m_eLabelType == NoLabels)
		{
			DWORD dwSize = GetButtonSize();
			int iFixedButtonWidth;
			int iFixedButtonHeight = HIWORD(dwSize);
			if (m_sizBtnBmp.cx == 16)
			{
				iFixedButtonWidth = 28;
				iFixedButtonHeight = iSmallIconsButtonHeight;
			}
			else
			{
				iFixedButtonWidth = 56;
			}

			// it seems that the control updates itself more properly, if 'SetButtonWidth' id called *before* 'SetButtonSize'
			SetButtonWidth(iFixedButtonWidth, iFixedButtonWidth);
			SetButtonSize(CSize(iFixedButtonWidth, iFixedButtonHeight));
		}
		else
		{
			int iFixedButtonHeight = 0;
			if (m_sizBtnBmp.cx == 16)
				iFixedButtonHeight = iSmallIconsButtonHeight;

			// it seems that the control updates itself more properly, if 'SetButtonWidth' id called *before* 'SetButtonSize'
			SetButtonWidth(0, 0);
			SetButtonSize(CSize(0, iFixedButtonHeight));
		}
	}
}
Exemplo n.º 9
0
void GroupLayout::AddSkinHeader( SkinHeader & skin_header )
{
    assert( m_Group && m_Screen );
    int oldBW = GetButtonWidth();


    bool saveFitWidth = m_FitWidthFlag;
    bool saveSameLine = m_SameLineFlag;


    vector< VspButton* > buttons;

    // Size of Set label buttons
    int setW = 25;
    // Size of Equal label button
    int eqW = 20;

    // Width of choice
    int cw = m_ChoiceButtonWidth + m_SliderWidth;

    m_FitWidthFlag = true;

    // Gap width
    int gw = FitWidth( 2 * setW + eqW + oldBW + 2 * cw, 2 * m_ButtonWidth )/2;

    m_FitWidthFlag = false;
    m_SameLineFlag = true;

    Choice* cont_choice = new Choice();
    cont_choice->AddItem( "C0" );
    cont_choice->AddItem( "C1" );
    cont_choice->AddItem( "C2" );
    AddChoice( *cont_choice, "Enforce" );

    AddX( gw );

    //==== Left Set Button ====//
    SetButtonWidth( setW );
    buttons.push_back( AddParmButton( "Set" ) );

    AddX( oldBW );

    //==== Equal Button ====//
    SetButtonWidth( eqW );
    buttons.push_back( AddParmButton( "=" ) );

    //==== Right Set Button ====//
    SetButtonWidth( setW );
    buttons.push_back( AddParmButton( "Set" ) );

    NewLineX();

    m_FitWidthFlag = saveFitWidth;
    m_SameLineFlag = saveSameLine;

    skin_header.Init( m_Screen, cont_choice, buttons );

    ForceNewLine();

    SetButtonWidth( oldBW );
}