本文整理汇总了C++中BView::EndPicture方法的典型用法代码示例。如果您正苦于以下问题:C++ BView::EndPicture方法的具体用法?C++ BView::EndPicture怎么用?C++ BView::EndPicture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BView
的用法示例。
在下文中一共展示了BView::EndPicture方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rect
HSPictureButton::HSPictureButton(BRect frame, BBitmap* off, BBitmap* on,
BMessage* message, const char* helpMessage, const char* longHelpMessage,
uint32 behavior, uint32 mode, uint32 flags)
: BPictureButton(frame, "?", NULL, NULL, message, behavior, mode, flags)
, fLongHelpMessage(longHelpMessage)
{
if (helpMessage)
SetToolTip(helpMessage);
BRect rect(0, 0, 0, 0);
BBitmap* offScreen = new BBitmap(rect, B_RGB_32_BIT, true);
BView* offView = new BView(rect, "", B_FOLLOW_ALL, 0);
offScreen->AddChild(offView);
offScreen->Lock();
offView->SetHighColor(255, 0, 0);
offView->SetLowColor(0, 0, 120);
offView->SetDrawingMode(B_OP_COPY);
offView->BeginPicture(new BPicture());
offView->DrawBitmap(on, BPoint(0, 0));
SetEnabledOn(offView->EndPicture());
offView->BeginPicture(new BPicture());
offView->DrawBitmap(off, BPoint(0, 0));
SetEnabledOff(offView->EndPicture());
offScreen->Unlock();
delete offScreen;
}
示例2: targatobpic
int targatobpic(
const unsigned char* targa, int targasize,
BPicture* picture)
{
BRect frame(0,0,100,100); // arbitraire
BBitmap *bitmap;
BView *view;
BWindow *window;
bitmap=targatobbitmap(targa,targasize);
if(!bitmap) return -1;
window=new BWindow(frame,NULL,B_MODAL_WINDOW,0);
view=new BView(frame,NULL,B_FOLLOW_NONE,0);
window->AddChild(view);
view->BeginPicture(picture);
view->DrawBitmap(bitmap);
view->EndPicture();
delete bitmap;
delete window;
return 0;
}
示例3: BView
/***********************************************************
* Make disable state picture.
***********************************************************/
BPicture*
HToolbarButton::MakeDisablePicture(BBitmap *in)
{
HToolbar *toolbar = cast_as(Parent(),HToolbar);
BRect buttonRect = toolbar->ButtonRect();
BView *view = new BView(BRect(0,0,buttonRect.Width(),buttonRect.Height())
,"offview",0,0);
BBitmap *bitmap = new BBitmap(view->Bounds(), in->ColorSpace(), true);
BPicture *pict;
bitmap->AddChild(view);
bitmap->Lock();
view->BeginPicture(new BPicture);
view->SetHighColor(bgcolor);
view->FillRect(view->Bounds());
DrawString(view,fName.String(),false,false);
view->SetDrawingMode(B_OP_BLEND);
DrawBitmap(view,in);
pict = view->EndPicture();
bitmap->Unlock();
delete bitmap;
return pict;
}
示例4: bitmap
BPicture *
PictureTest::RecordPicture(draw_func* func, BRect frame)
{
OffscreenBitmap bitmap(frame, fColorSpace);
TEST_AND_RETURN(bitmap.InitCheck() != B_OK, "Offscreen bitmap for picture recording could not be created!" , NULL);
BView *view = bitmap.View();
// record
BPicture *picture = new BPicture();
view->BeginPicture(picture);
func(view, frame);
picture = view->EndPicture();
return picture;
}
示例5: rect
/*
* Make inside state picture.
*/
BPicture*
HToolbarButton::MakeInsidePicture(BBitmap *in)
{
HToolbar *toolbar = cast_as(Parent(),HToolbar);
BRect buttonRect = toolbar->ButtonRect();
BView *view = new BView(BRect(0,0,buttonRect.Width(),buttonRect.Height())
,"offview",0,0);
BBitmap *bitmap = new BBitmap(view->Bounds(), in->ColorSpace(), true);
BPicture *pict;
bitmap->AddChild(view);
bitmap->Lock();
view->SetDrawingMode(B_OP_ALPHA);
view->SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY);
view->BeginPicture(new BPicture);
DrawBitmap(view,in);
DrawString(view,fName.String());
//view->SetHighColor(White);
//view->FillRect(BRect(0,0,0,22));
//view->FillRect(BRect(0,0,22,0));
//view->SetHighColor(BeShadow);
//view->FillRect(BRect(21,0,21,21));
//view->FillRect(BRect(0,21,21,21));
BRect rect(Bounds());
view->SetDrawingMode(B_OP_OVER);
rect.InsetBy(1,1);
view->BeginLineArray(5);
view->AddLine(rect.LeftTop(), rect.LeftBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
view->AddLine(rect.LeftTop(), rect.RightTop(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_LIGHTEN_MAX_TINT));
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
rect.bottom--;
view->AddLine(rect.LeftBottom(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_1_TINT));
view->AddLine(rect.RightTop(), rect.RightBottom(),
tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
view->EndLineArray();
view->SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_3_TINT));
view->StrokeRect(Bounds());
pict = view->EndPicture();
bitmap->Unlock();
delete bitmap;
return pict;
}
示例6: AttribView
AttribPolygon::AttribPolygon ()
: AttribView (BRect (0, 0, 148, 90), lstring (30, "Polygons"))
{
SetViewColor (LightGrey);
lSlid = new Slider (BRect (8, 8, 140, 26), 60, lstring (310, "Pen Size"), 1, 50, 1, new BMessage ('ALpc'));
AddChild (lSlid);
fPenSize = 1;
fType = POLYGON_OUTFILL;
BBox *type = new BBox (BRect (18, 32, 130, 82), "type");
type->SetLabel (lstring (311, "Type"));
AddChild (type);
BPoint pointArray[] = {
BPoint ( 2, 8),
BPoint ( 9, 2),
BPoint (27, 12),
BPoint (19, 28),
BPoint (14, 20),
BPoint ( 9, 26)
};
BPolygon *poly = new BPolygon();
poly->AddPoints(pointArray, 6);
BWindow *picWindow = new BWindow (BRect (0, 0, 100, 100), "Temp Pic Window", B_BORDERED_WINDOW, uint32 (NULL), uint32 (NULL));
BView *bg = new BView (BRect (0, 0, 100, 100), "Temp Pic View", uint32 (NULL), uint32 (NULL));
picWindow->AddChild (bg);
BPicture *p10;
bg->BeginPicture (new BPicture);
bg->SetLowColor (LightGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetLowColor (White);
bg->FillPolygon (poly, B_SOLID_LOW);
bg->StrokePolygon (poly);
p10 = bg->EndPicture();
BPicture *p20;
bg->BeginPicture (new BPicture);
bg->SetLowColor (LightGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->FillPolygon (poly, B_SOLID_LOW);
p20 = bg->EndPicture();
BPicture *p30;
bg->BeginPicture (new BPicture);
bg->SetLowColor (LightGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->StrokePolygon (poly);
p30 = bg->EndPicture();
BPicture *p11;
bg->BeginPicture (new BPicture);
bg->SetLowColor (DarkGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->FillPolygon (poly, B_SOLID_LOW);
bg->StrokePolygon (poly);
p11 = bg->EndPicture();
BPicture *p21;
bg->BeginPicture (new BPicture);
bg->SetLowColor (DarkGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->FillPolygon (poly, B_SOLID_LOW);
p21 = bg->EndPicture();
BPicture *p31;
bg->BeginPicture (new BPicture);
bg->SetLowColor (DarkGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->StrokePolygon (poly);
p31 = bg->EndPicture();
delete poly;
delete picWindow;
SetViewColor (LightGrey);
pT1 = new BPictureButton (BRect (4, 15, 34, 45), "APVt1", p10, p11, new BMessage ('pvT1'), B_TWO_STATE_BUTTON);
pT2 = new BPictureButton (BRect (40, 15, 70, 45), "APVt2", p20, p21, new BMessage ('pvT2'), B_TWO_STATE_BUTTON);
pT3 = new BPictureButton (BRect (76, 15, 106, 45), "APVt3", p30, p31, new BMessage ('pvT3'), B_TWO_STATE_BUTTON);
type->AddChild (pT1);
type->AddChild (pT2);
type->AddChild (pT3);
pT1->SetValue (B_CONTROL_ON);
fCurrentProperty = 0;
}
示例7: AttribView
AttribRect::AttribRect ()
: AttribView (BRect (0, 0, 148, 90), lstring (31, "Rectangles"))
{
SetViewColor (LightGrey);
lSlid = new Slider (BRect (8, 8, 140, 26), 60, lstring (310, "Pen Size"), 1, 50, 1, new BMessage ('ALpc'));
AddChild (lSlid);
fType = RECT_OUTFILL;
fPenSize = 1;
BBox *type = new BBox (BRect (18, 32, 130, 82), "type");
type->SetLabel (lstring (311, "Type"));
AddChild (type);
BRect shape = BRect (3, 5, 27, 25);
BWindow *picWindow = new BWindow (BRect (0, 0, 100, 100), "Temp Pic Window", B_BORDERED_WINDOW, uint32 (NULL), uint32 (NULL));
BView *bg = new BView (BRect (0, 0, 100, 100), "Temp Pic View", uint32 (NULL), uint32 (NULL));
picWindow->AddChild (bg);
BPicture *p10;
bg->BeginPicture (new BPicture);
bg->SetLowColor (LightGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetLowColor (White);
bg->FillRect (shape, B_SOLID_LOW);
bg->StrokeRect (shape);
p10 = bg->EndPicture();
BPicture *p20;
bg->BeginPicture (new BPicture);
bg->SetLowColor (LightGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->FillRect (shape, B_SOLID_LOW);
p20 = bg->EndPicture();
BPicture *p30;
bg->BeginPicture (new BPicture);
bg->SetLowColor (LightGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->StrokeRect (shape);
p30 = bg->EndPicture();
BPicture *p11;
bg->BeginPicture (new BPicture);
bg->SetLowColor (DarkGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->FillRect (shape, B_SOLID_LOW);
bg->StrokeRect (shape);
p11 = bg->EndPicture();
BPicture *p21;
bg->BeginPicture (new BPicture);
bg->SetLowColor (DarkGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->FillRect (shape, B_SOLID_LOW);
p21 = bg->EndPicture();
BPicture *p31;
bg->BeginPicture (new BPicture);
bg->SetLowColor (DarkGrey);
bg->FillRect (BRect (0, 0, 32, 32), B_SOLID_LOW);
bg->SetHighColor (Black);
bg->SetLowColor (White);
bg->StrokeRect (shape);
p31 = bg->EndPicture();
SetViewColor (LightGrey);
delete picWindow;
pT1 = new BPictureButton (BRect (4, 15, 34, 45), "APVt1", p10, p11, new BMessage ('pvT1'), B_TWO_STATE_BUTTON);
pT2 = new BPictureButton (BRect (40, 15, 70, 45), "APVt2", p20, p21, new BMessage ('pvT2'), B_TWO_STATE_BUTTON);
pT3 = new BPictureButton (BRect (76, 15, 106, 45), "APVt3", p30, p31, new BMessage ('pvT3'), B_TWO_STATE_BUTTON);
type->AddChild (pT1);
type->AddChild (pT2);
type->AddChild (pT3);
pT1->SetValue (B_CONTROL_ON);
fCurrentProperty = 0;
}
示例8: InitWindow
// ToolboxWindow::InitWindow -- Initialization Commands here
void ToolboxWindow::InitWindow(void)
{
BRect r;
r = Bounds();
// Add Controls
// Toolbar
//int ToolbarButtonMargin = 2;
//int ToolbarButtonWidth = 22;
//int ButtonGap = 1;
// StringView Button
BRect BitmapFrame (BRect(0,0,23,23));
BPicture *tmpBPicture;
BPicture *tmpBPicture2;
BView *tmpBPictureView = new BView(BitmapFrame, "tmpBPictureView",B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
rgb_color toolbar_button_background = { 255, 255, 255, 0 };
AddChild(tmpBPictureView);
BBitmap *stringviewpicture = new BBitmap(BitmapFrame,B_RGB32);
stringviewpicture->SetBits(stringviewicon,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(stringviewpicture,BPoint(0,0));
tmpBPicture = tmpBPictureView->EndPicture();
tmpBPictureView->RemoveSelf();
AddChild(tmpBPictureView);
BBitmap *stringviewpicture_state2 = new BBitmap(BitmapFrame,B_RGB32);
stringviewpicture_state2->SetBits(stringviewiconinverse,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(stringviewpicture_state2,BPoint(0,0));
tmpBPicture2 = tmpBPictureView->EndPicture();
btnBrieStringViewControl = new BPictureButton(BRect (1,0,24,23),"StringView",tmpBPicture,tmpBPicture2, new BMessage(TOOLBOX_BTN_STRINGVIEWCONTROL),B_ONE_STATE_BUTTON, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
tmpBPictureView->RemoveSelf();
AddChild(tmpBPictureView);
//--------------------------------------------------------------------//
// TextView Button
BBitmap *textviewpicture = new BBitmap(BitmapFrame,B_RGB32);
textviewpicture->SetBits(brietextcontrol,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(textviewpicture,BPoint(0,0));
tmpBPicture = tmpBPictureView->EndPicture();
tmpBPictureView->RemoveSelf();
AddChild(tmpBPictureView);
BBitmap *textviewpicture_state2 = new BBitmap(BitmapFrame,B_RGB32);
textviewpicture_state2->SetBits(brietextcontrolinverse,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(textviewpicture_state2,BPoint(0,0));
tmpBPicture2 = tmpBPictureView->EndPicture();
btnBrieTextControl = new BPictureButton(BRect (26,0,50,23),"TextControl",tmpBPicture,tmpBPicture2, new BMessage(TOOLBOX_BTN_TEXTCONTROL),B_ONE_STATE_BUTTON, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
tmpBPictureView->RemoveSelf();
AddChild(tmpBPictureView);
//--------------------------------------------------------------------//
// Button Button
BBitmap *buttonpicture = new BBitmap(BitmapFrame,B_RGB32);
buttonpicture->SetBits(stringviewicon,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(buttonpicture,BPoint(0,0));
tmpBPicture = tmpBPictureView->EndPicture();
tmpBPictureView->RemoveSelf();
AddChild(tmpBPictureView);
BBitmap *buttonpicture_state2 = new BBitmap(BitmapFrame,B_RGB32);
buttonpicture_state2->SetBits(stringviewiconinverse,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(buttonpicture_state2,BPoint(0,0));
tmpBPicture2 = tmpBPictureView->EndPicture();
btnBrieButtonControl = new BPictureButton(BRect (1,25,24,48),
"Button",tmpBPicture,tmpBPicture2, new BMessage(TOOLBOX_BTN_BUTTONCONTROL),B_ONE_STATE_BUTTON, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE);
tmpBPictureView->RemoveSelf();
AddChild(tmpBPictureView);
//--------------------------------------------------------------------//
// Picture Button
BBitmap *picturepicture = new BBitmap(BitmapFrame,B_RGB32);
picturepicture->SetBits(stringviewicon,1728,0,B_RGB32);
tmpBPictureView->SetLowColor(toolbar_button_background);
tmpBPictureView->BeginPicture(new BPicture);
tmpBPictureView->DrawBitmap(picturepicture,BPoint(0,0));
tmpBPicture = tmpBPictureView->EndPicture();
//.........这里部分代码省略.........
示例9: rect
void
RowSummaryView::AllAttached()
{
//Bitmaps used to hold the pictures for the Primay key picture button
BRect rect(0,0,13,11);
PrefilledBitmap firstRowOffBitmap(rect, B_COLOR_8_BIT, FirstRowOffRaw, 1344);
PrefilledBitmap firstRowOnBitmap(rect, B_COLOR_8_BIT, FirstRowOnRaw, 1344);
PrefilledBitmap previousRowOffBitmap(rect, B_COLOR_8_BIT, PreviousRowOffRaw, 1344);
PrefilledBitmap previousRowOnBitmap(rect, B_COLOR_8_BIT, PreviousRowOnRaw, 1344);
PrefilledBitmap nextRowOffBitmap(rect, B_COLOR_8_BIT, NextRowOffRaw, 1344);
PrefilledBitmap nextRowOnBitmap(rect, B_COLOR_8_BIT, NextRowOnRaw, 1344);
PrefilledBitmap lastRowOffBitmap(rect, B_COLOR_8_BIT, LastRowOffRaw, 1344);
PrefilledBitmap lastRowOnBitmap(rect, B_COLOR_8_BIT, LastRowOnRaw, 1344);
PrefilledBitmap newRowOffBitmap(rect, B_COLOR_8_BIT, NewRowOffRaw, 1344);
PrefilledBitmap newRowOnBitmap(rect, B_COLOR_8_BIT, NewRowOnRaw, 1344);
PrefilledBitmap previousRowOffDisabledBitmap(rect, B_COLOR_8_BIT, PreviousRowOffDisabledRaw, 1344);
PrefilledBitmap nextRowOffDisabledBitmap(rect, B_COLOR_8_BIT, NextRowOffDisabledRaw, 1344);
PrefilledBitmap newRowOffDisabledBitmap(rect, B_COLOR_8_BIT, NewRowOffDisabledRaw, 1344);
//TempView used to create BPictures
BView *tempView = new BView(rect, "temp", B_FOLLOW_NONE, B_WILL_DRAW);
AddChild(tempView);
//Record BPictures for Off bitmaps
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&firstRowOnBitmap);
BPicture* firstRowPictureOn = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&previousRowOffBitmap);
BPicture* previousRowPictureOff = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&nextRowOffBitmap);
BPicture* nextRowPictureOff = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&lastRowOffBitmap);
BPicture* lastRowPictureOff = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&newRowOffBitmap);
BPicture* newRowPictureOff = tempView->EndPicture();
//Record BPicture for DisabledOff bitmaps
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&previousRowOffDisabledBitmap);
BPicture* previousRowDisabledPictureOff = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&nextRowOffDisabledBitmap);
BPicture* nextRowDisabledPictureOff = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&newRowOffDisabledBitmap);
BPicture* newRowDisabledPictureOff = tempView->EndPicture();
//Record BPictures for On bitmaps
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&firstRowOffBitmap);
BPicture* firstRowPictureOff = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&previousRowOnBitmap);
BPicture* previousRowPictureOn = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&nextRowOnBitmap);
BPicture* nextRowPictureOn = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&lastRowOnBitmap);
BPicture* lastRowPictureOn = tempView->EndPicture();
tempView->BeginPicture(new BPicture);
tempView->DrawBitmap(&newRowOnBitmap);
BPicture* newRowPictureOn = tempView->EndPicture();
RemoveChild(tempView);
delete tempView;
// First Row Button
BMessage* homeMsg = new BMessage(GRID_GOTO_ROW_MSG);
homeMsg->AddInt32("rowNumber", int32(0));
fFirstRowButton = new BPictureButton(BRect(48,1,61,12), "homeButton", firstRowPictureOff,
firstRowPictureOn, homeMsg);
// Previous Row Button
BMessage* prevMsg = new BMessage(GRID_GOTO_PREV_ROW_MSG);
fPreviousRowButton = new BPictureButton(BRect(63,1,76,12), "previousButton",
previousRowPictureOff, previousRowPictureOn, prevMsg);
fPreviousRowButton->SetDisabledOff(previousRowDisabledPictureOff);
//.........这里部分代码省略.........
示例10: if
//.........这里部分代码省略.........
myPrefs->DemoButtonLabel,
DEMOBUTTONMSG,
pholdDemoLayoutMatrix);
kindDemo = KIND_MYBUTTON;
pholdDemo = (void *)pholdDemoMyButton;
}
break;
case SPECIFIC_COLOR_PICTURE:
{
BPicture * pOnPicture;
BPicture * pOnDisabledPicture;
BPicture * pOffPicture;
BPicture * pOffDisabledPicture;
BWindow * bWindow = new BWindow( BRect(0, 0, 32, 32), //manditory for BPicture
NULL,
B_DOCUMENT_WINDOW,
0);
BView * bView = new BView( BRect(0, 0, 32, 32),
NULL,
B_FOLLOW_NONE,
0);
// BWindow bWindow( BRect(0, 0, 32, 32), //manditory for BPicture
// NULL,
// B_DOCUMENT_WINDOW,
// 0);
// BView bView( BRect(0, 0, 32, 32),
// NULL,
// B_FOLLOW_NONE,
// 0);
bWindow->AddChild(bView);
bView->BeginPicture(new BPicture);
bView->MoveTo(5, 5);
bView->StrokeRect(BRect(0,0,8,8));
pOffPicture = bView->EndPicture();
bView->BeginPicture(new BPicture);
bView->MoveTo(10, 5);
bView->StrokeRect(BRect(0,0,10,15));
pOnPicture = bView->EndPicture();
bView->BeginPicture(new BPicture);
bView->MoveTo(2, 5);
bView->FillRect(BRect(0,0,22,20));
pOffDisabledPicture = bView->EndPicture();
bView->BeginPicture(new BPicture);
bView->MoveTo(1, 5);
bView->FillRect(BRect(0,0,6,15));
pOnDisabledPicture = bView->EndPicture();
//bView.RemoveSelf();
bWindow->Run();
bWindow->PostMessage(B_QUIT_REQUESTED);
MyPictureButton * pholdDemoMyPictureButton = new MyPictureButton( BRect(0, 0, 32, 32),
"DemoPictureButton",
pOffPicture,
pOnPicture,
pOffDisabledPicture,
pOnDisabledPicture,
DEMOPICTUREBUTTONMSG,
B_TWO_STATE_BUTTON,//B_ONE_STATE_BUTTON
pholdDemoLayoutMatrix);
kindDemo = KIND_MYPICTUREBUTTON;
pholdDemo = (void *)pholdDemoMyPictureButton;
}
break;
case SPECIFIC_COLOR_RADIOVIEW:
示例11: _InitWindow
//.........这里部分代码省略.........
inputHeight->SetViewColor(200,200,200,255);
inputHeight->SetDrawingMode(B_OP_OVER);
// (inputHeight->TextView())->MakeEditable(false);
pictureSizeView->AddChild(label2);
pictureSizeView->AddChild(inputWidth);
pictureSizeView->AddChild(unit2);
inputWidth->SetViewColor(200,200,200,255);
inputWidth->SetDrawingMode(B_OP_OVER);
// (inputWidth->TextView())->MakeEditable(false);
//---Originalgrößen View---
//+++Neue Größe View+++
BRect newPictureSize = background;
newPictureSize.top=(pictureSize.bottom+3);
newPictureSize.bottom -=50;
BBox *newPictureSizeView=new BBox(newPictureSize,"pictureView2",B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT);
newPictureSizeView->SetLabel(new BStringView(BRect(10,0,50,20),"Label","Neue Größe:"));
outputWidth=new BTextControl(BRect(5,15,newPictureSize.Width()-80,20),"oWidth","Width:","",new BMessage(OUTPUT_WIDTH_CHANGED),B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED);
outputHeight=new BTextControl(BRect(5,35,newPictureSize.Width()-80,20),"oHeight","Height:","",new BMessage(OUTPUT_HEIGHT_CHANGED),B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED);
//Die Maseinheiten auswahl...
BMenu *messureMenu=new BMenu("px",B_ITEMS_IN_COLUMN);
messureMenu->SetRadioMode(true);
messureMenu->SetLabelFromMarked(true);
messureMenu->AddItem(item=new BMenuItem("px",new BMessage(MESSURE_MENU_PIXEL)));
item->SetMarked(true);
messureMenu->AddItem(item=new BMenuItem("%",new BMessage(MESSURE_MENU_PERCENT)));
BMenuField *messureKind=new BMenuField(BRect(newPictureSize.Width()-40,25,newPictureSize.Width()-5,40),"messureKind",NULL,messureMenu,B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT);
BRect rect=BRect(newPictureSize.Width()-75,20,newPictureSize.Width()-45,50);
BView *tmpView = new BView(rect, "temp", B_FOLLOW_NONE, B_WILL_DRAW );
// der Verknüpfungsknop
AddChild(tmpView);
//create on picture
rgb_color back=backView->ViewColor();
//back.alpha=255;
BPicture *on;
tmpView->BeginPicture(new BPicture);
tmpView->SetHighColor(back);
tmpView->FillRect(tmpView->Bounds());
tmpView->BeginLineArray(7);
tmpView->AddLine(BPoint(0,3),BPoint(15,3),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,0),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,6),black);
tmpView->AddLine(BPoint(15,3),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,24),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,30),black);
tmpView->EndLineArray();
on = tmpView->EndPicture();
//create off picture
BPicture *off;
tmpView->BeginPicture(new BPicture);
tmpView->SetHighColor(back);
tmpView->FillRect(tmpView->Bounds());
tmpView->BeginLineArray(8);
tmpView->AddLine(BPoint(0,3),BPoint(15,3),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,0),black);
tmpView->AddLine(BPoint(0,3),BPoint(5,6),black);
tmpView->AddLine(BPoint(15,3),BPoint(15,10),black);
tmpView->AddLine(BPoint(15,20),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(15,27),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,24),black);
tmpView->AddLine(BPoint(0,27),BPoint(5,30),black);
tmpView->EndLineArray();
tmpView->SetPenSize(1.5);
tmpView->SetHighColor(red);
tmpView->StrokeArc(BPoint(15,7),4,2,180,180);
tmpView->StrokeArc(BPoint(15,23),4,2,0,180);
off = tmpView->EndPicture();
//get rid of tmpView
RemoveChild(tmpView);
delete tmpView;
depent = new BPictureButton(rect,"concate", on, off, NULL,B_TWO_STATE_BUTTON,B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT);
newPictureSizeView->AddChild(outputHeight);
newPictureSizeView->AddChild(outputWidth);
newPictureSizeView->AddChild(depent);
newPictureSizeView->AddChild(messureKind);
backView->AddChild(newPictureSizeView);
// BButton *testButton=new BButton(BRect(10,Bounds().Height()-45,70,Bounds().Height()-25),"TestButton","Test",new BMessage(TEST_REQUEST),B_FOLLOW_BOTTOM);
BButton *testButton=new BButton(BRect(Bounds().Width()-60,Bounds().Height()-45,Bounds().Width()-7,Bounds().Height()-25),"TestButton","Berechnen",new BMessage(TEST_REQUEST),B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
// BButton *speichernButton=new BButton(BRect(Bounds().Width()-70,Bounds().Height()-45,Bounds().Width()-10,Bounds().Height()-25),"SaveButton","Save",new BMessage(TEST_REQUEST),B_FOLLOW_RIGHT|B_FOLLOW_BOTTOM);
backView->AddChild(testButton);
// backView->AddChild(speichernButton);
//---Neue Größe View---
pluginWindow=NULL;
LoadPlugins();
}