Ejemplo n.º 1
0
// ------------------------------------------------------------------------- RHTML_text_view - RHTMLtextview -
RHTMLtextview::RHTMLtextview(BRect fRect, RHTMLtext *target, uint ft): BTextView(fRect,"fTextView",BRect(3,3,fRect.right-32,fRect.bottom-fRect.top),B_FOLLOW_ALL,B_WILL_DRAW)
{
 SetWordWrap(fOptions->WordWrap);
 fFont=new BFont(fOptions->DefaultFont);
 fTarget=target;
 fUpdateTimer = new RTimer("TextViewTimer", this, new BMessage('TIMR'));
 
 fFileTypes = new RHTMLFileTypes(ft,this);
 
 MakeFocus(true);
 SetDoesUndo(true);
 SetStylable(true);

 rgb_color fekete={0,0,0};

 SetFontAndColor(fFont,B_FONT_ALL,&fekete);

 fTagMenu= new RHTMLTagMenu(this);
 fTagMenu->Show();
 fTagMenu->Activate(false);
// fTagMenu->Hide();
 Window()->Activate(true);
 MakeFocus(true);

 fTimer = new RTimer("PopUpTimer", this, new BMessage('PPOP'));
 }
Ejemplo n.º 2
0
void
BF_GUI_Viewer::MessageReceived(BMessage* po_Message)
{
//	printf("BF_GUI_Viewer::MessageReceived()\n");
	switch(po_Message->what)
	{
		case 1599425348:
		case 1599425365:
			if(poSysKeysMenu)		poText->PrepareKeysMenu();
			break;
		case BF_MSG_VIEWER_CH_CP:
			poText->NextCodePage();
			break;
		case BF_MSG_VIEWER_CLOSED:
			QuitViewer();
			break;
		case BF_MSG_VIEWER_SEARCH:
			switch(po_Message->FindInt32("bf_viewer_search_cmd"))
			{
				case BF_VIEWER_CMD_SEARCH_DIALOG:
					SearchSample();
					break;
				case BF_VIEWER_CMD_SEARCH_FIRST:
					MakeFocus();
					char *pcValue;
					if(B_OK==po_Message->FindString("bf_pcValue",&pcValue) && pcValue)
					{
						poText->FindFirst(pcValue);
					}
					break;
				case BF_VIEWER_CMD_SEARCH_NEXT:
					poText->FindNext();
					break;
			}
			break;
		case BF_MSG_VIEWER_MESSAGE:{			
			char *pc_MenuResult=NULL;
			if(B_OK==po_Message->FindString("buttons",&pc_MenuResult) && pc_MenuResult 
				&& strcmp(pc_MenuResult,"Close") == 0)
			{
				QuitViewer();
			}
			else
			{
				MakeFocus();
			};
			break;}
		default:
			BView::MessageReceived(po_Message);
	}
};
Ejemplo n.º 3
0
void ArpConfigureView::MessageReceived(BMessage *message)
{
	switch( message->what ) {
		case DONE_MSG: {
			// This little bit of stupidity is to make any
			// text control that has focus to report its changes
			// before we apply the settings.
			BView* lastFocus = Window()->CurrentFocus();
			if (lastFocus) {
				MakeFocus();
				lastFocus->MakeFocus();
			}
			if (mDoneButton) mDoneButton->MakeFocus();
			Invoke();
		} break;
		case MAKEDEFAULT_MSG: {
			Config().WriteSettings();
		} break;
		case REVERT_MSG: {
			if( mPanel ) mPanel->Revert();
		} break;
		default: {
			inherited::MessageReceived(message);
		}
	}
}
Ejemplo n.º 4
0
void
BRadioButton::MouseDown(BPoint where)
{
	if (!IsEnabled() || !QueryCurrentMouse(true, B_PRIMARY_MOUSE_BUTTON)) return;

#if 0
	font_height fontHeight;
	GetFontHeight(&fontHeight);
	float sHeight = fontHeight.ascent + fontHeight.descent;

	BRect rect = Frame().OffsetToSelf(B_ORIGIN);
	rect.InsetBy(5, (rect.Height() - sHeight) / 2);
	if (rect.IsValid() == false) return;
	rect.right = rect.left + rect.Height();
	if (rect.Contains(where) == false) return;
#endif

	if ((Flags() &B_NAVIGABLE) && !IsFocus()) MakeFocus();

//	SetValue((Value() == B_CONTROL_ON) ?B_CONTROL_OFF :B_CONTROL_ON);

	if (Value() == B_CONTROL_ON) return;
	SetValue(B_CONTROL_ON);

	Invoke();
}
Ejemplo n.º 5
0
void
BF_GUI_TopMenu::MessageReceived(BMessage* po_Message)
{
	switch(po_Message->what){
	case BF_MSG_TOPMENU_HCLOSE:
		MakeFocus(true);
		ASSERT(poVMenu);
		iHCursor = poVMenu->iNavCursorIndex;
		CloseVMenu();
		
		bool bExit;
		if(B_OK==po_Message->FindBool("bf_bOk",&bExit)){
			if(bExit) NavEnter(); else NavEscape();
		}else{		
			char cKey;
			ASSERT(B_OK == po_Message->FindInt8("key",(int8*)&cKey));
			switch(cKey){
			case B_RIGHT_ARROW:
				NavChangeCursor(iNavCursorIndex+1,BF_GUI_TOOLMENU_MOVE_DOWN);
				break;
			case B_LEFT_ARROW:
				NavChangeCursor(iNavCursorIndex-1,BF_GUI_TOOLMENU_MOVE_UP);
				break;
			default:
				break;
			}
		}		
		break;
	default:
		BF_GUI_DlgView_HMenu::MessageReceived(po_Message);
	}
}
Ejemplo n.º 6
0
bool CurrencyBox::Validate(bool alert)
{
	if(strlen(Text())<1)
		SetText("0");

	Fixed amount;
	if(gCurrentLocale.StringToCurrency(Text(),amount)!=B_OK)
	{
		if(alert)
		{
			ShowAlert(TRANSLATE("Capital Be didn't understand the amount."),
						TRANSLATE("There may be a typo or the wrong kind of currency symbol "
						"for this account."));
			MakeFocus(true);
		}
		return false;
	}
	else
	{
		BString string;
		gCurrentLocale.CurrencyToString(amount,string);
		SetText(string.String());
	}
	
	return true;
}
Ejemplo n.º 7
0
/***********************************************************
 *	CLASS:		GlutWindow
 *
 *	FUNCTION:	MouseMoved
 *
 *	DESCRIPTION:  handles entry, motion, and passive events
 ***********************************************************/
void GlutWindow::MouseMoved(BPoint point,
						ulong transit, const BMessage *msg)
{
	BGLView::MouseMoved(point,transit,msg);
	
	if(transit != B_INSIDE_VIEW) {
		if (entry) {
			anyevents = entryEvent = true;
			gBlock.NewEvent();
		}
		if (transit == B_ENTERED_VIEW) {
			entryState = GLUT_ENTERED;
			MakeFocus();	// make me the current focus
			__glutSetCursor(cursor);
		} else
			entryState = GLUT_LEFT;
	}
	
	MouseCheck();
	if(m_buttons) {
		if(motion) {
			anyevents = motionEvent = true;
			motionX = (int)point.x;
			motionY = (int)point.y;
			gBlock.NewEvent();
		}
	} else {
		if(passive) {
			anyevents = passiveEvent = true;
			passiveX = (int)point.x;
			passiveY = (int)point.y;
			gBlock.NewEvent();
		}
	}
}
Ejemplo n.º 8
0
void TVideoEditorText::KeyDown(const char *bytes, int32 numBytes)
{
	char theChar = *bytes;
			
	// Increment our counter
	m_KeyCount++;
	if (m_KeyCount > 2)
		m_KeyCount = 1;
		
	//	Check for a return or enter 
	if (theChar == B_ENTER || theChar == B_RETURN || theChar == 'r')
	{
		MakeFocus(false);
	}		
	// We have a number.  Update the cell...
	else if ( isdigit(theChar) )
	{
		UpdateCurrentCell(theChar);	
	}
	// Reset selected cell to zero
	else if ( IsDelete(theChar) || IsBackspace(theChar) )
	{
		//ClearCell();
	}
	// Tab key or period '.' moves us through the time elements
	else if( IsTab(theChar) || theChar == '.' )
	{	
		// Check for shift key.  This move us back through the elements
		if ( IsShiftKeyDown() )		
			DecrementCell();
		else
			IncrementCell();
	}
	else if ( IsArrows(theChar) )
	{
		switch(theChar)
		{
			// Increment value
			case B_UP_ARROW:
				break;
				
			// Decrement value
			case B_DOWN_ARROW:
				break;
				
			// Select next cell
			case B_LEFT_ARROW:
				DecrementCell();
				break;
				
			// Select previous cell
			case B_RIGHT_ARROW:
				IncrementCell();
				break;
		}
	}
	// Illegal character
	else
		;//beep();
}
Ejemplo n.º 9
0
void TexView::AttachedToWindow()
{
	SetViewColor(prefs->bg_color);
	SetColorSpace(B_RGB32);
	BTextView::AttachedToWindow();
	MakeFocus(true);
}
Ejemplo n.º 10
0
void
ObjectViewContainer::MouseDown(BPoint p)
{
	MakeFocus(true);
	Window()->Activate();
	DeSelectAll();
}
void CalendarControl::MessageReceived(BMessage *msg)
{
 switch(msg->what)
 {
  case CalendarControlButtonPressedMessage:
  {
   if(IsEnabled())
   {
    MakeFocus(true);
    int day, month, year;
    int first_year, last_year;
    GetDate(&day, &month, &year);
    GetYearRange(&first_year, &last_year);
    new MonthWindow(ConvertToScreen(BPoint(Bounds().left+1,Bounds().bottom+1)),
                                    new BMessenger(this),
                                    day, month, year, first_year, last_year);
   }
   break;
  }
  case 'MVME': // message has come from window with calendar
  {
   int32 day, month, year;
   msg->FindInt32("day",&day);
   msg->FindInt32("month",&month);
   msg->FindInt32("year",&year);
   SetDate((int)day, (int)month, (int)year);
   break;
  }
  default:
   BControl::MessageReceived(msg);
 }
}
Ejemplo n.º 12
0
void
MemoryView::MouseDown(BPoint point)
{
	if (!IsFocus())
		MakeFocus(true);

	if (fTargetBlock == NULL)
		return;

	int32 buttons;
	if (Looper()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
		buttons = B_PRIMARY_MOUSE_BUTTON;

	if (buttons == B_SECONDARY_MOUSE_BUTTON) {
		_HandleContextMenu(point);
		return;
	}

	int32 offset = _GetOffsetAt(point);
	if (offset < fSelectionStart || offset > fSelectionEnd) {
		BRegion oldSelectionRegion;
		_GetSelectionRegion(oldSelectionRegion);
		fSelectionBase = offset;
		fSelectionStart = fSelectionBase;
		fSelectionEnd = fSelectionBase;
		Invalidate(oldSelectionRegion.Frame());
	}

	SetMouseEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
	fTrackingMouse = true;
}
Ejemplo n.º 13
0
void EntryView::KeyDown(const char *bytes, int32 numBytes)
{
	if (numBytes == 1){
		switch (bytes[0]){
		case B_ENTER:
		case B_TAB:
			ConvertToPointer();
			MakeFocus(false);
			if (parent){		// set the number
				((PointersView*)parent)->SetDigits(m_number);
			}
			break;
		
		case B_ESCAPE:
			MakeFocus(false);
			break;
		
		case B_LEFT_ARROW:
		case B_RIGHT_ARROW:
		case B_UP_ARROW:
		case B_DOWN_ARROW:
		case B_HOME:
		case B_END:
		case B_DELETE:
		case B_BACKSPACE:
		case '0':
		case '1':
		case '2':
		case '3':
		case '4':
		case '5':
		case '6':
		case '7':
		case '8':
		case '9':
		case '.':
		case ':':
			BTextView::KeyDown(bytes, numBytes);
			break;

		default:
			break;
		}
	} else {
		BTextView::KeyDown(bytes, numBytes);
	}
}
Ejemplo n.º 14
0
void
DataView::AttachedToWindow()
{
	fEditor.StartWatching(this);
	MakeFocus(true);
		// this seems to be necessary - if we don't do this here,
		// the view is sometimes focus, but IsFocus() returns false...
}
Ejemplo n.º 15
0
// MouseDown
void
PropertyListView::MouseDown(BPoint where)
{
	if (!(modifiers() & B_SHIFT_KEY)) {
		DeselectAll();
	}
	MakeFocus(true);
}
Ejemplo n.º 16
0
void
MemoryView::MouseDown(BPoint point)
{
	if (!IsFocus())
		MakeFocus(true);

	BView::MouseDown(point);
}
Ejemplo n.º 17
0
// AttachedToWindow
void
PopupTextView::AttachedToWindow()
{
	MakeResizable(true, Parent());
	SelectAll();
	MakeFocus();
	SetEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
}
Ejemplo n.º 18
0
void
CalcView::MouseDown(BPoint point)
{
	// ensure this view is the current focus
	if (!fExpressionTextView->IsFocus()) {
		// Call our version of MakeFocus(), since that will also apply the
		// num_lock setting.
		MakeFocus();
	}

	// read mouse buttons state
	int32 buttons = 0;
	Window()->CurrentMessage()->FindInt32("buttons", &buttons);

	if ((B_PRIMARY_MOUSE_BUTTON & buttons) == 0) {
		// display popup menu if not primary mouse button
		BMenuItem* selected;
		if ((selected = fPopUpMenu->Go(ConvertToScreen(point))) != NULL
			&& selected->Message() != NULL) {
			Window()->PostMessage(selected->Message(), this);
		}
		return;
	}

	if (fOptions->keypad_mode == KEYPAD_MODE_COMPACT) {
		if (fCalcIcon != NULL) {
			BRect bounds(Bounds());
			bounds.left = bounds.right - fCalcIcon->Bounds().Width();
			if (bounds.Contains(point)) {
				// user clicked on calculator icon
				fExpressionTextView->Clear();
			}
		}
		return;
	}

	// calculate grid sizes
	float sizeDisp = fHeight * kDisplayScaleY;
	float sizeCol = fWidth / (float)fColumns;
	float sizeRow = (fHeight - sizeDisp) / (float)fRows;

	// calculate location within grid
	int gridCol = (int)floorf(point.x / sizeCol);
	int gridRow = (int)floorf((point.y - sizeDisp) / sizeRow);

	// check limits
	if ((gridCol >= 0) && (gridCol < fColumns)
		&& (gridRow >= 0) && (gridRow < fRows)) {

		// process key press
		int key = gridRow * fColumns + gridCol;
		_FlashKey(key, FLAGS_MOUSE_DOWN);
		_PressKey(key);

		// make sure we receive the mouse up!
		SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
	}
}
Ejemplo n.º 19
0
void TexView::MouseMoved(BPoint point,uint32 transit,const BMessage* msg)
{
	if(!IsNormalFocus)
	{
		switch(transit)
		{
			case B_ENTERED_VIEW:
			{
				MakeFocus(true);
			}break;
			case B_EXITED_VIEW:
			{
				MakeFocus(false);
			}break;
		}
	}
	BTextView::MouseMoved(point,transit,msg);
}
Ejemplo n.º 20
0
void AttView::AttachedToWindow()
{
	inherited::AttachedToWindow();
	// start a thread which does all of the drawing
	drawTID = spawn_thread((thread_entry)drawThread, "drawThread",
								B_NORMAL_PRIORITY, this);
	resume_thread(drawTID);
	MakeFocus(true);
}
Ejemplo n.º 21
0
void SampleGLView::AttachedToWindow(void)
{
    BGLView::AttachedToWindow();
    LockGL();
    gInit();
    gReshape(width, height);
    UnlockGL();
    MakeFocus();
}
Ejemplo n.º 22
0
void ListView1::AllAttached() {
//	SetEditMode(false);
	MakeFocus(false);
	SetColumnFlags((column_flags)(B_ALLOW_COLUMN_MOVE | B_ALLOW_COLUMN_RESIZE | B_ALLOW_COLUMN_POPUP | B_ALLOW_COLUMN_REMOVE));
	SetMouseTrackingEnabled(false);
	SetSelectionMessage(new BMessage('slct'));
	SetInvocationMessage(new BMessage('mm03'));
	SetTarget(this, Looper());
}
Ejemplo n.º 23
0
void MediaRoutingView::AllAttached()
{
	D_METHOD(("MediaRoutingView::AllAttached()\n"));
	_inherited::AllAttached();
	
	_adjustScrollBars();

	// grab keyboard events
	MakeFocus();
}	
Ejemplo n.º 24
0
// MouseDown
void
BoolValueView::MouseDown(BPoint where)
{
	MakeFocus(true);	
	if (fCheckBoxRect.Contains(where)) {
		_ToggleValue();
	}
	// NOTE: careful, when this function returns, the object might
	// in fact have been deleted
}
Ejemplo n.º 25
0
void
URLInputGroup::URLTextView::MouseDown(BPoint where)
{
	bool wasFocus = IsFocus();
	if (!wasFocus)
		MakeFocus(true);

	int32 buttons;
	if (Window()->CurrentMessage()->FindInt32("buttons", &buttons) != B_OK)
		buttons = B_PRIMARY_MOUSE_BUTTON;

	if ((buttons & B_SECONDARY_MOUSE_BUTTON) != 0) {
		// Display context menu
		int32 selectionStart;
		int32 selectionEnd;
		GetSelection(&selectionStart, &selectionEnd);
		bool canCutOrCopy = selectionEnd > selectionStart;

		bool canPaste = false;
		if (be_clipboard->Lock()) {
			if (BMessage* data = be_clipboard->Data())
				canPaste = data->HasData("text/plain", B_MIME_TYPE);
			be_clipboard->Unlock();
		}

		BMenuItem* cutItem = new BMenuItem(B_TRANSLATE("Cut"),
			new BMessage(B_CUT));
		BMenuItem* copyItem = new BMenuItem(B_TRANSLATE("Copy"),
			new BMessage(B_COPY));
		BMenuItem* pasteItem = new BMenuItem(B_TRANSLATE("Paste"),
			new BMessage(B_PASTE));
		BMenuItem* clearItem = new BMenuItem(B_TRANSLATE("Clear"),
			new BMessage(MSG_CLEAR));
		cutItem->SetEnabled(canCutOrCopy);
		copyItem->SetEnabled(canCutOrCopy);
		pasteItem->SetEnabled(canPaste);
		clearItem->SetEnabled(strlen(Text()) > 0);

		BPopUpMenu* menu = new BPopUpMenu("url context");
		menu->AddItem(cutItem);
		menu->AddItem(copyItem);
		menu->AddItem(pasteItem);
		menu->AddItem(clearItem);

		menu->SetTargetForItems(this);
		menu->Go(ConvertToScreen(where), true, true, true);
		return;
	}

	// Only pass through to base class if we already have focus.
	if (!wasFocus)
		return;

	BTextView::MouseDown(where);
}
Ejemplo n.º 26
0
TEdit::TEdit(const char *name,BRect AFrame,BRect ATextFrame) : BTextView(AFrame, name, ATextFrame, B_FOLLOW_ALL_SIDES,B_WILL_DRAW | B_PULSE_NEEDED)
{
	FTarget = NULL;
	SetModified(false);	
	SetWordWrap(false);	
	SetDoesUndo(true);
	MakeFocus(true);
	
//	SetWordWrap(true);	
	
}
Ejemplo n.º 27
0
void
_BTextInput_::MouseDown(BPoint where)
{
	if (!IsFocus()) {
		MakeFocus(true);
		return;
	}

	// only pass through to base class if we already have focus
	BTextView::MouseDown(where);
}
Ejemplo n.º 28
0
// ----------------------------------------------------------------------------- RHTML_text_view - MouseDown -
void RHTMLtextview::MouseDown(BPoint where)
{
	fTagMenu->Stop();
	MakeFocus(true);

	BTextView::MouseDown(where);
	if (fUpdateTimer->IsActive())
		fUpdateTimer->ResetTimer();
	else
		fUpdateTimer->StartTimer(fOptions->ReakcioIdo);
}
Ejemplo n.º 29
0
void
PairsView::AttachedToWindow()
{
	for (int32 i = 0; i < fButtonsCount; i++) {
		PairsButton* button = fPairsButtonList->ItemAt(i);
		if (button != NULL)
			button->SetTarget(Window());
	}

	MakeFocus(true);
	BView::AttachedToWindow();
}
Ejemplo n.º 30
0
void
MemoryView::SetTargetAddress(TeamMemoryBlock* block, target_addr_t address)
{
	fTargetAddress = address;
	if (fTargetBlock != NULL)
		fTargetBlock->ReleaseReference();

	fTargetBlock = block;
	fTargetBlock->AcquireReference();
	MakeFocus(true);
	BMessenger(this).SendMessage(MSG_TARGET_ADDRESS_CHANGED);
}