/***********************************************************
 * MessageReceived
 ***********************************************************/
void
HAddTrackerWindow::MessageReceived(BMessage *message)
{
	switch(message->what)
	{
	case M_OK_MSG:
	{
		BTextControl *control1 = cast_as(FindView("name"),BTextControl);
		BTextControl *control2 = cast_as(FindView("address"),BTextControl);
		const char* name = control1->Text();
		const char* address = control2->Text();
		this->SaveTracker(name,address);
		this->PostMessage(B_QUIT_REQUESTED);
		break;
	}
	case M_END_NAME:
	{
		BTextControl *control1 = cast_as(FindView("name"),BTextControl);
		BTextControl *control2 = cast_as(FindView("address"),BTextControl);

		control2->SetText(control1->Text());
		control2->TextView()->SelectAll();
		break;
	}
	default:
		BWindow::MessageReceived(message);
	}
}
/***********************************************************
 * SetFrom
 ***********************************************************/
void
HAddressView::SetFrom(const char* in_address)
{
	if( ::strlen(in_address) == 0)
		return;
	BString address(in_address);
	
	// Compare existing accounts	
	char name[B_FILE_NAME_LENGTH];
	BPath path;
	::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
	path.Append(APP_NAME);
	path.Append("Accounts");
	BDirectory dir(path.Path());
	status_t err = B_OK;
	BEntry entry;
	bool changed = false;
	
	while(err == B_OK)
	{
		if( (err = dir.GetNextEntry(&entry)) != B_OK  )
			break;
		BFile file(&entry,B_READ_ONLY);
		if(file.InitCheck() == B_OK && entry.IsFile())
		{
			BMessage msg;
			msg.Unflatten(&file);
			BString myAddress;
			PRINT(("%s\n",in_address));
			if(msg.FindString("address",&myAddress) != B_OK)
				myAddress = "";
			// Change account
			if(address.FindFirst(myAddress) != B_ERROR)
			{
				entry.GetName(name);	
				ChangeAccount(name);
				// Set From menu
				BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
				BMenu *menu = field->Menu();
				BMenuItem *item = menu->FindItem(name);
				if(item)
					item->SetMarked(true);
				changed=true;
				break;
			}
		}
	}
	
	if(!changed && cast_as(Window()->FindView("HMailView"),BTextView))
	{
		BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
		BMenuItem *item(NULL);
		item = field->Menu()->FindMarked();
		if(item)
		{
			ChangeAccount(item->Label());
			item->SetMarked(true);	
		}
	}
}
Exemple #3
0
/***********************************************************
 * DeleteItem
 ***********************************************************/
void
HListView::DeleteItem(int32 index) {
	HListItem* item = cast_as(RemoveItem(index), HListItem);
	fPointerList.RemoveItem(item);
	delete item;

	HApp* app = cast_as(be_app, HApp);
	bool queue;

	int32 max_transfer;
	app->Prefs()->GetData("queue", &queue);
	app->Prefs()->GetData("max_transfer", &max_transfer);

	if (queue) {
		int32 num_task = max_transfer - CountDownloadingItems();
		if (num_task > 0) {
			int32 count = CountItems();
			HListItem** items = (HListItem**)Items();
			for (int32 i = 0; i < count; i++) {
				item = items[i];
				if (!item->IsStarted() && item->State() != T_FINISHED && item->State() != T_NOTFOUND) {
					item->Start();
					num_task--;
				}
				if (num_task <= 0)
					break;
			}
		}
	}
}
/***********************************************************
 * 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;
}
/***********************************************************
 * Constructor.
 ***********************************************************/
HAddTrackerWindow::HAddTrackerWindow(BRect rect,const char* name)
		:BWindow(rect,name,B_TITLED_WINDOW_LOOK,B_MODAL_APP_WINDOW_FEEL,B_NOT_RESIZABLE|B_NOT_ZOOMABLE|B_ASYNCHRONOUS_CONTROLS)
{
	InitGUI();
	BTextControl *control = cast_as(FindView("name"),BTextControl);
	control->MakeFocus(true);
}
/***********************************************************
 * 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;
}
Exemple #8
0
BBitmap* ThresholdManipulator::ManipulateBitmap(ManipulatorSettings *set,BBitmap *original,Selection *selection,BStatusBar *status_bar)
{
	ThresholdManipulatorSettings *new_settings = cast_as(set,ThresholdManipulatorSettings);

	if (new_settings == NULL)
		return NULL;

	if (original == NULL)
		return NULL;

	if (original == preview_bitmap) {
		if ((*new_settings == previous_settings) && (last_calculated_resolution <= 1))
			return original;

		source_bitmap = copy_of_the_preview_bitmap;
		target_bitmap = original;
	}
	else {
		source_bitmap = original;
		target_bitmap = new BBitmap(original->Bounds(),B_RGB32,FALSE);
	}


	current_resolution = 1;
	current_selection = selection;
	current_settings = *new_settings;
	progress_bar = status_bar;

	start_threads();

	return target_bitmap;
}
Exemple #9
0
void ThresholdManipulator::ChangeSettings(ManipulatorSettings *s)
{
	ThresholdManipulatorSettings *new_settings;
	new_settings = cast_as(s,ThresholdManipulatorSettings);
	if (new_settings != NULL) {
		settings = *new_settings;
	}
}
int
shInstantiateOnDownloadCallback::
DoCallback()
{
   shPendingDownload * owner = GetOwner();
   shNode * node = owner->GetNode();

   SHDistributableObject * dobj = SHCreateDistributableObject(_archive);
   if (dobj)
   {
      SHComponent * comp = cast_as(dobj, SHComponent);
      if (comp)
      {
         SHSorter * sorter = cast_as(comp, SHSorter);
         if (sorter) 
         {
            PostSuccessMessageWithString(sorter->GetName());
            node->AddSorter(sorter);
            node->printf("shInstantiateOnDownloadCallback:  Successfully added sorter [%s]\n",sorter->GetName());
            return -1;
         }
         else
         {
            SHWorker * worker = cast_as(comp, SHWorker);
            if (worker)
            {
               PostSuccessMessageWithString(worker->GetName());
               node->AddWorker(worker);
               node->printf("shInstantiateOnDownloadCallback:  Successfully added worker [%s]\n",worker->GetName());
               return -1;
            }
            else node->printf("shInstantiateOnDownloadCallback:  Error casting (SHComponent *) to (SHSorter *) or (SHWorker *)\n");
         }
      }
      else node->printf("shInstantiateOnDownloadCallback:  Error, the SHDistributableObject wasn't an SHComponent!\n");

      SHDeleteDistributableObject(dobj);
   }
   else node->printf("shInstantiateOnDownloadCallback:  Error, couldn't reconstitute SHDistributableObject\n");
   
   // If we got here, the function failed.
   PostFailureMessage();
   
   return -1;
}
Exemple #11
0
/***********************************************************
 * AccountName
 ***********************************************************/
const char*
HAddressView::AccountName()
{
	BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
	BMenu *menu = field->Menu();
	BMenuItem *item = menu->FindMarked();
	if(!item)
		return NULL;
	return item->Label();
}
Exemple #12
0
void
BRadioButton::SetValue(int32 value)
{
	if (value != Value()) {
		BControl::SetValueNoUpdate(value);
		Invalidate();

		if (value == B_CONTROL_ON) {
			for (BView *sibling = NextSibling(); sibling != NULL; sibling = sibling->NextSibling()) {
				BRadioButton *rbtn = cast_as(sibling, BRadioButton);
				if (rbtn != NULL) rbtn->SetValue(B_CONTROL_OFF);
			}
			for (BView *sibling = PreviousSibling(); sibling != NULL; sibling = sibling->PreviousSibling()) {
				BRadioButton *rbtn = cast_as(sibling, BRadioButton);
				if (rbtn != NULL) rbtn->SetValue(B_CONTROL_OFF);
			}
		}
	}
}
Exemple #13
0
const char*
BBox::Label() const
{
	if (fLabelView == NULL) return NULL;

	BStringView *strView = cast_as(fLabelView, BStringView);
	if (strView == NULL) return NULL;

	return strView->Text();
}
Exemple #14
0
BFilePanel * SketchApp::FindFilePanel()
{
	BFilePanel *win = NULL;
	int32 i = 0;
	while((win = (BFilePanel *)be_app->WindowAt(i++)) != NULL)
	{
		if(!strcmp(class_name(win), "BFilePanel"))
			return cast_as(win, BFilePanel);
	}
	return NULL;
}
Exemple #15
0
/***********************************************************
 * Pulse
 ***********************************************************/
void
HListView::Pulse() {
	register int32 count = fPointerList.CountItems();

	while (count > 0) {
		HListItem* item = cast_as(ItemAt(--count), HListItem);
		item->RefreshTime();
		if (item->IsDirty()) {
			InvalidateItem(IndexOf(item));
			item->SetDirty(false);
		}
	}
}
IEObjectEditor *IEBControl::GetEditor(IEEditableObject *view_to_inspect)
{
	BControl *a_bcontrol;
	
	a_bcontrol=cast_as(view_to_inspect, BControl);
	
	if(a_bcontrol==NULL){
		// not a BControl
		return NULL;
	}
		
	return new BControlEditor(view_to_inspect);
}
Exemple #17
0
/***********************************************************
 * FocusedView
 ***********************************************************/
BTextControl*
HAddressView::FocusedView() const
{
	int32 count = CountChildren();
	
	BTextControl *child(NULL);
	for(int32 i = 0;i < count;i++)
	{
		child = cast_as(ChildAt(i),BTextControl);
		if(child && child->TextView()->IsFocus())
			return child;
	}
	return NULL;
}
Exemple #18
0
/***********************************************************
 * ChangeAccount
 ***********************************************************/
void
HAddressView::ChangeAccount(const char* name)
{
	BPath path;
	::find_directory(B_USER_SETTINGS_DIRECTORY,&path);
	path.Append(APP_NAME);
	path.Append("Accounts");
	path.Append(name);
	
	BFile file(path.Path(),B_READ_ONLY);
	if(file.InitCheck() == B_OK)
	{
		BMessage msg;
		msg.Unflatten(&file);
		BString name,from,address;
		
		if(msg.FindString("real_name",&name) != B_OK)
			name = "";
		if(msg.FindString("address",&address) != B_OK)
		{
			address = "";
			(new BAlert("",_("Cound not find your email address!\nPlease check your account"),_("OK")))->Go();
			return;
		}
		if(name.Length() > 0)
			from << "\"" <<name << "\" <";
		from += address;
		
		if(name.Length() > 0)
			from << ">";
		fFrom->SetText(from.String());
		// Insert signature.
		BTextView *view = cast_as(Window()->FindView("HMailView"),BTextView);
		if(view)
		{	
			const char* sig_path;
			if(msg.FindString("signature",&sig_path) == B_OK)
			{
				BFile sigfile(sig_path,B_READ_ONLY);
				if(sigfile.InitCheck() == B_OK)
				{
					BString str;
					str << "\n" << sigfile;
					view->Insert(view->TextLength(),str.String(),str.Length());
					view->Select(0,0);
				}
			}
		}
	}
}
Exemple #19
0
bool MyListView::InitiateDrag(BPoint point, int32 index, bool wasSelected)
{
	BMessage msg(B_MIME_DATA);
	MyItem *item;
	
	if (wasSelected && doDrags) {
		item = cast_as(ItemAt(index), MyItem);
		const char * text = item->DragStr();
		msg.AddData("text/plain", B_MIME_TYPE, text, strlen(text));
		DragMessage(&msg, ItemFrame(index));  // drag an outline
		return true;
	} else {
		return false;
	}
}
/*
 * 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;
}
Exemple #21
0
/***********************************************************
 * GoodbyeFile
 ***********************************************************/
void
HListView::GoodbyeFile(node_ref nref) {
	int32 count = CountItems();

	for (int32 i = 0; i < count; i++) {
		HListItem* item = cast_as(ItemAt(i), HListItem);
		if (!item)
			continue;

		if (nref == item->NodeRef()) {
			item->SetForceDelete(true);
			DeleteItem(i);
			break;
		}
	}
}
Exemple #22
0
FileTree::FileTree(BMessage* archive)
: Nodes(new BList()), intSize(new int64(0))
{
	BMessage objMessage;
	int32 nodeIndex = 0;
	while(archive->FindMessage("Nodes", nodeIndex, &objMessage) == B_OK) {
		FileTree *tmp = cast_as(Instantiate(&objMessage), FileTree);
		Nodes->AddItem(tmp);
		
		nodeIndex++;
	}
	
	archive->FindBool("File", File);
	archive->FindBool("Query", Query);
	archive->FindString("Path", &Path);
	archive->FindInt64("intSize", intSize);	
}
void TApplication::ReadyToRun(void) {
	FeedKit::Settings::SettingsManager manager(FeedKit::Settings::AppTypes::SettingClient, kSettingsAppName);

	BMessage settings = manager.Settings();
	BMessage archive;

	if ((fUnarchive == true) && (settings.FindMessage(kSettingsMessageName, &archive) == B_OK)) {
		BArchivable *instance = instantiate_object(&archive);
		if (instance) {
			fWindow = cast_as(instance, TWindow);
		};
	};
	
	if (fWindow == NULL) fWindow = new TWindow();

	fWindow->Show();
};
Exemple #24
0
/***********************************************************
 * Destructor
 ***********************************************************/
HAddressView::~HAddressView()
{
	// Save send account
	int32 smtp_account;
	BMenuField *field = cast_as(FindView("FromMenu"),BMenuField);
	BMenu *menu = field->Menu();
	smtp_account = menu->IndexOf(menu->FindMarked());
	((HApp*)be_app)->Prefs()->SetData("smtp_account",smtp_account);
	
	// free memories
	int32 count = fAddrList.CountItems();
	while(count>0)
	{
		char *p = (char*)fAddrList.RemoveItem(--count);
		if(p)
			free(p);
	}
	fTo->SetModificationMessage(NULL);
	fCc->SetModificationMessage(NULL);
	fBcc->SetModificationMessage(NULL);
	fSubject->SetModificationMessage(NULL);
}
Exemple #25
0
void
BBox::SetLabel(const char *label)
{
	if (!(label == NULL || *label == 0)) {
		BStringView *strView = cast_as(fLabelView, BStringView);
		if (strView != NULL) {
			strView->SetText(label);
			strView->ResizeToPreferred();
			ReAdjustLabel();
			return;
		}

		if ((strView = new BStringView(BRect(0, 0, 1, 1), NULL, label, B_FOLLOW_NONE)) == NULL) return;
		strView->SetFont(be_bold_font);
		strView->ResizeToPreferred();
		if (SetLabel(strView) != B_OK) delete strView;
	} else if (fLabelView != NULL) {
		BView *view = fLabelView;
		fLabelView = NULL;

		view->RemoveSelf();
		delete view;
	}
}
Exemple #26
0
void
BLayoutContainer::SetUnitsPerPixel(float value, bool deep)
{
	if (value <= 0) return;

	fUnitsPerPixel = value;

	BLayoutItem *item;
	if (deep) {
		item = (BLayoutItem*)fItems.ItemAt(0);
		while (item != NULL) {
			cast_as(item, BLayoutContainer)->fUnitsPerPixel = value;

			if (cast_as(item, BLayoutContainer)->fItems.CountItems() > 0) {
				item = (BLayoutItem*)cast_as(item, BLayoutContainer)->fItems.ItemAt(0);
			} else if (item->fContainer == this) {
				item = item->NextSibling();
			} else {
				if (item->NextSibling() != NULL) {
					item = item->NextSibling();
					continue;
				}

				while (cast_as(item->fContainer, BLayoutItem)->NextSibling() == NULL) {
					item = cast_as(item->fContainer, BLayoutItem);
					if (item->fContainer == this) break;
				}
				item = cast_as(item->fContainer, BLayoutItem)->NextSibling();
			}
		}
	}

	BRect updateRect;
	for (item = (BLayoutItem*)fItems.ItemAt(0); item != NULL; item = item->NextSibling()) {
		if (item->fHidden || item->fFrame.IsValid() == false) continue;
		updateRect |= item->fFrame;
		item->UpdateVisibleRegion();
	}
	Invalidate(updateRect);
}
void TPanelWindowView::AttachedToWindow()
{

	fTimer = new BMessageRunner( BMessenger(Window()), new BMessage(kPanelWindowViewTimer), 999999 );

	new BMessageRunner( BMessenger(this), new BMessage(kDoBubbleHelp), 100000 );

	fLastActiveAppIcon = 0,

	be_roster->StartWatching( BMessenger(this), B_REQUEST_LAUNCHED|B_REQUEST_QUIT|B_REQUEST_ACTIVATED );

	fUseWindowShapping = false;
	fOuterFrameColor = (rgb_color){96,96,96,255};

	fBubbleHelp = new TBubbleHelp();

	if ( fThisArchive )
	{
		// todo
		fColor3 = (rgb_color){218,218,205,255};

		if ( fThisArchive->FindBool( "TransparentMenus", &fUseTransparentMenus ) != B_OK )
			fUseTransparentMenus = false;
		if ( fThisArchive->FindInt32( "Location", &fLocation ) != B_OK )
			fLocation = kLocationBottom;

		rgb_color *temp_c;
		ssize_t _size;
		if ( fThisArchive->FindData( "BackColor", B_RGB_COLOR_TYPE, (const void**)&temp_c, &_size ) != B_OK)
			fColor2 = (rgb_color){229,235,231,255};
		else
			fColor2 = *temp_c;

		if ( fThisArchive->FindData( "OuterFrameColor", B_RGB_COLOR_TYPE, (const void**)&temp_c, &_size ) != B_OK)
			fOuterFrameColor = (rgb_color){96,96,96,255};
		else
			fOuterFrameColor = *temp_c;

		if ( fThisArchive->FindBool( "DrawOuterFrame", &fDrawOuterFrame ) != B_OK )
			fDrawOuterFrame = true;

#ifdef USE_WINDOW_SHAPING
		if ( fThisArchive->FindBool( "UseWindowShapping", &fUseWindowShapping ) != B_OK )
			fUseWindowShapping = true;

		((TPanelWindow*)Window())->SetShowHideLimit( fUseWindowShapping ? 0.1f : 0.f );
#endif

		bool autohide;
		if ( fThisArchive->FindBool( "AutoHide", &autohide ) != B_OK )
			autohide = false;
		((TPanelWindow*)Window())->SetAutoHide( autohide );

		int32 delay;
		if ( fThisArchive->FindInt32( "HideEffectDelay", &delay ) != B_OK )
			delay = kWindowHidderAnimationStaleSpeed;
		((TPanelWindow*)Window())->SetHideEffectDelay( delay );

		if ( fThisArchive->FindBool( "AlwaysOnTop", &fAlwaysOnTop ) != B_OK )
			fAlwaysOnTop = true;

		if ( fThisArchive->FindBool( "HideStandardDeskbar", &fHideStandardDeskbar ) != B_OK )
			fHideStandardDeskbar = false;

		if ( fHideStandardDeskbar )
		{
			BMessage msg(B_SET_PROPERTY);
			msg.AddBool( "data", true );
			msg.AddSpecifier( "Hidden" );
			msg.AddSpecifier( "Window", "Deskbar" );
			be_app->PostMessage(&msg);
		}

		for ( int i=0; ; i++ )
		{
			BMessage inner;
			if ( fThisArchive->FindMessage( "tabs", i, &inner ) != B_OK )
				break;
			inner.AddPointer( "parent", this );
			BArchivable *archive = instantiate_dock_object( &inner );
			if ( archive )
			{
				TInnerPanel *panel = dynamic_cast<TInnerPanel*>(archive);
				if ( panel )
				{
					AddPanel( panel );
					bool _isr;
					if ( inner.FindBool( "IsRunningAppPanel", &_isr ) == B_OK && _isr )
						fRunningAppPanel = cast_as( panel, TApplicationPanel );
				}
			}
		}

		delete fThisArchive;
		fThisArchive = 0;
	}
	else
	{
		// <options>
		fUseTransparentMenus = false;
		fLocation = kLocationBottom;
		fColor2 = (rgb_color){229,235,231,255};
		fColor3 = (rgb_color){218,218,205,255};
		fDrawOuterFrame = true;
		fUseWindowShapping = false;
		fHideStandardDeskbar = false;
		fAlwaysOnTop = false;
		// </options>
	}

	if ( fAlwaysOnTop )
		Window()->SetFeel( B_FLOATING_ALL_WINDOW_FEEL );
	else
		Window()->SetFeel( B_NORMAL_WINDOW_FEEL );

	if ( fPanels.CountItems() == 0 )
	{
		TShortcutPanel *cpanel = new TShortcutPanel(this);
		AddPanel( cpanel );

		cpanel->AddItem( new TTrashIcon() );
		cpanel->AddItem( new TWorkspacesIcon() );
		cpanel->AddItem( new TClockIcon() );

		BEntry entry( "/boot/beos/system/Tracker" );
		entry_ref ref;
		entry.GetRef( &ref );
		AddShortcut( cpanel, ref );

		BPath path;
		if ( find_directory( B_USER_CONFIG_DIRECTORY, &path ) == B_OK )
		{
			path.Append( "be" );
			BEntry entry2( path.Path() );
			entry2.GetRef( &ref );
			AddShortcut( cpanel, ref );
		}

		cpanel = new TShortcutPanel(this);
		AddPanel( cpanel );
		AddShortcut( cpanel, "application/x-vnd.Be-NPOS" );
		AddShortcut( cpanel, "application/x-vnd.Sugoi-BeShare" );

		fRunningAppPanel = new TApplicationPanel(this);
		AddPanel( fRunningAppPanel );
	}

//	AddPanel( new TReplicantShelfPanel(this) );
}
Exemple #28
0
 void operator()(Type_decl const& d1)     { return check_declarations(cxt, d1, cast_as(d1, d2)); }
Exemple #29
0
/***********************************************************
 * MouseDown
 ***********************************************************/
void
HListView::MouseDown(BPoint pos) {
	int32 buttons = 0;
	ResourceUtils utils;
	BPoint point = pos;
	MenuUtils menu_utils;
	Window()->CurrentMessage()->FindInt32("buttons", &buttons);
	this->MakeFocus(true);

	// Handling of right click
	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
		int32 sel = IndexOf(pos);
		if (sel >= 0)
			Select(sel);
		else
			DeselectAll();
		sel = CurrentSelection();
		HListItem* item = NULL;
		if (sel >= 0)
			item = cast_as(ItemAt(sel), HListItem);
		BPopUpMenu* theMenu = new BPopUpMenu("RIGHT_CLICK", false, false);
		BFont font(be_plain_font);
		font.SetSize(10);
		theMenu->SetFont(&font);

		menu_utils.AddMenuItem(theMenu
							   , _("Add New Download")
							   , M_ADD_URL
							   , NULL, NULL
							   , 'A', 0, utils.GetBitmapResource('BBMP', "BMP:ADDURL"));

		theMenu->AddSeparatorItem();

		menu_utils.AddMenuItem(theMenu
							   , _("Suspend")
							   , M_SUSPEND, NULL, NULL
							   , 0, 0, utils.GetBitmapResource('BBMP', "BMP:SUSPEND"));
		if (item) {
			theMenu->FindItem(M_SUSPEND)->SetEnabled(item->IsSuspendable());
		} else {
			theMenu->FindItem(M_SUSPEND)->SetEnabled(false);
		}


		menu_utils.AddMenuItem(theMenu
							   , _("Resume")
							   , M_RESUME, NULL, NULL
							   , 0, 0, utils.GetBitmapResource('BBMP', "BMP:RESUME"));
		if (item) {
			theMenu->FindItem(M_RESUME)->SetEnabled(item->IsResumable());
		} else {
			theMenu->FindItem(M_RESUME)->SetEnabled(false);
		}

		theMenu->AddSeparatorItem();

		menu_utils.AddMenuItem(theMenu
							   , _("Stop")
							   , M_STOP, NULL, NULL
							   , 0, 0, utils.GetBitmapResource('BBMP', "BMP:STOP"));
		if (item)
			theMenu->FindItem(M_STOP)->SetEnabled(item->IsStarted());
		else
			theMenu->FindItem(M_STOP)->SetEnabled(false);

		menu_utils.AddMenuItem(theMenu
							   , _("Start")
							   , M_START, NULL, NULL
							   , 0, 0, utils.GetBitmapResource('BBMP', "BMP:CONNECTING"));
		if (sel >= 0)
			theMenu->FindItem(M_START)->SetEnabled(!item->IsStarted());
		else
			theMenu->FindItem(M_START)->SetEnabled(false);

		theMenu->AddSeparatorItem();

		menu_utils.AddMenuItem(theMenu
							   , _("Delete")
							   , M_DELETE, NULL, NULL
							   , 'T', 0, utils.GetBitmapResource('BBMP', "BMP:TRASH"));
		theMenu->FindItem(M_DELETE)->SetEnabled((sel >= 0) ? true : false);

		BRect r;
		ConvertToScreen(&pos);
		r.top = pos.y - 5;
		r.bottom = pos.y + 5;
		r.left = pos.x - 5;
		r.right = pos.x + 5;

		BMenuItem* theItem = theMenu->Go(pos, false, true, r);
		if (theItem) {
			BMessage*	aMessage = theItem->Message();
			if (aMessage)
				this->Window()->PostMessage(aMessage);
		}
		delete theMenu;
	} else
		ColumnListView::MouseDown(point);
}