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; }
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; }
/*********************************************************** * 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; }
/*********************************************************** * Make down state picture. ***********************************************************/ BPicture* HToolbarButton::MakeDownPicture(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->SetHighColor(BeLightShadow); view->FillRect(view->Bounds()); view->BeginPicture(new BPicture); DrawString(view,fName.String(),true); view->SetDrawingMode(B_OP_MIN); DrawBitmap(view,in,true); const float height = view->Bounds().Height(); view->SetDrawingMode(B_OP_OVER); view->SetHighColor(BeShadow); view->FillRect(BRect(0,0,0,height)); view->FillRect(BRect(0,0,height,0)); view->SetHighColor(White); view->FillRect(BRect(height-1,0,height-1,height-1)); view->FillRect(BRect(0,height-1,height-1,height-1)); pict = view->EndPicture(); bitmap->Unlock(); delete bitmap; return pict; }
/*********************************************************** * Make outside state picture. ***********************************************************/ BPicture* HToolbarButton::MakeOutsidePicture(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(BRect(0,0,15,15), 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()); pict = view->EndPicture(); bitmap->Unlock(); delete bitmap; return pict; }
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; }
/* * 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; }
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; }
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; }
// 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(); tmpBPictureView->RemoveSelf(); AddChild(tmpBPictureView); BBitmap *picturepicture_state2 = new BBitmap(BitmapFrame,B_RGB32); picturepicture_state2->SetBits(stringviewiconinverse,1728,0,B_RGB32); tmpBPictureView->SetLowColor(toolbar_button_background); tmpBPictureView->BeginPicture(new BPicture); tmpBPictureView->DrawBitmap(picturepicture_state2,BPoint(0,0)); tmpBPicture2 = tmpBPictureView->EndPicture(); btnBriePictureControl = new BPictureButton(BRect (26,25,50,48), "TextControl",tmpBPicture,tmpBPicture2, new BMessage(TOOLBOX_BTN_PICTURECONTROL),B_ONE_STATE_BUTTON, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE); tmpBPictureView->RemoveSelf(); AddChild(tmpBPictureView); //--------------------------------------------------------------------// AddChild(btnBriePictureControl); AddChild(btnBrieButtonControl); AddChild(btnBrieTextControl); AddChild(btnBrieStringViewControl); // Add the Drawing View AddChild(ptrToolboxWindowView = new ToolboxWindowView(r)); }
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); // Row Number Display BRect frame(80,1,130,12); BRect textRect(0,0,frame.Width(),frame.Height()); fRowNumberDisplay = new RowNumberDisplay(frame, "rowNumberDisplay", textRect, B_FOLLOW_BOTTOM, B_WILL_DRAW|B_NAVIGABLE); BFont font; font.SetSize(10); fRowNumberDisplay->SetFontAndColor(&font); fRowNumberDisplay->SetAlignment(B_ALIGN_RIGHT); fRowNumberDisplay->SetWordWrap(false); // Next Row Button BMessage* nextMsg = new BMessage(GRID_GOTO_NEXT_ROW_MSG); fNextRowButton = new BPictureButton(BRect(134,1,147,12), "nextButton", nextRowPictureOff, nextRowPictureOn, nextMsg); fNextRowButton->SetDisabledOff(nextRowDisabledPictureOff); // Last Row Button BMessage* lastMsg = new BMessage(GRID_GOTO_LAST_ROW_MSG); fLastRowButton = new BPictureButton(BRect(149,1,162,12), "lastButton", lastRowPictureOff, lastRowPictureOn, lastMsg); // New Row Button BMessage* newMsg = new BMessage(GRID_GOTO_NEW_ROW_MSG); fNewRowButton = new BPictureButton(BRect(164,1,177,12), "newButton", newRowPictureOff, newRowPictureOn, newMsg); fNewRowButton->SetDisabledOff(newRowDisabledPictureOff); fNewRowButton->SetDisabledOn(newRowDisabledPictureOff); AddChild(fFirstRowButton); AddChild(fPreviousRowButton); AddChild(fRowNumberDisplay); AddChild(fNextRowButton); AddChild(fLastRowButton); AddChild(fNewRowButton); }
//ctor SpecificColorWindow :: SpecificColorWindow( BRect paramBound, uint32 paramkind) : ScrollingWindow( paramBound, myPrefs->lvwTitleStr[paramkind], lScrollViewName[paramkind], lNamePrefFrame[paramkind], myPrefs->mpPreferenceSet, true, false), mui32Kind(paramkind), mpViewColorControl(NULL), mpHighColorControl(NULL), mpLowColorControl(NULL), mpBarColorControl(NULL), mpFillColorControl(NULL), mpViewColorWell(NULL), mpHighColorWell(NULL), mpLowColorWell(NULL), mpBarColorWell(NULL), mpFillColorWell(NULL), mpBarHeightGadget(NULL), mpColorWellWidthGadget(NULL), mpColorWellHeightGadget(NULL), mpThumbRadioView(NULL), mpCCLrv(NULL), mpSliderBarCB(NULL), mpSliderBarFillCB(NULL), mpDemoItem(NULL) { sem_id calc_sem; if ((calc_sem = create_sem(1, "calc_sem")) < B_NO_ERROR) { warning(myPrefs->FailCreateSemaphore); return; } acquire_sem(calc_sem); try { LayoutMatrix * pholdTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns ///////////////////////////////////////////////////////////////////////////////////////////// BFont * pBFont = new BFont(myPrefs->GetPreferredFont()); float fontSize = pBFont->Size(); fontSize *= 2; if (fontSize > 200) { fontSize = 200; } pBFont->SetSize(fontSize); pBFont->SetShear(122); //will need offset for demo--use a seperate matrix and get it's bottom MyStringDrawer * pMyStringDrawer = new MyStringDrawer( "specificTitleMyStringDrawer", myPrefs->lvwTitleStr[mui32Kind], pholdTitleLayoutMatrix, pBFont); ///////////////////////////// if (!myPrefs->mbUseColorControl && !myPrefs->mbUseColorWell) { warning(myPrefs->noCCenabled); } LayoutMatrix * pholdViewCCLayoutMatrix = NULL; LayoutMatrix * pholdHighCCLayoutMatrix = NULL; LayoutMatrix * pholdLowCCLayoutMatrix = NULL; MyStringDrawer * pMyStringDrawerAXX = NULL; MyStringDrawer * pMyStringDrawerBXX = NULL; MyStringDrawer * pMyStringDrawerCXX = NULL; rgb_color color;//re-use for every setvalue if (myPrefs->mbUseColorControl) { pholdViewCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns ///////////////////////////////////////////////////////////////////////////////////// pMyStringDrawerAXX = new MyStringDrawer( "MyStringDrawerAXX", myPrefs->ColorWindowHeading2, pholdViewCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpViewColorControl = new MyColorControl( myPrefs->mCCL, "ColorControlAXX", COLORCONTROL_VIEW, pholdViewCCLayoutMatrix); switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: myPrefs->GetPreferredMyButtonViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_PICTURE: myPrefs->GetPreferredMyPictureButtonViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_RADIOVIEW: myPrefs->GetPreferredMyRadioViewViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_CHECKBOX: myPrefs->GetPreferredMyCheckBoxViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STATUSBAR: myPrefs->GetPreferredMyStatusBarViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_SLIDER: myPrefs->GetPreferredMySliderViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORCONTROL: myPrefs->GetPreferredMyColorControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_TEXTVIEW: myPrefs->GetPreferredMyTextViewViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_LISTVIEW: myPrefs->GetPreferredMyListViewViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32CONTROL: myPrefs->GetPreferredUInt32ControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT8GADGET: myPrefs->GetPreferredInt8GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT8GADGET: myPrefs->GetPreferredUInt8GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT16GADGET: myPrefs->GetPreferredInt16GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT16GADGET: myPrefs->GetPreferredUInt16GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT32GADGET: myPrefs->GetPreferredInt32GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32GADGET: myPrefs->GetPreferredUInt32GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT64GADGET: myPrefs->GetPreferredInt64GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT64GADGET: myPrefs->GetPreferredUInt64GadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATGADGET: myPrefs->GetPreferredFloatGadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGGADGET: myPrefs->GetPreferredStringGadgetViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATCONTROL: myPrefs->GetPreferredFloatControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGCONTROL: myPrefs->GetPreferredStringControlViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORWELL: myPrefs->GetPreferredColorWellViewColor(&color); mpViewColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGDRAWER: myPrefs->GetPreferredMyStringDrawerViewColor(&color); mpViewColorControl->SetValue(color); break; default: warning(myPrefs->BadSpecColorKindView); throw; break; } ///////////////////// pholdHighCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns //////////////////////////////// pMyStringDrawerBXX = new MyStringDrawer( "MyStringDrawerBXX", myPrefs->ColorWindowHeading3, pholdHighCCLayoutMatrix); ///////////////////////////////////////////// mpHighColorControl = new MyColorControl( myPrefs->mCCL, "HighColorControlBXX", COLORCONTROL_HIGH, pholdHighCCLayoutMatrix); switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: myPrefs->GetPreferredMyButtonHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_PICTURE: myPrefs->GetPreferredMyPictureButtonHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_RADIOVIEW: myPrefs->GetPreferredMyRadioViewHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_CHECKBOX: myPrefs->GetPreferredMyCheckBoxHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STATUSBAR: myPrefs->GetPreferredMyStatusBarHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_SLIDER: myPrefs->GetPreferredMySliderHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORCONTROL: myPrefs->GetPreferredMyColorControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_TEXTVIEW: myPrefs->GetPreferredMyTextViewHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_LISTVIEW: myPrefs->GetPreferredMyListViewHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32CONTROL: myPrefs->GetPreferredUInt32ControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT8GADGET: myPrefs->GetPreferredInt8GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT8GADGET: myPrefs->GetPreferredUInt8GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT16GADGET: myPrefs->GetPreferredInt16GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT16GADGET: myPrefs->GetPreferredUInt16GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT32GADGET: myPrefs->GetPreferredInt32GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32GADGET: myPrefs->GetPreferredUInt32GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT64GADGET: myPrefs->GetPreferredInt64GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT64GADGET: myPrefs->GetPreferredUInt64GadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATGADGET: myPrefs->GetPreferredFloatGadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGGADGET: myPrefs->GetPreferredStringGadgetHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATCONTROL: myPrefs->GetPreferredFloatControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGCONTROL: myPrefs->GetPreferredStringControlHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORWELL: myPrefs->GetPreferredColorWellHighColor(&color); mpHighColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGDRAWER: myPrefs->GetPreferredMyStringDrawerHighColor(&color); mpHighColorControl->SetValue(color); break; default: warning(myPrefs->BadSpecColorKindHigh); throw; break; } ////////////////////////////////////////////////////////////// pholdLowCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////// pMyStringDrawerCXX = new MyStringDrawer( "MyStringDrawerCXX", myPrefs->ColorWindowHeading4, pholdLowCCLayoutMatrix); /////////////////////////////////////////////////////////////////// mpLowColorControl = new MyColorControl( myPrefs->mCCL, "LowColorControlCXX", COLORCONTROL_LOW, pholdLowCCLayoutMatrix); switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: myPrefs->GetPreferredMyButtonLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_PICTURE: myPrefs->GetPreferredMyPictureButtonLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_RADIOVIEW: myPrefs->GetPreferredMyRadioViewLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_CHECKBOX: myPrefs->GetPreferredMyCheckBoxLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STATUSBAR: myPrefs->GetPreferredMyStatusBarLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_SLIDER: myPrefs->GetPreferredMySliderLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORCONTROL: myPrefs->GetPreferredMyColorControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_TEXTVIEW: myPrefs->GetPreferredMyTextViewLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_LISTVIEW: myPrefs->GetPreferredMyListViewLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32CONTROL: myPrefs->GetPreferredUInt32ControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT8GADGET: myPrefs->GetPreferredInt8GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT8GADGET: myPrefs->GetPreferredUInt8GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT16GADGET: myPrefs->GetPreferredInt16GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT16GADGET: myPrefs->GetPreferredUInt16GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT32GADGET: myPrefs->GetPreferredInt32GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT32GADGET: myPrefs->GetPreferredUInt32GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_INT64GADGET: myPrefs->GetPreferredInt64GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_UINT64GADGET: myPrefs->GetPreferredUInt64GadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATGADGET: myPrefs->GetPreferredFloatGadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGGADGET: myPrefs->GetPreferredStringGadgetLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_FLOATCONTROL: myPrefs->GetPreferredFloatControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGCONTROL: myPrefs->GetPreferredStringControlLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_COLORWELL: myPrefs->GetPreferredColorWellLowColor(&color); mpLowColorControl->SetValue(color); break; case SPECIFIC_COLOR_STRINGDRAWER: myPrefs->GetPreferredMyStringDrawerLowColor(&color); mpLowColorControl->SetValue(color); break; default: warning(myPrefs->BadSpecColorKindLow); throw; break; } } //////////////////////// LayoutMatrix * pholdColorWellLayoutMatrix = NULL; if (myPrefs->mbUseColorWell) { pholdColorWellLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 3, this);//rows,columns ////////////// mpViewColorWell = new ColorWell( "ColorWellViewColorPref", VIEW_COLOR, myPrefs->ColorWindowHeading5, this, pholdColorWellLayoutMatrix); /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// mpHighColorWell = new ColorWell( "ColorWellHighColorPref", HIGH_COLOR, myPrefs->ColorWindowHeading6, this, pholdColorWellLayoutMatrix); //////////////////////////////////////////////////////////////////////////////////////////////////// mpLowColorWell = new ColorWell( "ColorWellLowColorPref", LOW_COLOR, myPrefs->ColorWindowHeading7, this, pholdColorWellLayoutMatrix); } /////////////////////////////////////////////////////////////////////// LayoutMatrix * pholdDemoLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns ////////////////////////////////// int32 kindDemo; void * pholdDemo; switch (mui32Kind) { case SPECIFIC_COLOR_BUTTON: { MyButton * pholdDemoMyButton = new MyButton( "demoButton", 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: { BList * pBList = new BList(); RadioViewData * pRadioViewDataOne = new RadioViewData( '_one', myPrefs->DemoRadio1Label, pBList); RadioViewData * pRadioViewDataTwo = new RadioViewData( '_two', myPrefs->DemoRadio2Label, pBList); RadioViewData * pRadioViewDataThree = new RadioViewData( 'thre', myPrefs->DemoRadio3Label, pBList); MyRadioView * pholdMyRadioView = new MyRadioView( "demoRadio", false,//true gives vertical orientation pBList, myPrefs->GetPreferredFont(), pholdDemoLayoutMatrix); if (!pholdMyRadioView->Initialize()) { warning(myPrefs->RadioViewFailInit); throw; } kindDemo = KIND_MYRADIOVIEW; pholdDemo = (void *)pholdMyRadioView; } break; case SPECIFIC_COLOR_CHECKBOX: { MyCheckBox * pholdCheckBox = new MyCheckBox( "checkBox", myPrefs->DemoCheckBoxLabel, B_CONTROL_ON, '_one', pholdDemoLayoutMatrix); kindDemo = KIND_MYCHECKBOX; pholdDemo = (void *)pholdCheckBox; } break; case SPECIFIC_COLOR_STATUSBAR: { MyStatusBar * pholdStatusBar = new MyStatusBar( "StatusBar", myPrefs->DemoStatusBarLeadLabel, myPrefs->DemoStatusBarTrailLabel, 50, 10.0, pholdDemoLayoutMatrix); kindDemo = KIND_MYSTATUSBAR; pholdDemo = (void *)pholdStatusBar; } break; case SPECIFIC_COLOR_SLIDER: { MySlider * pholdSlider = new MySlider( BRect(1, 1, 65, 32), "Slider", "Label", 'Sldr', 1, 10, .5, pholdDemoLayoutMatrix); kindDemo = KIND_MYSLIDER; pholdDemo = (void *)pholdSlider; } break; case SPECIFIC_COLOR_COLORCONTROL: { MyColorControl * pholdColorControl = new MyColorControl( myPrefs->mCCL, "ColorControl", DEMOCOLORCONTROLMSG, pholdDemoLayoutMatrix); kindDemo = KIND_MYCOLORCONTROL; pholdDemo = (void *)pholdColorControl; } break; case SPECIFIC_COLOR_TEXTVIEW: { float leftOffset; float baseline; float width; float height; if (!StringBoundsBox( myPrefs->TextGadgetLabel, &width, &height, &leftOffset, &baseline)) { throw; } MyTextView * pholdTextView = new MyTextView( "textView", NULL, width, 6 * height,//allow 6 lines visible pholdDemoLayoutMatrix); rgb_color textColor; myPrefs->GetPreferredMyTextViewHighColor(&textColor); pholdTextView->SetFontAndColor(myPrefs->GetPreferredFont(), B_FONT_ALL, &textColor); pholdTextView->SetText(myPrefs->TextGadgetLabel); kindDemo = KIND_MYTEXTVIEW; pholdDemo = (void *)pholdTextView; } break; case SPECIFIC_COLOR_LISTVIEW: { DataList * dataList = new DataList(); DataNode * nodeOne = new DataNode(myPrefs->ListViewSample1); dataList->AddItem(nodeOne); DataNode * nodeTwo = new DataNode(myPrefs->ListViewSample2); dataList->AddItem(nodeTwo); DataNode * nodeThree = new DataNode(myPrefs->ListViewSample3); dataList->AddItem(nodeThree); MyListView * mlv = new MyListView( "mlvTitle", dataList, 'selc', 'invc', B_SINGLE_SELECTION_LIST, pholdDemoLayoutMatrix); kindDemo = KIND_MYLISTVIEW; pholdDemo = (void *)mlv; } break; case SPECIFIC_COLOR_INT8GADGET: { Int8Gadget * pholdInt8Gadget = new Int8Gadget( MIN_I8, "int8Gadget", myPrefs->GetInt8GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT8GADGET; pholdDemo = (void *)pholdInt8Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt8Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT8GADGET: { UInt8Gadget * pholdUInt8Gadget = new UInt8Gadget( MAX_UI8, "uInt8Gadget", myPrefs->GetUInt8GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT8GADGET; pholdDemo = (void *)pholdUInt8Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt8Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_INT16GADGET: { Int16Gadget * pholdInt16Gadget = new Int16Gadget( MIN_I16, "int16Gadget", myPrefs->GetInt16GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT16GADGET; pholdDemo = (void *)pholdInt16Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt16Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT16GADGET: { UInt16Gadget * pholdUInt16Gadget = new UInt16Gadget( MAX_UI16, "uInt16Gadget", myPrefs->GetUInt16GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT16GADGET; pholdDemo = (void *)pholdUInt16Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt16Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_INT32GADGET: { Int32Gadget * pholdInt32Gadget = new Int32Gadget( MIN_I32, "int32Gadget", myPrefs->GetInt32GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT32GADGET; pholdDemo = (void *)pholdInt32Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt32Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT32GADGET: { UInt32Gadget * pholdUInt32Gadget = new UInt32Gadget( MAX_UI32, "uInt32Gadget", myPrefs->GetUInt32GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT32GADGET; pholdDemo = (void *)pholdUInt32Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt32Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_INT64GADGET: { Int64Gadget * pholdInt64Gadget = new Int64Gadget( MIN_I64, "int64Gadget", myPrefs->GetInt64GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_INT64GADGET; pholdDemo = (void *)pholdInt64Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterIntNumeric); pholdInt64Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_UINT64GADGET: { UInt64Gadget * pholdUInt64Gadget = new UInt64Gadget( MAX_UI64, "uInt64Gadget", myPrefs->GetUInt64GadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_UINT64GADGET; pholdDemo = (void *)pholdUInt64Gadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); pholdUInt64Gadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_FLOATGADGET: { FloatGadget * pholdFloatGadget = new FloatGadget( (float)12.34, "floatGadget", myPrefs->GetFloatGadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_FLOATGADGET; pholdDemo = (void *)pholdFloatGadget; BMessageFilter * bmfDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterFloatNumeric); pholdFloatGadget->AddFilter(bmfDemo); } break; case SPECIFIC_COLOR_STRINGGADGET: { StringGadget * pholdStringGadget = new StringGadget( myPrefs->GetStringGadgetLabel, "stringGadget", myPrefs->GetStringGadgetLabel, 0, this, pholdDemoLayoutMatrix); kindDemo = KIND_STRINGGADGET; pholdDemo = (void *)pholdStringGadget; } break; case SPECIFIC_COLOR_UINT32CONTROL: { UInt32Control * pholdUInt32Control = new UInt32Control( 123, "uInt32Control", myPrefs->UInt32ControlLabel, DEMOINTCONTROLMSG, 0, pholdDemoLayoutMatrix); kindDemo = KIND_UINT32CONTROL; pholdDemo = (void *)pholdUInt32Control; } break; case SPECIFIC_COLOR_FLOATCONTROL: { FloatControl * pholdFloatControl = new FloatControl( (float)1.23, "floatControl", myPrefs->FloatControlLabel, DEMOFLOATCONTROLMSG, 0, pholdDemoLayoutMatrix); kindDemo = KIND_FLOATCONTROL; pholdDemo = (void *)pholdFloatControl; } break; case SPECIFIC_COLOR_STRINGCONTROL: { StringControl * pholdStringControl = new StringControl( "stringControlName", myPrefs->StringControlLabel, NULL, DEMOSTRINGCONTROLMSG, 0, pholdDemoLayoutMatrix); kindDemo = KIND_STRINGCONTROL; pholdDemo = (void *)pholdStringControl; } break; case SPECIFIC_COLOR_COLORWELL: { ColorWell * pholdColorWell = new ColorWell( "colorWell", NO_COLOR, myPrefs->DemoRoLabel, this, pholdDemoLayoutMatrix); kindDemo = KIND_COLORWELL; pholdDemo = (void *)pholdColorWell; } break; case SPECIFIC_COLOR_STRINGDRAWER: { MyStringDrawer * pholdMyStringDrawer = new MyStringDrawer( "stringDrawer", myPrefs->DemoTextItemText, pholdDemoLayoutMatrix); kindDemo = KIND_STRINGDRAWER; pholdDemo = (void *)pholdMyStringDrawer; } break; default: warning(myPrefs->BadSpecItemKind); throw; break; } mpDemoItem = pholdDemo; ///////////////////// LayoutMatrix * pholdBarTitleLayoutMatrix = NULL; LayoutMatrix * pholdBarCCLayoutMatrix = NULL; LayoutMatrix * pholdBarCWLayoutMatrix = NULL; LayoutMatrix * pholdBarHLayoutMatrix = NULL; LayoutMatrix * pholdColorWellWHLayoutMatrix = NULL; LayoutMatrix * pholdSliderLayoutMatrix = NULL; LayoutMatrix * pholdFillCCLayoutMatrix = NULL; LayoutMatrix * pholdFillCWLayoutMatrix = NULL; LayoutMatrix * pholdCCLLayoutMatrix = NULL; /////////////////////////// if (mui32Kind == SPECIFIC_COLOR_STATUSBAR) { pholdBarTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns //////////////////////////////////////////////////////////////// BFont * pBFontBar = new BFont(myPrefs->GetPreferredFont()); float fontSize = pBFontBar->Size(); fontSize *= 2; if (fontSize > 200) { fontSize = 200; } pBFontBar->SetSize(fontSize); pBFontBar->SetShear(122); //will need offset for demo--use a seperate matrix and get it's bottom MyStringDrawer * pBarMyStringDrawer = new MyStringDrawer( "specificTitleBarMyStringDrawer", myPrefs->BarColorTitle, pholdBarTitleLayoutMatrix, pBFontBar); ////////////////////////////////////////////////// if (myPrefs->mbUseColorControl) { pholdBarCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////////////////////////////////////// MyStringDrawer * pBarMyStringDrawerAXX = new MyStringDrawer( "BarMyStringDrawerAXX", myPrefs->BarCCLabel, pholdBarCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpBarColorControl = new MyColorControl( myPrefs->mCCL, "barColorControl", BARCOLORCONTROL, pholdBarCCLayoutMatrix); myPrefs->GetPreferredMyBarStatusColor(&color); mpBarColorControl->SetValue(color); } ////////////////////////////////////// if (myPrefs->mbUseColorWell) { pholdBarCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns /////////////////////////////////////////// mpBarColorWell = new ColorWell( "ColorWellViewColorPref", BAR_COLOR, myPrefs->BarCWLabel, this, pholdBarCWLayoutMatrix); } /////////////////////////////////////////// pholdBarHLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns ////////////////////////////////////////////////////////////////////////// mpBarHeightGadget = new FloatGadget( myPrefs->GetPreferredBarHeight(), "BarHeightFloatGadget", myPrefs->EnterBarHeightLabel, 0, this, pholdBarHLayoutMatrix); BMessageFilter * bmfBHDemo = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterFloatNumeric); mpBarHeightGadget->AddFilter(bmfBHDemo); } ///////////////////////////////////////////////////////////////// else if (mui32Kind == SPECIFIC_COLOR_COLORCONTROL) { pholdCCLLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns ////////////////////////////////////////////////////////////////////////// BFont * pCCLFont = new BFont(myPrefs->GetPreferredFont()); float fontSize = pCCLFont->Size(); fontSize *= 1.5; if (fontSize > 200) { fontSize = 200; } pCCLFont->SetSize(fontSize); MyStringDrawer * pCCLMyStringDrawer = new MyStringDrawer( "CCLMyStringDrawer", myPrefs->ColorControlKind, pholdCCLLayoutMatrix, pCCLFont); BList * bl = new BList(); RadioViewData * pRVD4x64 = new RadioViewData( CCL4x64RV, myPrefs->CC_4x64_Cell, bl, (B_CELLS_4x64 == myPrefs->mCCL)); RadioViewData * pRVD8x32 = new RadioViewData( CCL8x32RV, myPrefs->CC_8x32_Cell, bl, (B_CELLS_8x32 == myPrefs->mCCL)); RadioViewData * pRVD16x16 = new RadioViewData( CCL16x16RV, myPrefs->CC_16x16_Cell, bl, (B_CELLS_16x16 == myPrefs->mCCL)); RadioViewData * pRVD32x8 = new RadioViewData( CCL32x8RV, myPrefs->CC_32x8_Cell, bl, (B_CELLS_32x8 == myPrefs->mCCL)); RadioViewData * pRVD64x4 = new RadioViewData( CCL64x4RV, myPrefs->CC_64x4_Cell, bl, (B_CELLS_64x4 == myPrefs->mCCL)); mpCCLrv = new MyRadioView( "CCLRadioView", false, bl, myPrefs->GetPreferredFont(), pholdCCLLayoutMatrix); if (!mpCCLrv->Initialize()) { warning(myPrefs->RadioViewFailInit); throw; } ////////////////////////////////////////////////////////////////////////// } else if (mui32Kind == SPECIFIC_COLOR_SLIDER) { pholdBarTitleLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns //////////////////////////////////////////////////////////////// BFont * pBFontBar = new BFont(myPrefs->GetPreferredFont()); float fontSize = pBFontBar->Size(); fontSize *= 2; if (fontSize > 200) { fontSize = 200; } pBFontBar->SetSize(fontSize); pBFontBar->SetShear(122); //will need offset for demo--use a seperate matrix and get it's bottom MyStringDrawer * pBarMyStringDrawer = new MyStringDrawer( "specificTitleBarMyStringDrawer", myPrefs->BarColorTitle, pholdBarTitleLayoutMatrix, pBFontBar); ////////////////////////////////////////////////// if (myPrefs->mbUseColorControl) { pholdBarCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////////////////////////////////////// MyStringDrawer * pBarMyStringDrawerAXX = new MyStringDrawer( "BarMyStringDrawerAXX", myPrefs->BarCCLabel, pholdBarCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpBarColorControl = new MyColorControl( myPrefs->mCCL, "barColorControl", BARCOLORCONTROL, pholdBarCCLayoutMatrix); myPrefs->GetPreferredMyBarStatusColor(&color); mpBarColorControl->SetValue(color); } ////////////////////////////////////// if (myPrefs->mbUseColorWell) { pholdBarCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns /////////////////////////////////////////// mpBarColorWell = new ColorWell( "ColorWellViewColorPref", BAR_COLOR, myPrefs->BarCWLabel, this, pholdBarCWLayoutMatrix); } //////////////////////////////////////// if (myPrefs->mbUseColorControl) { pholdFillCCLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns /////////////////////////////////////////////////////////////////////////////////// MyStringDrawer * pFillMSD = new MyStringDrawer( "FillMSD", myPrefs->FillCCLabel, pholdFillCCLayoutMatrix); //////////////////////////////////////////////////////////////////// mpFillColorControl = new MyColorControl( myPrefs->mCCL, "fillColorControl", FILLCOLORCONTROL, pholdFillCCLayoutMatrix); myPrefs->GetPreferredMyBarFillSliderColor(&color); mpFillColorControl->SetValue(color); } ////////////////////////////////////// if (myPrefs->mbUseColorWell) { pholdFillCWLayoutMatrix = new LayoutMatrix(BESTSIZE, 1, 1, this);//rows,columns /////////////////////////////////////////// mpFillColorWell = new ColorWell( "ColorWellViewColorPref", FILL_COLOR, myPrefs->FillCWLabel, this, pholdFillCWLayoutMatrix); } /////////////////////////////////////////// pholdSliderLayoutMatrix = new LayoutMatrix(BESTSIZE, 3, 1, this);//rows,columns ////////////////////////////////////// mpSliderBarCB = new MyCheckBox( "SliderBarCheckBox", myPrefs->ColorSliderBarCBLabel, myPrefs->mui32ColorSliderBar, SLIDERBARCB, pholdSliderLayoutMatrix); mpSliderBarFillCB = new MyCheckBox( "SliderBarCheckBoxFill", myPrefs->FillSliderBarCBLabel, myPrefs->mui32FillSliderBar, SLIDERBARFILLCB, pholdSliderLayoutMatrix); BList * bl = new BList(); RadioViewData * pRVDOne = new RadioViewData( THUMB_RECT, myPrefs->DemoRadioLabelThumbRect, bl, (B_BLOCK_THUMB == myPrefs->GetPreferredThumbStyle())); RadioViewData * pRVDTwo = new RadioViewData( THUMB_TRI, myPrefs->DemoRadioLabelThumbTri, bl, (B_TRIANGLE_THUMB == myPrefs->GetPreferredThumbStyle())); mpThumbRadioView = new MyRadioView( "thumbRadioView", true, bl, myPrefs->GetPreferredFont(), pholdSliderLayoutMatrix); if (!mpThumbRadioView->Initialize()) { warning(myPrefs->RadioViewFailInit); throw; } } ///////////////////////////////////////////////////////////////////////////////////// else if (mui32Kind == SPECIFIC_COLOR_COLORWELL) { pholdColorWellWHLayoutMatrix = new LayoutMatrix(BESTSIZE, 2, 1, this);//rows,columns //////////////////////////////////////////////////////////////// mpColorWellWidthGadget = new UInt8Gadget( myPrefs->GetPreferredColorWellWidth(), "ColorWellWidthGadget", myPrefs->EnterColorWellWidthLabel, 0, this, pholdColorWellWHLayoutMatrix); BMessageFilter * bmfW = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); mpColorWellWidthGadget->AddFilter(bmfW); ////////////////////////////////////////////////////////////// mpColorWellHeightGadget = new UInt8Gadget( myPrefs->GetPreferredColorWellHeight(), "ColorWellHeightGadget", myPrefs->EnterColorWellHeightLabel, 0, this, pholdColorWellWHLayoutMatrix); BMessageFilter * bmfH = new BMessageFilter( B_PROGRAMMED_DELIVERY, B_LOCAL_SOURCE, '_KYD', filterUIntNumeric); mpColorWellHeightGadget->AddFilter(bmfH); //////////////////// } ///////////////////////////////////////////////////////////// release_sem(calc_sem); pholdTitleLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, MATRIXVERTICALOFFSET, calc_sem); float bottom = pholdTitleLayoutMatrix->mfBottom; float right = MATRIXHORIZONTALOFFSET; if (myPrefs->mbUseColorControl) { pholdViewCCLayoutMatrix->Calc(right, bottom, calc_sem); pholdHighCCLayoutMatrix->Calc(pholdViewCCLayoutMatrix->mfRight, bottom, calc_sem); pholdLowCCLayoutMatrix->Calc(pholdHighCCLayoutMatrix->mfRight, bottom, calc_sem); bottom = pholdLowCCLayoutMatrix->mfBottom; if (bottom < pholdHighCCLayoutMatrix->mfBottom) { bottom = pholdHighCCLayoutMatrix->mfBottom; } if (bottom < pholdViewCCLayoutMatrix->mfBottom) { bottom = pholdViewCCLayoutMatrix->mfBottom; } right = pholdLowCCLayoutMatrix->mfRight; } float cwRight = MATRIXHORIZONTALOFFSET; if (myPrefs->mbUseColorWell) { pholdColorWellLayoutMatrix->Calc(cwRight, bottom, calc_sem); bottom = pholdColorWellLayoutMatrix->mfBottom; cwRight = pholdColorWellLayoutMatrix->mfRight; } if (cwRight > right) { right = cwRight; } pholdDemoLayoutMatrix->Calc(right, pholdTitleLayoutMatrix->mfBottom, calc_sem); if ( (mui32Kind == SPECIFIC_COLOR_STATUSBAR) || (mui32Kind == SPECIFIC_COLOR_SLIDER)) { pholdBarTitleLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem); if (myPrefs->mbUseColorControl) { pholdBarCCLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); bottom = pholdBarCCLayoutMatrix->mfBottom; } if (myPrefs->mbUseColorWell) { pholdBarCWLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem); bottom = pholdBarCWLayoutMatrix->mfBottom; } float ccRightSB = cwRight; float cwRightSB = cwRight; if (myPrefs->mbUseColorControl) { ccRightSB = pholdBarCCLayoutMatrix->mfRight; } if (myPrefs->mbUseColorWell) { cwRightSB = pholdBarCWLayoutMatrix->mfRight; } if (ccRightSB > cwRightSB) { cwRightSB = ccRightSB; } if (mui32Kind == SPECIFIC_COLOR_STATUSBAR) { pholdBarHLayoutMatrix->Calc(cwRightSB, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); } else //if (mui32Kind == SPECIFIC_COLOR_SLIDER) { if (myPrefs->mbUseColorControl) { pholdFillCCLayoutMatrix->Calc(cwRightSB, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); bottom = pholdFillCCLayoutMatrix->mfBottom; } else { bottom = pholdBarTitleLayoutMatrix->mfBottom; } if (myPrefs->mbUseColorWell) { pholdFillCWLayoutMatrix->Calc(cwRightSB, bottom, calc_sem); } float fccRightSB = cwRightSB; float fcwRightSB = cwRightSB; if (myPrefs->mbUseColorControl) { fccRightSB = pholdFillCCLayoutMatrix->mfRight; } if (myPrefs->mbUseColorWell) { fcwRightSB = pholdFillCWLayoutMatrix->mfRight; } if (fccRightSB > fcwRightSB) { fcwRightSB = fccRightSB; } pholdSliderLayoutMatrix->Calc(fcwRightSB + 3, pholdBarTitleLayoutMatrix->mfBottom, calc_sem); } } else if (mui32Kind == SPECIFIC_COLOR_COLORWELL) { pholdColorWellWHLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom, calc_sem); } else if (mui32Kind == SPECIFIC_COLOR_COLORCONTROL) { pholdCCLLayoutMatrix->Calc(MATRIXHORIZONTALOFFSET, bottom + 3, calc_sem); } } catch (...) { warning(myPrefs->CaughtSpecificColorWindowCTOR); release_sem(calc_sem); throw; } try { BMenuItem * menuItem; BMenu * APPMenu = new BMenu(myPrefs->AppMenuLabel); menuItem = new BMenuItem( myPrefs->AboutMenuLabel, new BMessage(ABOUT_SPECIFICCOLORWINDOW)); APPMenu->AddItem(menuItem); menuItem = new BMenuItem( myPrefs->CloseWindow, new BMessage(B_QUIT_REQUESTED)); APPMenu->AddItem(menuItem); menuItem = new BMenuItem( myPrefs->QuitMenuLabel, new BMessage(QUIT_APP)); APPMenu->AddItem(menuItem); mpMenuBar->AddItem(APPMenu); } catch(...) { throw; } }//end
//Build up GUI eg MenuBar void ImmersiveVideoWindow::_InitWindow(void) { BRect r; BMenu *menu; BMenuItem *item; //++++MenuBar++++ r = Bounds(); menubar = new BMenuBar(r, "menu_bar"); // Add File menu to menu bar menu = new BMenu("File"); // menu->AddItem(new BMenuItem("New", new BMessage(MENU_FILE_NEW), 'N')); menu->AddItem(item=new BMenuItem("Open" B_UTF8_ELLIPSIS,new BMessage(MENU_FILE_OPEN), 'O')); item->SetTarget(be_app); menu->AddItem(item=new BMenuItem("Close", new BMessage(MENU_FILE_CLOSE), 'W')); item->SetTarget(be_app); menu->AddSeparatorItem(); menu->AddItem(saveitem=new BMenuItem("Save", new BMessage(MENU_FILE_SAVE), 'S')); // saveitem->SetEnabled(false); //saveitem->SetTarget(be_app); //menu->AddItem(item=new BMenuItem("Save as" B_UTF8_ELLIPSIS,new BMessage(MENU_FILE_SAVEAS))); //item->SetTarget(be_app); menu->AddSeparatorItem(); menu->AddItem(item=new BMenuItem("Export" B_UTF8_ELLIPSIS,new BMessage(MENU_FILE_EXPORT))); item->SetTarget(be_app); menu->AddSeparatorItem(); menu->AddItem(item=new BMenuItem("Page Setup" B_UTF8_ELLIPSIS,new BMessage(MENU_FILE_PAGESETUP))); item->SetEnabled(false); item->SetTarget(be_app); menu->AddItem(item=new BMenuItem("Print" B_UTF8_ELLIPSIS,new BMessage(MENU_FILE_PRINT), 'P')); item->SetTarget(be_app); item->SetEnabled(false); menu->AddSeparatorItem(); menu->AddItem(item=new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q')); item->SetTarget(be_app); menubar->AddItem(menu); // Add the Edit menu to the menu bar edit = new BMenu("Edit"); edit->AddItem(item=new BMenuItem("Undo", new BMessage(B_UNDO), 'Z')); // edit->AddItem(item=new BMenuItem("Redo", new BMessage(B_REDO), 'Z')); edit->AddSeparatorItem(); edit->AddItem(item=new BMenuItem("Cut", new BMessage(B_CUT), 'X')); edit->AddItem(item=new BMenuItem("Copy", new BMessage(B_COPY), 'C')); edit->AddItem(item=new BMenuItem("Paste", new BMessage(B_PASTE), 'V')); edit->AddSeparatorItem(); edit->AddItem(item=new BMenuItem("Preferences", new BMessage(MENU_EDIT_PREFERENCES), 'A')); menubar->AddItem(edit); // Attach the menu bar to he window AddChild(menubar); //----MenuBar---- //++++GUI++++ //+++BackView+++ BRect background= Bounds(); background.top = menubar->Bounds().bottom + 1.0; BView *backView=new BView(background,"hintergrund",B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED); AddChild(backView); backView->SetViewColor(216,216,216); //---BackView--- //+++PluginListe+++ BRect pluginListFrame = background; pluginListFrame.right -= B_V_SCROLL_BAR_WIDTH; pluginListFrame.bottom -= 180; //**nur notwendig wenn wir unten ein Scrollbar einführen wollen // pluginListFrame.bottom -= B_V_SCROLL_BAR_WIDTH; pluginListFrame.InsetBy(2,2); listView = new BListView(pluginListFrame, "plugin_view", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED); scrollView = new BScrollView("scroll_view", listView, B_FOLLOW_ALL_SIDES, B_SUBPIXEL_PRECISE, false, true); backView->AddChild(scrollView); listView->MakeFocus(true); listView->SetSelectionMessage(new BMessage(PLUGINLIST_SELECTION_CHANGED)); //---PluginListe--- //+++Originalgrößen View+++ BRect pictureSize = background; pictureSize.top=(pluginListFrame.bottom+5); pictureSize.bottom -=115; BBox *pictureSizeView=new BBox(pictureSize,"pictureView1",B_FOLLOW_BOTTOM|B_FOLLOW_LEFT_RIGHT); backView->AddChild(pictureSizeView); pictureSizeView->SetLabel(new BStringView(BRect(10,0,50,20),"Label","Originalgröße:")); BStringView *label1=new BStringView(BRect(5,20,45,35),"Label1","Width:", B_FOLLOW_BOTTOM|B_FOLLOW_LEFT , B_WILL_DRAW|B_PULSE_NEEDED); BStringView *unit1=new BStringView(BRect(pictureSize.Width()-75,20,pictureSize.Width()-60,35),"Unit1","px", B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT , B_WILL_DRAW|B_PULSE_NEEDED); inputWidth=new BStringView(BRect(65,20,pictureSize.Width()-80,35),"iWidth","",B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED); BStringView *label2=new BStringView(BRect(5,40,45,55),"Label2","Height:", B_FOLLOW_BOTTOM|B_FOLLOW_LEFT, B_WILL_DRAW|B_PULSE_NEEDED); BStringView *unit2=new BStringView(BRect(pictureSize.Width()-75,40,pictureSize.Width()-60,55),"Unit2","px", B_FOLLOW_BOTTOM|B_FOLLOW_RIGHT , B_WILL_DRAW|B_PULSE_NEEDED); inputHeight=new BStringView(BRect(65,40,pictureSize.Width()-80,55),"iHeight","",B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED); pictureSizeView->AddChild(label1); pictureSizeView->AddChild(inputHeight); pictureSizeView->AddChild(unit1); 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(); }