当前位置: 首页>>代码示例>>C++>>正文


C++ SetLayout函数代码示例

本文整理汇总了C++中SetLayout函数的典型用法代码示例。如果您正苦于以下问题:C++ SetLayout函数的具体用法?C++ SetLayout怎么用?C++ SetLayout使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了SetLayout函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: BView

AntialiasingSettingsView::AntialiasingSettingsView(const char* name)
	: BView(name, 0)
{
	// collect the current system settings
	if (get_subpixel_antialiasing(&fCurrentSubpixelAntialiasing) != B_OK)
		fCurrentSubpixelAntialiasing = false;
	fSavedSubpixelAntialiasing = fCurrentSubpixelAntialiasing;

	if (get_hinting_mode(&fCurrentHinting) != B_OK)
		fCurrentHinting = HINTING_MODE_ON;
	fSavedHinting = fCurrentHinting;

	if (get_average_weight(&fCurrentAverageWeight) != B_OK)
		fCurrentAverageWeight = 100;
	fSavedAverageWeight = fCurrentAverageWeight;

	// create the controls

	// antialiasing menu
	_BuildAntialiasingMenu();
	fAntialiasingMenuField = new BMenuField("antialiasing",
		B_TRANSLATE("Antialiasing type:"), fAntialiasingMenu, NULL);

	// "average weight" in subpixel filtering
	fAverageWeightControl = new BSlider("averageWeightControl",
		B_TRANSLATE("Reduce colored edges filter strength:"),
		new BMessage(kMsgSetAverageWeight), 0, 255, B_HORIZONTAL);
	fAverageWeightControl->SetLimitLabels(B_TRANSLATE("Off"),
		B_TRANSLATE("Strong"));
	fAverageWeightControl->SetHashMarks(B_HASH_MARKS_BOTTOM);
	fAverageWeightControl->SetHashMarkCount(255 / 15);
	fAverageWeightControl->SetEnabled(false);

	// hinting menu
	_BuildHintingMenu();
	fHintingMenuField = new BMenuField("hinting", B_TRANSLATE("Glyph hinting:"),
		fHintingMenu, NULL);

#ifdef DISABLE_HINTING_CONTROL
	fHintingMenuField->SetEnabled(false);
#endif

#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
	// subpixelAntialiasingDisabledLabel
	BFont infoFont(*be_plain_font);
	infoFont.SetFace(B_ITALIC_FACE);
	rgb_color infoColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR),
		B_DARKEN_4_TINT);
	// TODO: Replace with layout friendly constructor once available.
	BRect textBounds = Bounds();
	BTextView* subpixelAntialiasingDisabledLabel = new BTextView(
		textBounds, "unavailable label", textBounds, &infoFont, &infoColor,
		B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT);
	subpixelAntialiasingDisabledLabel->SetText(B_TRANSLATE(
		"Subpixel based anti-aliasing in combination with glyph hinting is not "
		"available in this build of Haiku to avoid possible patent issues. To "
		"enable this feature, you have to build Haiku yourself and enable "
		"certain options in the libfreetype configuration header."));
	subpixelAntialiasingDisabledLabel->SetViewColor(
		ui_color(B_PANEL_BACKGROUND_COLOR));
	subpixelAntialiasingDisabledLabel->MakeEditable(false);
	subpixelAntialiasingDisabledLabel->MakeSelectable(false);
#endif // !FT_CONFIG_OPTION_SUBPIXEL_RENDERING

	SetLayout(new BGroupLayout(B_VERTICAL));

	// controls pane
	AddChild(BGridLayoutBuilder(10, 10)
		.Add(fHintingMenuField->CreateLabelLayoutItem(), 0, 0)
		.Add(fHintingMenuField->CreateMenuBarLayoutItem(), 1, 0)

		.Add(fAntialiasingMenuField->CreateLabelLayoutItem(), 0, 1)
		.Add(fAntialiasingMenuField->CreateMenuBarLayoutItem(), 1, 1)

		.Add(fAverageWeightControl, 0, 2, 2)

#ifndef FT_CONFIG_OPTION_SUBPIXEL_RENDERING
		// hinting+subpixel unavailable info
		.Add(subpixelAntialiasingDisabledLabel, 0, 3, 2)
#else
		.Add(BSpaceLayoutItem::CreateGlue(), 0, 3, 2)
#endif

		.SetInsets(10, 10, 10, 10)
	);

	_SetCurrentAntialiasing();
	_SetCurrentHinting();
	_SetCurrentAverageWeight();
}
开发者ID:mariuz,项目名称:haiku,代码行数:90,代码来源:AntialiasingSettingsView.cpp

示例2: KeyRequestView

	KeyRequestView()
		:
		BView("KeyRequestView", B_WILL_DRAW),
		fPassword(NULL)
	{
		SetViewUIColor(B_PANEL_BACKGROUND_COLOR);

		BGroupLayout* rootLayout = new(std::nothrow) BGroupLayout(B_VERTICAL);
		if (rootLayout == NULL)
			return;

		SetLayout(rootLayout);

		BGridView* controls = new(std::nothrow) BGridView();
		if (controls == NULL)
			return;

		BGridLayout* layout = controls->GridLayout();

		float inset = ceilf(be_plain_font->Size() * 0.7);
		rootLayout->SetInsets(inset, inset, inset, inset);
		rootLayout->SetSpacing(inset);
		layout->SetSpacing(inset, inset);

		BStringView* label = new(std::nothrow) BStringView("keyringLabel",
			B_TRANSLATE("Keyring:"));
		if (label == NULL)
			return;

		int32 row = 0;
		layout->AddView(label, 0, row);

		fKeyringName = new(std::nothrow) BStringView("keyringName", "");
		if (fKeyringName == NULL)
			return;

		layout->AddView(fKeyringName, 1, row++);

		fPassword = new(std::nothrow) BTextControl(B_TRANSLATE("Password:"), "", NULL);
		if (fPassword == NULL)
			return;

		BLayoutItem* layoutItem = fPassword->CreateTextViewLayoutItem();
		layoutItem->SetExplicitMinSize(BSize(fPassword->StringWidth(
				"0123456789012345678901234567890123456789") + inset,
			B_SIZE_UNSET));

		layout->AddItem(fPassword->CreateLabelLayoutItem(), 0, row);
		layout->AddItem(layoutItem, 1, row++);

		BGroupView* buttons = new(std::nothrow) BGroupView(B_HORIZONTAL);
		if (buttons == NULL)
			return;

		fCancelButton = new(std::nothrow) BButton(B_TRANSLATE("Cancel"),
			new BMessage(kMessageCancel));
		buttons->GroupLayout()->AddView(fCancelButton);

		buttons->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

		fUnlockButton = new(std::nothrow) BButton(B_TRANSLATE("Unlock"),
			new BMessage(kMessageUnlock));
		buttons->GroupLayout()->AddView(fUnlockButton);

		BTextView* message = new(std::nothrow) BTextView("message");
		message->SetText(B_TRANSLATE("An application wants to access the "
			"keyring below, but it is locked with a passphrase. Please enter "
			"the passphrase to unlock the keyring.\n"
			"If you unlock the keyring, it stays unlocked until the system is "
			"shut down or the keyring is manually locked again.\n"
			"If you cancel this dialog the keyring will remain locked."));
		message->SetViewUIColor(B_PANEL_BACKGROUND_COLOR);
		rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR);
		message->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor);
		message->MakeEditable(false);
		message->MakeSelectable(false);
		message->SetWordWrap(true);

		rootLayout->AddView(message);
		rootLayout->AddView(controls);
		rootLayout->AddView(buttons);
	}
开发者ID:garodimb,项目名称:haiku,代码行数:82,代码来源:KeyRequestWindow.cpp

示例3: SetLayout

void pawsStdTreeLayout::SetHorizScroll(int _horizScroll)
{
    horizScroll = _horizScroll;
    SetLayout();
}
开发者ID:Mixone-FinallyHere,项目名称:planeshift,代码行数:5,代码来源:pawstree.cpp

示例4: switch


//.........这里部分代码省略.........
                            FinalString += " _) ";
                            break;
                        default:
                            break;
                        }

                        break;
                    }

                    case '6':
                    {
                        switch (IndexOfRow)
                        {
                        case 0:
                            FinalString += " _  ";
                            break;
                        case 1:
                            FinalString += "|_  ";
                            break;
                        case 2:
                            FinalString += "|_) ";
                            break;
                        default:
                            break;
                        }

                        break;
                    }

                    case '7':
                    {
                        switch (IndexOfRow)
                        {
                        case 0:
                            FinalString += "__ ";
                            break;
                        case 1:
                            FinalString += " / ";
                            break;
                        case 2:
                            FinalString += "/  ";
                            break;
                        default:
                            break;
                        }

                        break;
                    }

                    case '8':
                    {
                        switch (IndexOfRow)
                        {
                        case 0:
                            FinalString += " _  ";
                            break;
                        case 1:
                            FinalString += "(_) ";
                            break;
                        case 2:
                            FinalString += "(_) ";
                            break;
                        default:
                            break;
                        }

                        break;
                    }

                    case '9':
                    {
                        switch (IndexOfRow)
                        {
                        case 0:
                            FinalString += " _  ";
                            break;
                        case 1:
                            FinalString += "(_| ";
                            break;
                        case 2:
                            FinalString += "  | ";
                            break;
                        default:
                            break;
                        }

                        break;
                    }

                    default:
                        break;
                }
            }
        }

        SetWidth(FinalString.length() / 3);
        SetHeight(3);

        SetLayout(FinalString);
    }
开发者ID:thoomi,项目名称:brickbreaker,代码行数:101,代码来源:gui_element_number.cpp

示例5: BWindow

SettingsWindow::SettingsWindow(BRect frame)
 	: BWindow(frame, "MediaPlayer settings", B_FLOATING_WINDOW_LOOK,
 		B_FLOATING_APP_WINDOW_FEEL,
 		B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_NOT_RESIZABLE
#ifdef __ANTARES__
 			| B_AUTO_UPDATE_SIZE_LIMITS)
#else
 			)
#endif
{
#ifdef __ANTARES__

	BBox* settingsBox = new BBox(B_PLAIN_BORDER, NULL);
	BGroupLayout* settingsLayout = new BGroupLayout(B_VERTICAL, 5);
	settingsBox->SetLayout(settingsLayout);
	BBox* buttonBox = new BBox(B_PLAIN_BORDER, NULL);
	BGroupLayout* buttonLayout = new BGroupLayout(B_HORIZONTAL, 5);
	buttonBox->SetLayout(buttonLayout);

	BStringView* playModeLabel = new BStringView("stringViewPlayMode",
		"Play mode");
	BStringView* viewOptionsLabel = new BStringView("stringViewViewOpions", 
		"View options");
	BStringView* bgMoviesModeLabel = new BStringView("stringViewPlayBackg", 
		"Play background clips at");
	BAlignment alignment(B_ALIGN_LEFT, B_ALIGN_VERTICAL_CENTER);
	playModeLabel->SetExplicitAlignment(alignment);
	playModeLabel->SetFont(be_bold_font);
	viewOptionsLabel->SetExplicitAlignment(alignment);
	viewOptionsLabel->SetFont(be_bold_font);
	bgMoviesModeLabel->SetExplicitAlignment(alignment);
	bgMoviesModeLabel->SetFont(be_bold_font);

	fAutostartCB = new BCheckBox("chkboxAutostart", 
		"Automatically start playing", new BMessage(M_AUTOSTART));

	fCloseWindowMoviesCB = new BCheckBox("chkBoxCloseWindowMovies", 
		"Close window when done playing movies",
		new BMessage(M_CLOSE_WINDOW_MOVIE));
	fCloseWindowSoundsCB = new BCheckBox("chkBoxCloseWindowSounds", 
		"Close window when done playing sounds",
		new BMessage(M_CLOSE_WINDOW_SOUNDS));

	fLoopMoviesCB = new BCheckBox("chkBoxLoopMovie",
		"Loop movies by default", new BMessage(M_LOOP_MOVIE));
	fLoopSoundsCB = new BCheckBox("chkBoxLoopSounds",
		"Loop sounds by default", new BMessage(M_LOOP_SOUND));

	fUseOverlaysCB = new BCheckBox("chkBoxUseOverlays",
		"Use hardware video overlays if available",
		new BMessage(M_USE_OVERLAYS));
	fScaleBilinearCB = new BCheckBox("chkBoxScaleBilinear",
		"Scale movies smoothly (non-overlay mode)",
		new BMessage(M_SCALE_BILINEAR));

	fFullVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
		"Full volume", new BMessage(M_START_FULL_VOLUME));
	
	fHalfVolumeBGMoviesRB = new BRadioButton("rdbtnhalfvolume", 
		"Low volume", new BMessage(M_START_HALF_VOLUME));
	
	fMutedVolumeBGMoviesRB = new BRadioButton("rdbtnfullvolume",
		"Muted", new BMessage(M_START_MUTE_VOLUME));

	fRevertB = new BButton("revert", "Revert", 
		new BMessage(M_SETTINGS_REVERT));

	BButton* cancelButton = new BButton("cancel", "Cancel", 
		new BMessage(M_SETTINGS_CANCEL));

	BButton* okButton = new BButton("ok", "OK",
		new BMessage(M_SETTINGS_SAVE));
	okButton->MakeDefault(true);


	// Build the layout
	SetLayout(new BGroupLayout(B_HORIZONTAL));

	AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
		.Add(BGroupLayoutBuilder(settingsLayout)
			.Add(playModeLabel)
			.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
				.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
				.Add(BGroupLayoutBuilder(B_VERTICAL, 0)
					.Add(fAutostartCB)
					.Add(BGridLayoutBuilder(5, 0)
						.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 0)
						.Add(fCloseWindowMoviesCB, 1, 0)
						.Add(BSpaceLayoutItem::CreateHorizontalStrut(10), 0, 1)
						.Add(fCloseWindowSoundsCB, 1, 1)
					)
					.Add(fLoopMoviesCB)
					.Add(fLoopSoundsCB)
				)
			)
			.Add(BSpaceLayoutItem::CreateVerticalStrut(5))

			.Add(viewOptionsLabel)
			.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
				.Add(BSpaceLayoutItem::CreateHorizontalStrut(10))
//.........这里部分代码省略.........
开发者ID:mmanley,项目名称:Antares,代码行数:101,代码来源:SettingsWindow.cpp

示例6: LOG_ERROR


//.........这里部分代码省略.........
          subtitle_->SetLines(-1);
          subtitle_->mouse_click.connect(on_mouse_down);
          title_subtitle_layout_->AddView(subtitle_.GetPointer(), 1);
        }

        nux::VLayout* app_updated_copywrite_layout = new nux::VLayout();
        app_updated_copywrite_layout->SetSpaceBetweenChildren(8);

        if (!app_preview_model->license.Get().empty())
        {
          license_ = new StaticCairoText(app_preview_model->license, true, NUX_TRACKER_LOCATION);
          AddChild(license_.GetPointer());
          license_->SetFont(style.app_license_font().c_str());
          license_->SetLines(-1);
          license_->mouse_click.connect(on_mouse_down);
          app_updated_copywrite_layout->AddView(license_.GetPointer(), 1);
        }

        if (!app_preview_model->last_update.Get().empty())
        {
          std::stringstream last_update;
          last_update << _("Last Updated") << " " << app_preview_model->last_update.Get();

          last_update_ = new StaticCairoText(last_update.str(), true, NUX_TRACKER_LOCATION);
          AddChild(last_update_.GetPointer());
          last_update_->SetFont(style.app_last_update_font().c_str());
          last_update_->mouse_click.connect(on_mouse_down);
          app_updated_copywrite_layout->AddView(last_update_.GetPointer(), 1);
        }

        if (!app_preview_model->copyright.Get().empty())
        {
          copywrite_ = new StaticCairoText(app_preview_model->copyright, true, NUX_TRACKER_LOCATION);
          AddChild(copywrite_.GetPointer());
          copywrite_->SetFont(style.app_copywrite_font().c_str());
          copywrite_->SetLines(-1);
          copywrite_->mouse_click.connect(on_mouse_down);
          app_updated_copywrite_layout->AddView(copywrite_.GetPointer(), 1);
        }

        app_data_layout->AddLayout(title_subtitle_layout_);
        app_data_layout->AddLayout(app_updated_copywrite_layout);

        // buffer space
        /////////////////////

      main_app_info->AddLayout(icon_layout, 0);
      main_app_info->AddLayout(app_data_layout, 1);
      /////////////////////

      /////////////////////
      // Description
      nux::ScrollView* app_info = new DetailsScrollView(NUX_TRACKER_LOCATION);
      app_info->EnableHorizontalScrollBar(false);
      app_info->mouse_click.connect(on_mouse_down);

      nux::VLayout* app_info_layout = new nux::VLayout();
      app_info_layout->SetSpaceBetweenChildren(12);
      app_info->SetLayout(app_info_layout);

      if (!preview_model_->description.Get().empty())
      {
        description_ = new StaticCairoText(preview_model_->description, false, NUX_TRACKER_LOCATION); // not escaped!
        AddChild(description_.GetPointer());
        description_->SetFont(style.description_font().c_str());
        description_->SetTextAlignment(StaticCairoText::NUX_ALIGN_TOP);
        description_->SetLines(-style.GetDescriptionLineCount());
        description_->SetLineSpacing(style.GetDescriptionLineSpacing());
        description_->mouse_click.connect(on_mouse_down);
        app_info_layout->AddView(description_.GetPointer());
      }

      if (!preview_model_->GetInfoHints().empty())
      {
        preview_info_hints_ = new PreviewInfoHintWidget(preview_model_, style.GetInfoHintIconSizeWidth());
        AddChild(preview_info_hints_.GetPointer());
        preview_info_hints_->request_close().connect([this]() { preview_container_->request_close.emit(); });
        app_info_layout->AddView(preview_info_hints_.GetPointer());
      }
      /////////////////////

      /////////////////////
      // Actions
      action_buttons_.clear();
      nux::Layout* actions_layout = BuildGridActionsLayout(preview_model_->GetActions(), action_buttons_);
      actions_layout->SetLeftAndRightPadding(0, style.GetDetailsRightMargin());
      ///////////////////

    full_data_layout_->AddLayout(main_app_info, 0);
    full_data_layout_->AddView(app_info, 1);
    full_data_layout_->AddLayout(actions_layout, 0);
    /////////////////////
  
  image_data_layout->AddView(image_.GetPointer(), 0);
  image_data_layout->AddLayout(full_data_layout_, 1);

  mouse_click.connect(on_mouse_down);

  SetLayout(image_data_layout);
}
开发者ID:foer,项目名称:linuxmuster-client-unity,代码行数:101,代码来源:ApplicationPreview.cpp

示例7: EDA_DRAW_FRAME

GERBVIEW_FRAME::GERBVIEW_FRAME( KIWAY* aKiway, wxWindow* aParent ):
    EDA_DRAW_FRAME( aKiway, aParent, FRAME_GERBER, wxT( "GerbView" ),
        wxDefaultPosition, wxDefaultSize, KICAD_DEFAULT_DRAWFRAME_STYLE, GERBVIEW_FRAME_NAME )
{
    m_colorsSettings = &g_ColorsSettings;
    m_gerberLayout = NULL;
    m_zoomLevelCoeff = ZOOM_FACTOR( 110 );   // Adjusted to roughly displays zoom level = 1
                                        // when the screen shows a 1:1 image
                                        // obviously depends on the monitor,
                                        // but this is an acceptable value

    PAGE_INFO pageInfo( wxT( "GERBER" ) );
    SetPageSettings( pageInfo );

    m_show_layer_manager_tools = true;

    m_showAxis = true;                      // true to show X and Y axis on screen
    m_showBorderAndTitleBlock   = false;    // true for reference drawings.
    m_HotkeysZoomAndGridList    = GerbviewHokeysDescr;
    m_SelLayerBox   = NULL;
    m_DCodeSelector = NULL;
    m_displayMode   = 0;
    m_drillFileHistory.SetBaseId( ID_GERBVIEW_DRILL_FILE1 );

    if( m_canvas )
        m_canvas->SetEnableBlockCommands( true );

    // Give an icon
    wxIcon icon;
    icon.CopyFromBitmap( KiBitmap( icon_gerbview_xpm ) );
    SetIcon( icon );

    SetLayout( new GBR_LAYOUT() );

    SetVisibleLayers( -1 );         // All draw layers visible.

    SetScreen( new GBR_SCREEN( GetPageSettings().GetSizeIU() ) );

    // Create the PCB_LAYER_WIDGET *after* SetLayout():
    wxFont  font = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
    int     pointSize       = font.GetPointSize();
    int     screenHeight    = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );

    if( screenHeight <= 900 )
        pointSize = (pointSize * 8) / 10;

    m_LayersManager = new GERBER_LAYER_WIDGET( this, m_canvas, pointSize );

    // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
    // initialize parameters in m_LayersManager
    LoadSettings( config() );

    SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );

    if( m_LastGridSizeId < 0 )
        m_LastGridSizeId = 0;
    if( m_LastGridSizeId > ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000 )
        m_LastGridSizeId = ID_POPUP_GRID_LEVEL_0_0_1MM-ID_POPUP_GRID_LEVEL_1000;
    GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId  );

    ReCreateMenuBar();
    ReCreateHToolbar();
    ReCreateOptToolbar();

    m_auimgr.SetManagedWindow( this );

    EDA_PANEINFO    horiz;
    horiz.HorizontalToolbarPane();

    EDA_PANEINFO    vert;
    vert.VerticalToolbarPane();

    EDA_PANEINFO    mesg;
    mesg.MessageToolbarPane();

    // Create a wxAuiPaneInfo for the Layers Manager, not derived from the template.
    // the Layers Manager is floatable, but initially docked at far right
    EDA_PANEINFO    lyrs;
    lyrs.LayersToolbarPane();
    lyrs.MinSize( m_LayersManager->GetBestSize() );
    lyrs.BestSize( m_LayersManager->GetBestSize() );
    lyrs.Caption( _( "Visibles" ) );
    lyrs.TopDockable( false ).BottomDockable( false );


    if( m_mainToolBar )
        m_auimgr.AddPane( m_mainToolBar,
                          wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );

    if( m_drawToolBar )
        m_auimgr.AddPane( m_drawToolBar,
                          wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right().Row( 1 ) );

    m_auimgr.AddPane( m_LayersManager,
                      lyrs.Name( wxT( "m_LayersManagerToolBar" ) ).Right().Layer( 0 ) );

    if( m_optionsToolBar )
        m_auimgr.AddPane( m_optionsToolBar,
                          wxAuiPaneInfo( vert ).Name( wxT( "m_optionsToolBar" ) ).Left() );

//.........这里部分代码省略.........
开发者ID:blueminerals,项目名称:kicad-source-mirror,代码行数:101,代码来源:gerbview_frame.cpp

示例8: BWindow

TeamMonitorWindow::TeamMonitorWindow()
	:
	BWindow(BRect(0, 0, 350, 400), B_TRANSLATE("Team monitor"),
		B_TITLED_WINDOW_LOOK, B_MODAL_ALL_WINDOW_FEEL,
		B_NOT_MINIMIZABLE | B_NOT_ZOOMABLE | B_ASYNCHRONOUS_CONTROLS
			| B_CLOSE_ON_ESCAPE | B_AUTO_UPDATE_SIZE_LIMITS,
		B_ALL_WORKSPACES),
	fQuitting(false),
	fUpdateRunner(NULL)
{
	BGroupLayout* layout = new BGroupLayout(B_VERTICAL);
	float inset = 10;
	layout->SetInsets(inset, inset, inset, inset);
	layout->SetSpacing(inset);
	SetLayout(layout);

	layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));

	fListView = new BListView("teams");
	fListView->SetSelectionMessage(new BMessage(TM_SELECTED_TEAM));

	BScrollView* scrollView = new BScrollView("scroll_teams", fListView,
		0, B_SUPPORTS_LAYOUT, false, true, B_FANCY_BORDER);
	layout->AddView(scrollView);

	BGroupView* groupView = new BGroupView(B_HORIZONTAL);
	layout->AddView(groupView);

	fKillButton = new BButton("kill", B_TRANSLATE("Kill application"),
		new BMessage(TM_KILL_APPLICATION));
	groupView->AddChild(fKillButton);
	fKillButton->SetEnabled(false);
	
	fQuitButton = new BButton("quit", B_TRANSLATE("Quit application"),
		new BMessage(TM_QUIT_APPLICATION));
	groupView->AddChild(fQuitButton);
	fQuitButton->SetEnabled(false);

	groupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue());

	fDescriptionView = new TeamDescriptionView;
	layout->AddView(fDescriptionView);

	groupView = new BGroupView(B_HORIZONTAL);
	layout->AddView(groupView);

	BButton* forceReboot = new BButton("force", B_TRANSLATE("Force reboot"),
		new BMessage(TM_FORCE_REBOOT));
	groupView->GroupLayout()->AddView(forceReboot);

	BSpaceLayoutItem* glue = BSpaceLayoutItem::CreateGlue();
	glue->SetExplicitMinSize(BSize(inset, -1));
	groupView->GroupLayout()->AddItem(glue);

	fRestartButton = new BButton("restart", B_TRANSLATE("Restart the desktop"),
		new BMessage(TM_RESTART_DESKTOP));
	SetDefaultButton(fRestartButton);
	groupView->GroupLayout()->AddView(fRestartButton);

	glue = BSpaceLayoutItem::CreateGlue();
	glue->SetExplicitMinSize(BSize(inset, -1));
	groupView->GroupLayout()->AddItem(glue);

	fCancelButton = new BButton("cancel", B_TRANSLATE("Cancel"),
		new BMessage(TM_CANCEL));
	SetDefaultButton(fCancelButton);
	groupView->GroupLayout()->AddView(fCancelButton);

	BSize preferredSize = layout->View()->PreferredSize();
	if (preferredSize.width > Bounds().Width())
		ResizeTo(preferredSize.width, Bounds().Height());
	if (preferredSize.height > Bounds().Height())
		ResizeTo(Bounds().Width(), preferredSize.height);

	BRect screenFrame = BScreen(this).Frame();
	BPoint point;
	point.x = (screenFrame.Width() - Bounds().Width()) / 2;
	point.y = (screenFrame.Height() - Bounds().Height()) / 2;

	if (screenFrame.Contains(point))
		MoveTo(point);

	SetSizeLimits(Bounds().Width(), Bounds().Width() * 2,
		Bounds().Height(), screenFrame.Height());

	fRestartButton->Hide();

	AddShortcut('T', B_COMMAND_KEY | B_OPTION_KEY,
		new BMessage(kMsgLaunchTerminal));
	AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));

	gLocalizedNamePreferred
		= BLocaleRoster::Default()->IsFilesystemTranslationPreferred();

	gTeamMonitorWindow = this;

	if (be_app->Lock()) {
		be_app->AddCommonFilter(new BMessageFilter(B_ANY_DELIVERY,
			B_ANY_SOURCE, B_LOCALE_CHANGED, FilterLocaleChanged));
		be_app->Unlock();
//.........这里部分代码省略.........
开发者ID:nielx,项目名称:haiku-serviceskit,代码行数:101,代码来源:TeamMonitorWindow.cpp

示例9: SizeSlider

void
CreateParamsPanel::_CreateViewControls(BPartition* parent, off_t offset,
	off_t size)
{
	// Setup the controls
	fSizeSlider = new SizeSlider("Slider", B_TRANSLATE("Partition size"), NULL,
		offset, offset + size);
	fSizeSlider->SetPosition(1.0);
	fSizeSlider->SetModificationMessage(new BMessage(MSG_SIZE_SLIDER));

	fSizeTextControl = new BTextControl("Size Control", "", "", NULL);
	for(int32 i = 0; i < 256; i++)
		fSizeTextControl->TextView()->DisallowChar(i);
	for(int32 i = '0'; i <= '9'; i++)
		fSizeTextControl->TextView()->AllowChar(i);
	_UpdateSizeTextControl();
	fSizeTextControl->SetModificationMessage(
		new BMessage(MSG_SIZE_TEXTCONTROL));

	fNameTextControl = new BTextControl("Name Control",
		B_TRANSLATE("Partition name:"),	"", NULL);
	if (!parent->SupportsChildName())
		fNameTextControl->SetEnabled(false);

	fTypePopUpMenu = new BPopUpMenu("Partition Type");

	int32 cookie = 0;
	BString supportedType;
	while (parent->GetNextSupportedChildType(&cookie, &supportedType)
			== B_OK) {
		BMessage* message = new BMessage(MSG_PARTITION_TYPE);
		message->AddString("type", supportedType);
		BMenuItem* item = new BMenuItem(supportedType, message);
		fTypePopUpMenu->AddItem(item);

		if (strcmp(supportedType, kPartitionTypeBFS) == 0)
			item->SetMarked(true);
	}

	fTypeMenuField = new BMenuField(B_TRANSLATE("Partition type:"),
		fTypePopUpMenu);

	const float spacing = be_control_look->DefaultItemSpacing();
	BGroupLayout* layout = new BGroupLayout(B_VERTICAL, spacing);
	layout->SetInsets(spacing, spacing, spacing, spacing);

	SetLayout(layout);

	AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing)
		.Add(fSizeSlider)
		.Add(fSizeTextControl)
		.Add(BGridLayoutBuilder(0.0, 5.0)
			.Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0)
			.Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0)
			.Add(fTypeMenuField->CreateLabelLayoutItem(), 0, 1)
			.Add(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 1)
		)
	);

	status_t err = parent->GetParameterEditor(B_CREATE_PARAMETER_EDITOR,
		&fEditor);
	if (err == B_OK && fEditor != NULL)
		AddChild(fEditor->View());
	else
		fEditor = NULL;

	BButton* okButton = new BButton(B_TRANSLATE("Create"),
		new BMessage(MSG_OK));
	AddChild(BGroupLayoutBuilder(B_HORIZONTAL, spacing)
		.AddGlue()
		.Add(new BButton(B_TRANSLATE("Cancel"), new BMessage(MSG_CANCEL)))
		.Add(okButton)
	);
	SetDefaultButton(okButton);

	AddToSubset(fWindow);
	layout->View()->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
}
开发者ID:RTOSkit,项目名称:haiku,代码行数:78,代码来源:CreateParamsPanel.cpp

示例10: BWindow

ModifierKeysWindow::ModifierKeysWindow()
	:
	BWindow(BRect(0, 0, 360, 220), B_TRANSLATE("Modifier keys"),
		B_FLOATING_WINDOW, B_NOT_RESIZABLE | B_NOT_ZOOMABLE
			| B_AUTO_UPDATE_SIZE_LIMITS)
{
	get_key_map(&fCurrentMap, &fCurrentBuffer);
	get_key_map(&fSavedMap, &fSavedBuffer);

	BStringView* keyRole = new BStringView("key role",
		B_TRANSLATE_COMMENT("Role", "As in the role of a modifier key"));
	keyRole->SetAlignment(B_ALIGN_RIGHT);
	keyRole->SetFont(be_bold_font);

	BStringView* keyLabel = new BStringView("key label",
		B_TRANSLATE_COMMENT("Key", "As in a computer keyboard key"));
	keyLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET));
	keyLabel->SetFont(be_bold_font);

	BMenuField* shiftMenuField = _CreateShiftMenuField();
	shiftMenuField->SetAlignment(B_ALIGN_RIGHT);

	BMenuField* controlMenuField = _CreateControlMenuField();
	controlMenuField->SetAlignment(B_ALIGN_RIGHT);

	BMenuField* optionMenuField = _CreateOptionMenuField();
	optionMenuField->SetAlignment(B_ALIGN_RIGHT);

	BMenuField* commandMenuField = _CreateCommandMenuField();
	commandMenuField->SetAlignment(B_ALIGN_RIGHT);

	fShiftConflictView = new ConflictView("shift warning view");
	fShiftConflictView->SetExplicitMaxSize(BSize(15, 15));

	fControlConflictView = new ConflictView("control warning view");
	fControlConflictView->SetExplicitMaxSize(BSize(15, 15));

	fOptionConflictView = new ConflictView("option warning view");
	fOptionConflictView->SetExplicitMaxSize(BSize(15, 15));

	fCommandConflictView = new ConflictView("command warning view");
	fCommandConflictView->SetExplicitMaxSize(BSize(15, 15));

	fCancelButton = new BButton("cancelButton", B_TRANSLATE("Cancel"),
		new BMessage(B_QUIT_REQUESTED));

	fRevertButton = new BButton("revertButton", B_TRANSLATE("Revert"),
		new BMessage(kMsgRevertModifiers));
	fRevertButton->SetEnabled(false);

	fOkButton = new BButton("okButton", B_TRANSLATE("Set modifier keys"),
		new BMessage(kMsgApplyModifiers));
	fOkButton->MakeDefault(true);

	// Build the layout
	SetLayout(new BGroupLayout(B_VERTICAL));

	float forcedMinWidth = be_plain_font->StringWidth("XXX") * 4;
	keyRole->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));

	BLayoutItem* shiftLabel = shiftMenuField->CreateLabelLayoutItem();
	shiftLabel->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
	BLayoutItem* controlLabel = controlMenuField->CreateLabelLayoutItem();
	controlLabel->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
	BLayoutItem* optionLabel = optionMenuField->CreateLabelLayoutItem();
	optionLabel->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));
	BLayoutItem* commandLabel = commandMenuField->CreateLabelLayoutItem();
	commandLabel->SetExplicitMinSize(BSize(forcedMinWidth, B_SIZE_UNSET));

	AddChild(BLayoutBuilder::Group<>(B_VERTICAL, B_USE_SMALL_SPACING)
		.AddGroup(B_HORIZONTAL)
			.Add(keyRole)
			.Add(keyLabel)
			.End()
		.AddGroup(B_HORIZONTAL)
			.Add(shiftLabel)
			.Add(shiftMenuField->CreateMenuBarLayoutItem())
			.Add(fShiftConflictView)
			.End()
		.AddGroup(B_HORIZONTAL)
			.Add(controlLabel)
			.Add(controlMenuField->CreateMenuBarLayoutItem())
			.Add(fControlConflictView)
			.End()
		.AddGroup(B_HORIZONTAL)
			.Add(optionLabel)
			.Add(optionMenuField->CreateMenuBarLayoutItem())
			.Add(fOptionConflictView)
			.End()
		.AddGroup(B_HORIZONTAL)
			.Add(commandLabel)
			.Add(commandMenuField->CreateMenuBarLayoutItem())
			.Add(fCommandConflictView)
			.End()
		.AddGlue()
		.AddGroup(B_HORIZONTAL)
			.Add(fCancelButton)
			.AddGlue()
			.Add(fRevertButton)
			.Add(fOkButton)
//.........这里部分代码省略.........
开发者ID:tqh,项目名称:haiku_efi_old,代码行数:101,代码来源:ModifierKeysWindow.cpp

示例11: BlockingWindow


//.........这里部分代码省略.........

    fMarginView = new MarginView(int32(width), int32(height), margin,
                                 MarginUnit(units));

    BPopUpMenu* pageSizePopUpMenu = new BPopUpMenu("Page size");
    pageSizePopUpMenu->SetRadioMode(true);

    fPageSizeMenu = new BMenuField("page_size", "Page size:", pageSizePopUpMenu);
    fPageSizeMenu->Menu()->SetLabelFromMarked(true);

    for (int32 i = 0; pageFormat[i].label != NULL; i++) {
        BMessage* message = new BMessage(PAGE_SIZE_CHANGED);
        message->AddFloat("width", pageFormat[i].width);
        message->AddFloat("height", pageFormat[i].height);
        BMenuItem* item = new BMenuItem(pageFormat[i].label, message);
        pageSizePopUpMenu->AddItem(item);

        if (label.Compare(pageFormat[i].label) == 0)
            item->SetMarked(true);
    }

    BPopUpMenu* orientationPopUpMenu = new BPopUpMenu("Orientation");
    orientationPopUpMenu->SetRadioMode(true);

    fOrientationMenu = new BMenuField("orientation", "Orientation:",
                                      orientationPopUpMenu);
    fOrientationMenu->Menu()->SetLabelFromMarked(true);

    for (int32 i = 0; orientation[i].label != NULL; i++) {
        BMessage* message = new BMessage(ORIENTATION_CHANGED);
        message->AddInt32("orientation", orientation[i].orientation);
        BMenuItem* item = new BMenuItem(orientation[i].label, message);
        orientationPopUpMenu->AddItem(item);

        if (fCurrentOrientation == orientation[i].orientation)
            item->SetMarked(true);
    }

    float scale0;
    BString scale;
    if (fSetupMsg->FindFloat("scale", &scale0) == B_OK)
        scale << (int)scale0;
    else
        scale = "100";

    fScaleControl = new BTextControl("scale", "Scale [%]:",
                                     scale.String(), NULL);

    for (uint32 i = 0; i < '0'; i++)
        fScaleControl->TextView()->DisallowChar(i);

    for (uint32 i = '9' + 1; i < 255; i++)
        fScaleControl->TextView()->DisallowChar(i);

    fScaleControl->TextView()->SetMaxBytes(3);

    BBox *separator = new BBox("separator");
    separator->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));

    BButton *cancel = new BButton("cancel", "Cancel", new BMessage(CANCEL_MSG));

    BButton *ok = new BButton("ok", "OK", new BMessage(OK_MSG));
    ok->MakeDefault(true);

    BGridView* settings = new BGridView();
    BGridLayout* settingsLayout = settings->GridLayout();
    settingsLayout->AddItem(fPageSizeMenu->CreateLabelLayoutItem(), 0, 0);
    settingsLayout->AddItem(fPageSizeMenu->CreateMenuBarLayoutItem(), 1, 0);
    settingsLayout->AddItem(fOrientationMenu->CreateLabelLayoutItem(), 0, 1);
    settingsLayout->AddItem(fOrientationMenu->CreateMenuBarLayoutItem(), 1, 1);
    settingsLayout->AddItem(fScaleControl->CreateLabelLayoutItem(), 0, 2);
    settingsLayout->AddItem(fScaleControl->CreateTextViewLayoutItem(), 1, 2);
    settingsLayout->SetSpacing(0, 0);

    SetLayout(new BGroupLayout(B_VERTICAL));
    AddChild(BGroupLayoutBuilder(B_VERTICAL, 0)
             .AddGroup(B_HORIZONTAL, 5, 1)
             .AddGroup(B_VERTICAL, 0, 1.0f)
             .Add(fMarginView)
             .AddGlue()
             .End()
             .AddGroup(B_VERTICAL, 0, 1.0f)
             .Add(settings)
             .AddGlue()
             .End()
             .End()
             .Add(separator)
             .AddGroup(B_HORIZONTAL, 10, 1.0f)
             .AddGlue()
             .Add(cancel)
             .Add(ok)
             .End()
             .SetInsets(10, 10, 10, 10)
            );

    BRect winFrame(Frame());
    BRect screenFrame(BScreen().Frame());
    MoveTo((screenFrame.right - winFrame.right) / 2,
           (screenFrame.bottom - winFrame.bottom) / 2);
}
开发者ID:yunxiaoxiao110,项目名称:haiku,代码行数:101,代码来源:PageSetupWindow.cpp

示例12: rcItem

void CFileCommentsPage::OnDrawItem(int /*nIDCtl*/, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
	if ( lpDrawItemStruct->itemID == (UINT)-1 ||
		 ( lpDrawItemStruct->itemAction & ODA_SELECT ) == 0 &&
		 ( lpDrawItemStruct->itemAction & ODA_DRAWENTIRE ) == 0 )
		return;

	const int nRating = lpDrawItemStruct->itemID;

	CRect rcItem( &lpDrawItemStruct->rcItem );

	CDC dc;

	dc.Attach( lpDrawItemStruct->hDC );
	if ( Settings.General.LanguageRTL )
		SetLayout( dc.m_hDC, LAYOUT_RTL );

	CFont* pOldFont = (CFont*)dc.SelectObject( nRating > 0 ? &theApp.m_gdiFontBold : &theApp.m_gdiFont );
	dc.SetBkMode( TRANSPARENT );

	if ( lpDrawItemStruct->itemState & ODS_SELECTED )
	{
		dc.SetTextColor( Colors.m_crHiText );
		if ( Images.m_bmSelected.m_hObject )
			CoolInterface.DrawWatermark( &dc, &rcItem, &Images.m_bmSelected, FALSE ); 	// No overdraw
		else
			dc.FillSolidRect( &rcItem, Colors.m_crHighlight );
	}
	else // Unselected
	{
		dc.SetTextColor( Colors.m_crText );
		dc.FillSolidRect( &rcItem, Colors.m_crSysWindow );
	}

	rcItem.DeflateRect( 4, 1 );

	if ( nRating > 1 )
	{
		for ( int nStar = nRating - 1; nStar; nStar-- )
		{
			rcItem.right -= 16;
			CoolInterface.Draw( &dc, IDI_STAR, 16, rcItem.right, rcItem.top, CLR_NONE,
				( lpDrawItemStruct->itemState & ODS_SELECTED ) );
			rcItem.right -= 2;
		}
	}
	else if ( nRating == 1 )
	{
		rcItem.right -= 16;
		CoolInterface.Draw( &dc, IDI_FAKE, 16, rcItem.right, rcItem.top, CLR_NONE,
			( lpDrawItemStruct->itemState & ODS_SELECTED ) );
	}

	if ( ( lpDrawItemStruct->itemState & ODS_SELECTED ) == 0 &&
		nRating >= 0 && nRating < 7 )
	{
		static COLORREF crRating[7] =
		{
			Colors.m_crRatingNull,	// Unrated
			Colors.m_crRating0,		// Fake
			Colors.m_crRating1,		// Poor
			Colors.m_crRating2,		// Average
			Colors.m_crRating3,		// Good
			Colors.m_crRating4,		// Very good
			Colors.m_crRating5,		// Excellent
		};

		dc.SetTextColor( crRating[ nRating ] );
	}

	CString str;
	m_wndRating.GetLBText( nRating, str );
	dc.DrawText( str, &rcItem, DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_NOPREFIX );

	dc.SelectObject( pOldFont );
	dc.Detach();
}
开发者ID:GetEnvy,项目名称:Envy,代码行数:77,代码来源:PageFileComments.cpp

示例13: HEventList

void
HWindow::InitGUI()
{
	fEventList = new HEventList();
	fEventList->SetType(BMediaFiles::B_SOUNDS);
	fEventList->SetSelectionMode(B_SINGLE_SELECTION_LIST);

	BGroupView* view = new BGroupView();
	BBox* box = new BBox("", B_WILL_DRAW | B_FRAME_EVENTS
		| B_NAVIGABLE_JUMP | B_PULSE_NEEDED);

	BMenu* menu = new BMenu("file");
	menu->SetRadioMode(true);
	menu->SetLabelFromMarked(true);
	menu->AddSeparatorItem();
	menu->AddItem(new BMenuItem(B_TRANSLATE("<none>"),
		new BMessage(M_NONE_MESSAGE)));
	menu->AddItem(new BMenuItem(B_TRANSLATE("Other" B_UTF8_ELLIPSIS),
		new BMessage(M_OTHER_MESSAGE)));

	BString label(B_TRANSLATE("Sound file:"));
	BMenuField* menuField = new BMenuField("filemenu", label, menu);
	menuField->SetDivider(menuField->StringWidth(label) + 10);

	BButton* stopbutton = new BButton("stop", B_TRANSLATE("Stop"),
		new BMessage(M_STOP_MESSAGE));
	stopbutton->SetEnabled(false);

	BButton* playbutton = new BButton("play", B_TRANSLATE("Play"),
		new BMessage(M_PLAY_MESSAGE));
	playbutton->SetEnabled(false);

	const float kInset = be_control_look->DefaultItemSpacing();
	view->SetLayout(new BGroupLayout(B_HORIZONTAL));
	view->AddChild(BGroupLayoutBuilder(B_VERTICAL, kInset)
		.AddGroup(B_HORIZONTAL)
			.Add(menuField)
			.AddGlue()
		.End()
		.AddGroup(B_HORIZONTAL, kInset)
			.AddGlue()
			.Add(playbutton)
			.Add(stopbutton)
		.End()
		.SetInsets(kInset, kInset, kInset, kInset)
	);

	box->AddChild(view);

	SetLayout(new BGroupLayout(B_HORIZONTAL));
	AddChild(BGroupLayoutBuilder(B_VERTICAL)
		.AddGroup(B_VERTICAL, kInset)
			.Add(fEventList)
			.Add(box)
		.End()
		.SetInsets(kInset, kInset, kInset, kInset)
	);

	// setup file menu
	SetupMenuField();
	BMenuItem* noneItem = menu->FindItem(B_TRANSLATE("<none>"));
	if (noneItem != NULL)
		noneItem->SetMarked(true);
}
开发者ID:royalharsh,项目名称:haiku,代码行数:64,代码来源:HWindow.cpp

示例14: OperThreadWin


//.........这里部分代码省略.........

	_lo.LineSet( 3, 3 );
	//_lo.LineSet(5, 5);

	_lo.LineSet( 6, 3 );
	_lo.LineSet( 7, 5 );
	_lo.LineSet( 8, 2 );

	_lo.ColSet( 4, 16, 100000 );
	_lo.LineSet( 4, 16, 100000 );

	_lo.AddRect( &_borderRect, 0, 0, 8, 8 );
	_lo.AddRect( &_frameRect, 2, 2, 6, 6 );

	_headerLo.ColSet( 0, 1, 1000 );
	_headerLo.ColSet( 2, 1, 1000 );
	_headerLo.LineSet( 0, 2 );
	_headerLo.LineSet( 2, 2 );
	_headerLo.AddWin( &_header, 1, 1 );
	_lo.AddLayout( &_headerLo, 1, 4 );

	_buttonLo.ColSet( 0, 10, 1000 );
	_buttonLo.ColSet( 15, 10, 1000 );
	_buttonLo.LineSet( 0, 2 );
	_buttonLo.LineSet( 2, 2 );

	_parentLo.ColSet( 0, 20, 1000 );
	_parentLo.ColSet( 2, 20, 1000 );
	_parentLo.LineSet( 0, 20, 1000 );
	_parentLo.LineSet( 2, 20, 1000 );
	_parentLo.AddWin( this, 1, 1 );

	_parentLo.SetLineGrowth( 0 );
	_parentLo.SetLineGrowth( 2 );

	_parentLo.SetColGrowth( 0 );
	_parentLo.SetColGrowth( 2 );

	if ( blist )
	{
		int n = 0;
		int minW = 0;

		for ( ; blist->utf8text && n < 7; blist++, n++ )
		{

			clPtr<Button> p = new Button( 0, this, utf8_to_unicode( _LT( carray_cat<char>( "DB>", blist->utf8text ).data(), blist->utf8text ) ).data(), blist->cmd );

			p->Show();
			p->Enable();

			if ( n > 0 )
			{
				_buttonLo.ColSet( n * 2, 5 );
			}

			_buttonLo.AddWin( p.ptr(), 1, n * 2 + 1 );

			if ( minW < p->GetLSize().x.minimal )
			{
				minW = p->GetLSize().x.minimal;
			}

			_bList.append( p );
//break; ???

		}

		if ( minW > 0 )
			for ( int i = 0; i < _bList.count(); i++ )
			{
				LSize s = _bList[i]->GetLSize();
				s.x.minimal = s.x.maximal = minW;
				_bList[i]->SetLSize( s );
			};

		if ( _bList.count() )
		{
			_bList[0]->SetFocus();
		}

	}

	_lo.AddLayout( &_buttonLo, 5, 4 );

	_header.Enable();
	_header.Show();

	SetLayout( &_lo );

	if ( Type() == WT_CHILD && parent )
	{
		parent->AddLayout( &_parentLo );
	}


	SetPosition();

	SetName( appName );
}
开发者ID:FaionWeb,项目名称:WCMCommander,代码行数:101,代码来源:ncdialogs.cpp

示例15: BBox


//.........这里部分代码省略.........

	const char *focusLabels[] = {B_TRANSLATE_MARK("Click to focus and raise"),
		B_TRANSLATE_MARK("Click to focus"),
		B_TRANSLATE_MARK("Focus follows mouse")};
	const mode_mouse focusModes[] = {B_NORMAL_MOUSE, B_CLICK_TO_FOCUS_MOUSE,
										B_FOCUS_FOLLOWS_MOUSE};

	for (int i = 0; i < 3; i++) {
		BMessage* message = new BMessage(kMsgMouseFocusMode);
		message->AddInt32("mode", focusModes[i]);

		fFocusMenu->AddItem(new BMenuItem(B_TRANSLATE_NOCOLLECT(focusLabels[i]),
			message));
	}

	BMenuField* focusField = new BMenuField(B_TRANSLATE("Focus mode:"),
		fFocusMenu);
	focusField->SetAlignment(B_ALIGN_RIGHT);

	// Add the "Focus follows mouse mode" pop up menu
	fFocusFollowsMouseMenu = new BPopUpMenu(B_TRANSLATE("Normal"));

	const char *focusFollowsMouseLabels[] = {B_TRANSLATE_MARK("Normal"),
		B_TRANSLATE_MARK("Warp"), B_TRANSLATE_MARK("Instant warp")};
	const mode_focus_follows_mouse focusFollowsMouseModes[] =
		{B_NORMAL_FOCUS_FOLLOWS_MOUSE, B_WARP_FOCUS_FOLLOWS_MOUSE,
			B_INSTANT_WARP_FOCUS_FOLLOWS_MOUSE};

	for (int i = 0; i < 3; i++) {
		BMessage* message = new BMessage(kMsgFollowsMouseMode);
		message->AddInt32("mode_focus_follows_mouse",
			focusFollowsMouseModes[i]);

		fFocusFollowsMouseMenu->AddItem(new BMenuItem(
			B_TRANSLATE_NOCOLLECT(focusFollowsMouseLabels[i]), message));
	}

	BMenuField* focusFollowsMouseField = new BMenuField(
		"Focus follows mouse mode:", fFocusFollowsMouseMenu);
	focusFollowsMouseField->SetAlignment(B_ALIGN_RIGHT);

	// Add the "Click-through" check box
	fAcceptFirstClickBox = new BCheckBox(B_TRANSLATE("Accept first click"),
		new BMessage(kMsgAcceptFirstClick));

	// dividers
	BBox* hdivider = new BBox(
		BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
			B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
	hdivider->SetExplicitMaxSize(BSize(1, B_SIZE_UNLIMITED));

	BBox* vdivider = new BBox(
		BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES,
			B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER);
	vdivider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1));

	// Build the layout
	SetLayout(new BGroupLayout(B_HORIZONTAL));

	AddChild(BGroupLayoutBuilder(B_VERTICAL, 10)
		.AddGroup(B_HORIZONTAL, 10)
			.AddGroup(B_VERTICAL, 10, 1)
				.AddGroup(B_HORIZONTAL, 10)
					.AddGlue()
					.Add(typeField)
					.AddGlue()
				.End()
				.AddGlue()
				.Add(BGroupLayoutBuilder(B_HORIZONTAL, 10)
					.AddGlue()
					.Add(fMouseView)
					.AddGlue()
				)
				.AddGlue()
				.Add(doubleClickTextControl)
			.End()
			.Add(hdivider)
			.AddGroup(B_VERTICAL, 5, 3)
				.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
					.Add(fClickSpeedSlider)
				)
				.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
					.Add(fMouseSpeedSlider)
				)
				.Add(BGroupLayoutBuilder(B_HORIZONTAL, 0)
					.Add(fAccelerationSlider)
				)
			.End()
		.End()
		.Add(vdivider)
		.AddGroup(B_HORIZONTAL, 10)
			.Add(focusField)
			.AddGlue()
			.AddGroup(B_VERTICAL, 0)
				.Add(fAcceptFirstClickBox)
			.End()
		.End()
		.SetInsets(5, 5, 5, 5)
	);
}
开发者ID:veer77,项目名称:Haiku-services-branch,代码行数:101,代码来源:SettingsView.cpp


注:本文中的SetLayout函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。