void PresetWindow::OnWindowMonitorEvent(WindowMonitorEvent const & event)
{
	switch (event)
	{
	case WindowMonitorEvent::DimensionsReset:
	case WindowMonitorEvent::PresetSelected:
	{
		UpdateListSelection();
		UpdateDimensions();
		break;
	}
	case WindowMonitorEvent::PresetsUpdated:
		UpdatePresetList();
		UpdateDimensions();
		break;
	case WindowMonitorEvent::PresetDeselected:
		UpdateListSelection();
		break;
	case WindowMonitorEvent::Moved:
	case WindowMonitorEvent::Cropped:
		UpdateDimensions();
		break;
	case WindowMonitorEvent::PresetSaved:
	case WindowMonitorEvent::PresetDeleted:
		UpdatePresetList();
		UpdateListSelection();
		break;
	default:
		break;
	}
}
Beispiel #2
0
void TextInputComponent::SetText(DRef& dref, int source)
{
    Q_UNUSED(source);

    if (dref.Type() == BOI_STD_D(String))
    {
        QString text = *dref.GetReadInstance<QString>();

        LockDraw();

        m_text = text;

        int numNewLines = m_text.count('\n');

        if (m_numNewLines != numNewLines)
        {
            m_numNewLines = numNewLines;
            UpdateDimensions();
        }

        UnlockDraw();

        Update();
    }
}
Beispiel #3
0
CHud::CHud(LPDIRECT3DDEVICE9 pd3dDevice) : CScrollingWindow(0x00000000), alpha(255), pMyPlayer(NULL), m_BigFont(NULL), m_SmallFont(NULL), timeLeft(FADETIME) {
	HRESULT hr;
	// Create a D3DX font object
	V(D3DXCreateFont( pd3dDevice, 40, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, 
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, 
		TEXT("Arial"), &m_BigFont ) );

	V(D3DXCreateFont( pd3dDevice, 24, 0, FW_BOLD, 0, FALSE, DEFAULT_CHARSET, 
		OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, 
		TEXT("Arial"), &m_SmallFont ) );

	// Create sprite object
	V( D3DXCreateSprite(pd3dDevice,&m_Sprite) );

	// Load a texture for our sprite
	V( D3DXCreateTextureFromFile(pd3dDevice, LIVE_ICON, &m_Texture) );

	if (hr != S_OK)
		dprintf("Something went wrong in the HUD!!");
	this->anchor = CScrollingWindow::TOP;
	this->hidden = false;
	this->xPercent = 1.f;
	this->yPercent = 1.f;
	UpdateDimensions();
}
Beispiel #4
0
//----------------------------------------------------------------------------------------
void DBGrid::OnModusBrowse(wxCommandEvent& WXUNUSED(event))
{
    b_EditModus = false;            // Needed by PopupMenu
    EnableEditing(b_EditModus);     // Deactivate in-place Editing
    UpdateDimensions();             // Redraw the Grid
    // wxLogMessage(_("-I-> DBGrid::OnModusBrowse() - End"));
}
Beispiel #5
0
void CScrollingWindow::OnResetDevice(){
	if (m_Sprite)
		m_Sprite->OnResetDevice();
	if (m_font)
		m_font->OnResetDevice();

	UpdateDimensions();
}
Beispiel #6
0
//-------------------------------------------------------------------------
//	set new width/height
//-------------------------------------------------------------------------
void GWinControl::Resize(int2 Size)
{
	//	update our size
	m_ClientSize = Size;

	//	apply the changes
	UpdateDimensions();
}
Beispiel #7
0
//-------------------------------------------------------------------------
//	set new position
//-------------------------------------------------------------------------
void GWinControl::Move(int2 Pos)
{
	//	update our pos
	m_ClientPos = Pos;

	//	apply the changes
	UpdateDimensions();
}
Beispiel #8
0
template <typename T> MenuWidget<T>::MenuWidget(Vector2n Position, std::vector<T> & Entries, TypingModule * TypingModule)
    : Widget(Position, Vector2n::ZERO, {}),
m_Entries(Entries),
m_TypingModule(TypingModule)
{
    ModifyGestureRecognizer().m_RecognizeTap = true;

    UpdateDimensions();
}
Beispiel #9
0
void GMMOptions::SetupLayout1()
{
	int next_y;

	next_y = GMM_TITLE_MARGIN;

	volume_label.SetText("Set Volume:");
	volume_label.SetCoords(GMM_SIDE_MARGIN, next_y);
	volume_label.SetDimensions(w - (GMM_SIDE_MARGIN * 2), 0);
	volume_label.SetJustification(MMLABEL_NORMAL);
	AddWidget(&volume_label);
	next_y += MMLABEL_HEIGHT + 1;

	volume_radio.SetCoords(GMM_SIDE_MARGIN, next_y);
	volume_radio.SetMaxSelections(MAX_SOUND_SETTINGS);
	AddWidget(&volume_radio);
	next_y += MMRADIO_HEIGHT + 2;

	speed_label.SetText("Set Game Speed:");
	speed_label.SetCoords(GMM_SIDE_MARGIN, next_y);
	speed_label.SetDimensions(w - (GMM_SIDE_MARGIN * 2), 0);
	speed_label.SetJustification(MMLABEL_NORMAL);
	AddWidget(&speed_label);
	next_y += MMLABEL_HEIGHT + 1;

	speed_radio.SetCoords(GMM_SIDE_MARGIN, next_y);
	speed_radio.SetMaxSelections(MAX_GMMOPTIONS_SPEED_SETTINGS);
	AddWidget(&speed_radio);
	next_y += MMRADIO_HEIGHT + 7;

	pause_button.SetType(MMGENERIC_BUTTON);
	pause_button.SetText("Pause Game");
	pause_button.SetCoords(GMM_SIDE_MARGIN, next_y);
	pause_button.SetDimensions(w - (GMM_SIDE_MARGIN * 2), GMMWBUTTON_HEIGHT);
	AddWidget(&pause_button);
	next_y += GMMWBUTTON_HEIGHT + 1;

	reshuffle_button.SetType(MMGENERIC_BUTTON);
	reshuffle_button.SetText("Reshuffle Teams");
	reshuffle_button.SetCoords(GMM_SIDE_MARGIN, next_y);
	reshuffle_button.SetDimensions(w - (GMM_SIDE_MARGIN * 2), GMMWBUTTON_HEIGHT);
	AddWidget(&reshuffle_button);
	next_y += GMMWBUTTON_HEIGHT + 1;

	reset_button.SetType(MMGENERIC_BUTTON);
	reset_button.SetText("Reset Map");
	reset_button.SetCoords(GMM_SIDE_MARGIN, next_y);
	reset_button.SetDimensions(w - (GMM_SIDE_MARGIN * 2), GMMWBUTTON_HEIGHT);
	AddWidget(&reset_button);
	next_y += GMMWBUTTON_HEIGHT + 1;

	h = next_y + GMM_BOTTOM_MARGIN;

	//needed if w is ever changed / set
	UpdateDimensions();
}
Beispiel #10
0
//-------------------------------------------------------------------------
//	set new pos and dimensions at once
//-------------------------------------------------------------------------
void GWinControl::SetDimensions(int2 Pos, int2 Size)
{
	//	update our pos
	m_ClientPos = Pos;

	//	update our size
	m_ClientSize = Size;

	//	apply the changes
	UpdateDimensions();
}
Beispiel #11
0
BOOL CALLBACK DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
{
	switch (iMsg)
	{
	case WM_INITDIALOG:
		return true;
	case WM_COMMAND:
	{
		switch (LOWORD(wParam))
		{
		case IDC_BUTTON1:
		{
			Image.SelectImage();
			BITMAP Bit;
			GetObject(Image.memBit, sizeof(BITMAP), &Bit);
			imgHeight = Bit.bmHeight;
			imgWidth = Bit.bmWidth;
			SetDlgItemInt(hDlg, IDC_EDIT3, imgWidth, FALSE);
			SetDlgItemInt(hDlg, IDC_EDIT4, imgHeight, FALSE);
			UpdateDimensions(hDlg);
			break;
		}
		case IDC_BUTTON2:
		{
			UpdateDimensions(hDlg);
			break;
		}
		case IDOK:
			EndDialog(hDlg, UpdateDimensions(hDlg)?IDOK:IDCANCEL);
			break;
		case IDCANCEL:
			EndDialog(hDlg, IDCANCEL);
			break;
		}
		return true;
	}
	case WM_DESTROY:
		return true;
	}
	return false;
}
Beispiel #12
0
void GMMManageBots::SetupLayout1()
{
	int i, rows, cols;
	const int max_rows=4;
	const int label_width = 40;
	const int start_width = 25;
	const int stop_width = 25;
	const int button_spacer = 2;

	rows = MAX_TEAM_TYPES-1;
	if(rows > max_rows) rows = max_rows;
	cols = (MAX_TEAM_TYPES-1)/max_rows;
	if((MAX_TEAM_TYPES-1)%max_rows) cols++;
	
	for(i=NULL_TEAM+1; i<MAX_TEAM_TYPES; i++)
	{
		int button_y;
		int button_x;

		button_x = GMM_SIDE_MARGIN + ((i-1)/max_rows)*(label_width + button_spacer + start_width + button_spacer + stop_width);
		button_y = GMM_TITLE_MARGIN + ((i-1)%max_rows)*(GMMWBUTTON_HEIGHT+1);

		//left
		{
			team_label[i].SetText(team_type_string[i]);
			team_label[i].SetCoords(button_x, button_y + ((GMMWBUTTON_HEIGHT-MMLABEL_HEIGHT)/2));
			team_label[i].SetDimensions(label_width, 0);
			team_label[i].SetJustification(MMLABEL_RIGHT);
			AddWidget(&team_label[i]);
			button_x += label_width + button_spacer;

			start_button[i].SetType(MMGENERIC_BUTTON);
			start_button[i].SetText("On");
			start_button[i].SetCoords(button_x, button_y);
			start_button[i].SetDimensions(start_width, GMMWBUTTON_HEIGHT);
			AddWidget(&start_button[i]);
			button_x += start_width + button_spacer;

			stop_button[i].SetType(MMGENERIC_BUTTON);
			stop_button[i].SetText("Off");
			stop_button[i].SetCoords(button_x, button_y);
			stop_button[i].SetDimensions(stop_width, GMMWBUTTON_HEIGHT);
			AddWidget(&stop_button[i]);
			button_x += stop_width;
		}
	}

	w = (GMM_SIDE_MARGIN * 2) + cols*(label_width + button_spacer + start_width + button_spacer + stop_width);
	h = GMM_TITLE_MARGIN + GMM_BOTTOM_MARGIN + (rows)*(GMMWBUTTON_HEIGHT+1);

	//needed if w is ever changed / set
	UpdateDimensions();
}
Beispiel #13
0
void TextInputComponent::HandleStateChanged(StateId stateId, DRef& dref)
{
    if (stateId == StateId_WindowSize)
    {
        const QSizeF* pSize = dref.GetReadInstance<QSizeF>();

        LockDraw();

        m_windowSize = *pSize;
        UpdateDimensions();

        UnlockDraw();
    }
}
// -----------------------------------------------------------------------------
// CFiletransferContainer::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CFiletransferContainer::ConstructL( const TRect& aRect)
    {
    // Create a window for this application view
    CreateWindowL();

    UpdateDimensions(aRect);

    ResetLabelsL();

    // Set the windows size
    SetRect( aRect );

    // Activate the window, which makes it ready to be drawn
    ActivateL();
    }
Beispiel #15
0
bool TextInputComponent::Initialize()
{
    QVariant value;
    SI()->RegisterStateListener(StateId_WindowSize, this, value);
    m_windowSize = value.toSizeF();

    // TODO: get these values from State.
    m_textPen = QPen(QColor(50, 50, 50));
    m_bgFill = QBrush(QColor(200, 200, 200));
    m_textBgFill = QBrush(QColor(245, 245, 245));

    UpdateDimensions();

    SetFlag(ComponentFlag_HandlesKeyEvents);

    return true;
}
Beispiel #16
0
template <typename T> ListWidget<T>::ListWidget(Vector2n Position, std::vector<T> & List, TypingModule & TypingModule)
	: CompositeWidget(Position, {
		/*std::shared_ptr<Widget>(new ButtonWidget(Vector2n(-1, -18), Vector2n(lineHeight, lineHeight), [&]() {
			// TEST: This is specific stuff for quick testing
			if (!m_List.empty())
			{
				m_List.pop_back();
			}
		} ))*/ }),
	  m_TapAction(),
	  m_List(List),
	  m_TypingModule(TypingModule)
{
	ModifyGestureRecognizer().m_RecognizeTap = true;
	ModifyGestureRecognizer().m_RecognizeManipulationTranslate = true;

	UpdateDimensions();
}
Beispiel #17
0
template <typename T> ListWidget<T>::ListWidget(Vector2n Position, std::vector<T> & List, TypingModule & TypingModule)
#if DECISION_LIST_WIDGET_IS_COMPOSITE
	: CompositeWidget(Position, {
		std::shared_ptr<Widget>(new ButtonWidget(Vector2n(-1, -17), Vector2n(lineHeight, lineHeight), [&]() {
			// TEST: This is specific stuff for quick testing
			if (!m_Entries.empty())
			{
				m_Entries.pop_back();
			}
		} )) }, {}),
#else
	: Widget(Position, Vector2n::ZERO, {}),
#endif
	  m_Entries(List),
	  m_TypingModule(TypingModule)
{
	ModifyGestureRecognizer().m_RecognizeTap = true;

	UpdateDimensions();
}
void PresetWindow::OnCreate()
{
	// Set window options
	WindowHelper::SetTitle(GetWindowHandle(), WindowHelper::GetCurrentModuleHandle(), IDS_PRESETS);
	SetWindowPos(GetWindowHandle(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);

	// Create controls
	presetListbox = CreateWindowEx(WS_EX_CLIENTEDGE, L"Listbox", NULL, WS_CHILD | WS_VISIBLE | WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT, 12, 12, 165, 121, GetWindowHandle(), reinterpret_cast<HMENU>(PresetCommand::ListboxSelect), WindowHelper::GetCurrentModuleHandle(), NULL);
	removeButton = CreateWindow(L"Button", L"Remove", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 12, 146, 75, 23, GetWindowHandle(), reinterpret_cast<HMENU>(PresetCommand::RemovePreset), WindowHelper::GetCurrentModuleHandle(), NULL);
	titleLabel = CreateWindow(L"Static", L"Name:", WS_CHILD | WS_VISIBLE | SS_LEFT, 192, 12, 30, 13, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	sizeLabel = CreateWindow(L"Static", L"Size:", WS_CHILD | WS_VISIBLE | SS_LEFT, 192, 60, 30, 13, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	posxText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 202, 90, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	posyText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 258, 78, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	heightText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 258, 104, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	widthText = CreateWindowEx(WS_EX_CLIENTEDGE, L"Edit", L"", WS_CHILD | WS_VISIBLE | SS_LEFT | ES_READONLY, 314, 90, 50, 20, GetWindowHandle(), NULL, WindowHelper::GetCurrentModuleHandle(), NULL);
	saveButton = CreateWindow(L"Button", L"Save", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 297, 146, 75, 23, GetWindowHandle(), reinterpret_cast<HMENU>(PresetCommand::SavePreset), WindowHelper::GetCurrentModuleHandle(), NULL);

	titleText.SetCoords(195, 28, 175, 20);
	titleText.Create();

	// Set fonts
	defaultFont = WindowHelper::CreateFont(GetWindowHandle(), L"Microsoft Sans Serif", 8.25, FW_NORMAL, false, false, false);
	SendMessage(presetListbox, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(removeButton, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(titleLabel, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(titleText.GetWindowHandle(), WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(sizeLabel, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(posxText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(posyText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(widthText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(heightText, WM_SETFONT, WPARAM(defaultFont), TRUE);
	SendMessage(saveButton, WM_SETFONT, WPARAM(defaultFont), TRUE);

	windowMonitor->RegisterObserver(this);
	UpdatePresetList();
	UpdateListSelection();
	UpdateDimensions();
}
// -----------------------------------------------------------------------------
// CFiletransferContainer::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CFiletransferContainer::SizeChanged()
{
	TRect rect = Rect();
	TSize labelSize;
	TInt labelHeight;
	if(rect!=iRect)
		UpdateDimensions(rect);

	//label 0: Sending/Receiving
	//rect=Rect();
	labelSize = iFileDetailsLabels[0]->MinimumSize();
	labelHeight=labelSize.iHeight+6;
	rect.iTl.iX=iMargin;
	rect.iTl.iY=iVerticalDistance-labelHeight;
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[0]->SetRect(rect);

	//label 1: Current filename
	//rect=Rect();
	labelSize = iFileDetailsLabels[1]->MinimumSize();
	rect.iTl.iX=iMargin;
	rect.iTl.iY=iVerticalDistance*2-labelHeight;
	rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[1]->SetRect(rect);
	iFileDetailsLabels[1]->UseLogicalToVisualConversion(EFalse);

	//label 2: total KB sent and %
	rect=Rect();
	//labelSize = iFileDetailsLabels[2]->MinimumSize();
	rect.iTl.iX=iMargin;
	rect.iTl.iY=(TInt)(iVerticalDistance*3.75-labelHeight);
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[2]->SetRect(rect);

	//label 3: KB remaining to be transmitted
	//rect=Rect();
	labelSize = iFileDetailsLabels[3]->MinimumSize();
	//iFileDetailsLabels[3]->SetLabelAlignment(ELayoutAlignRight);
	rect.iTl.iX=iWidth-iMargin-labelSize.iWidth;
	rect.iTl.iY=(TInt)(iVerticalDistance*3.75-labelHeight);
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[3]->SetRect(rect);

	//label 4: elapsed time
	//rect=Rect();
	labelSize = iFileDetailsLabels[4]->MinimumSize();
	rect.iTl.iX=iMargin;
	rect.iTl.iY=(TInt)(iVerticalDistance*5.75-labelHeight);
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[4]->SetRect(rect);

	//label 5: estimated time
	//rect=Rect();
	labelSize = iFileDetailsLabels[5]->MinimumSize();
	//iFileDetailsLabels[5]->SetLabelAlignment(ELayoutAlignRight);
	rect.iTl.iX=iWidth-iMargin-labelSize.iWidth;
	rect.iTl.iY=(TInt)(iVerticalDistance*5.75-labelHeight);
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[5]->SetRect(rect);

	//label 6: Link
	//rect=Rect();
	//labelSize = iFileDetailsLabels[6]->MinimumSize();
	rect.iTl.iX=iMargin;
	rect.iTl.iY=iVerticalDistance*7-labelHeight;
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[6]->SetRect(rect);

	//label 7: estimated time
	//rect=Rect();
	labelSize = iFileDetailsLabels[7]->MinimumSize();
	//iFileDetailsLabels[7]->SetLabelAlignment(ELayoutAlignRight);
	rect.iTl.iX=iWidth-iMargin-labelSize.iWidth;
	rect.iTl.iY=iVerticalDistance*7-labelHeight;
	//rect.iBr = rect.iTl + labelSize;
	iFileDetailsLabels[7]->SetRect(rect);

	//
	if( !iAlarm )
	{
		//start the alarm
		iAlarm = CPeriodic::New(EPriorityLow);
		if( iAlarm )
		{
			//alarm should start so that startTime+n*Period do not make exact seconds
			//otherwise the time will not be displayed nicely (seconds not incremented regularly)
		    TCallBack cb(&MoveLabel,this);
			iAlarm->Start(300000,200000,cb);
		};
	};
}
Beispiel #20
0
template <typename T> void ListWidget<T>::Render()
{
	Color BackgroundColor(1.0, 1.0, 1.0);
	Color BorderColor(0.3, 0.3, 0.3);

	/*if (CheckHover(WidgetManager) && CheckActive(WidgetManager))
	{
	}
	else if ((CheckHover(WidgetManager) && !CheckAnyActive(WidgetManager)) || (!CheckHover(WidgetManager) && CheckActive(WidgetManager)))
	{
		BorderColor[0] = 0.898;
		BorderColor[1] = 0.765;
		BorderColor[2] = 0.396;
	}
	else
	{
	}*/

	// TODO: Think if I should outsource the entire rendering code for more generality
	// Draw list
	{
		UpdateDimensions();		// LATER: Optimize by not repeating this calculation each time, only when something changes?

		if (m_List.empty())
		{
			BackgroundColor[0] = 234 / 255.0;
			BackgroundColor[1] = 233 / 255.0;
			BackgroundColor[2] = 190 / 255.0;
		}

		DrawAroundBox(GetPosition(), GetDimensions(), BackgroundColor, BorderColor);

		// TODO: This part is not general
		std::string Description[2] = { "#include <", ">" };
		glColor3d(0, 0, 0); OglUtilsPrint(GetPosition().X(), GetPosition().Y(), 0, RIGHT, Description[0].c_str());
		glColor3d(0, 0, 0); OglUtilsPrint(GetPosition().X() + GetDimensions().X(), GetPosition().Y(), 0, LEFT, Description[1].c_str());

		// TEST
		auto Spot = m_List.end();
		if (!m_TypingModule.GetString().empty())
		{
			for (auto & Pointer : GetGestureRecognizer().GetConnected())
			{
				if (Pointer::VirtualCategory::POINTING == Pointer->GetVirtualCategory())
				{
					Vector2n GlobalPosition(Pointer->GetPointerState().GetAxisState(0).GetPosition(), Pointer->GetPointerState().GetAxisState(1).GetPosition());
					Vector2n LocalPosition(GlobalToLocal(GlobalPosition));

					Spot = m_List.begin() + (LocalPosition.Y() / lineHeight);
				}
			}
		}

		OpenGLStream OpenGLStream(GetPosition());
		for (auto ListEntry = m_List.begin(); m_List.end() != ListEntry; ++ListEntry)
		{
			if (ListEntry == Spot)
				OpenGLStream << endl;

			OpenGLStream << *ListEntry << endl;
		}
	}

	CompositeWidget::Render();
}
Beispiel #21
0
// ----------------------------------------------------------------------------
void BitmapWidget::OnSize(wxSizeEvent &event)
{
    UpdateDimensions();
    Refresh(true);
}
Beispiel #22
0
// ----------------------------------------------------------------------------
void BitmapWidget::SetScalingType(int index)
{
    m_scalingType = index;
    UpdateDimensions();
}
Beispiel #23
0
template <typename T> void MenuWidget<T>::Render()
{
    Color BackgroundColor(1.0, 1.0, 1.0);
    Color BorderColor(0.3, 0.3, 0.3);

    /*if (CheckHover(WidgetManager) && CheckActive(WidgetManager))
    {
    }
    else if ((CheckHover(WidgetManager) && !CheckAnyActive(WidgetManager)) || (!CheckHover(WidgetManager) && CheckActive(WidgetManager)))
    {
    	BorderColor[0] = 0.898;
    	BorderColor[1] = 0.765;
    	BorderColor[2] = 0.396;
    }
    else
    {
    }*/
    // HACK, TODO: Make this a single DRY const
    if (HasTypingFocus())
    {
        BorderColor[0] = 0.898;
        BorderColor[1] = 0.765;
        BorderColor[2] = 0.396;
    }

    // TODO: Think if I should outsource the entire rendering code for more generality
    // Draw list
    {
        UpdateDimensions();		// LATER: Optimize by not repeating this calculation each time, only when something changes?

        if (m_Entries.empty())
        {
            BackgroundColor[0] = 234 / 255.0;
            BackgroundColor[1] = 233 / 255.0;
            BackgroundColor[2] = 190 / 255.0;
        }

        DrawAroundBox(GetPosition(), GetDimensions(), BackgroundColor, BorderColor);

        // TEST
        auto Spot = m_Entries.end();
        if (   nullptr != m_TypingModule
                && !m_TypingModule->GetString().empty())
        {
            for (auto & Pointer : GetGestureRecognizer().GetConnected())
            {
                if (Pointer::VirtualCategory::POINTING == Pointer->GetVirtualCategory())
                {
                    Vector2n GlobalPosition(Pointer->GetPointerState().GetAxisState(0).GetPosition(), Pointer->GetPointerState().GetAxisState(1).GetPosition());
                    Vector2n LocalPosition(GlobalToLocal(GlobalPosition));

                    Spot = m_Entries.begin() + (LocalPosition.Y() / lineHeight);
                }
            }
        }

        OpenGLStream OpenGLStream(GetPosition());
        //for (auto & Entry : m_Entries)
        for (auto Entry = m_Entries.begin(); m_Entries.end() != Entry; ++Entry)
        {
            if (Entry == Spot)
                OpenGLStream << endl;

            if (Entry - m_Entries.begin() == m_SelectedEntryId)
            {
                if (HasTypingFocus())
                    DrawBox(GetPosition() + Vector2n(0, static_cast<sint32>((Entry - m_Entries.begin() + (Entry >= Spot)) * lineHeight)), Vector2n(GetDimensions().X(), lineHeight), m_SelectedColor, m_SelectedColor);
                else
                    DrawBox(GetPosition() + Vector2n(0, static_cast<sint32>((Entry - m_Entries.begin() + (Entry >= Spot)) * lineHeight)), Vector2n(GetDimensions().X(), lineHeight), m_UnfocusedSelectedColor, m_UnfocusedSelectedColor);
            }

            OpenGLStream << *Entry << endl;
        }
    }
}
Beispiel #24
0
template <typename T> void ListWidget<T>::Render()
{
	Color BackgroundColor(1.0, 1.0, 1.0);
	Color BorderColor(0.3, 0.3, 0.3);

	/*if (CheckHover(WidgetManager) && CheckActive(WidgetManager))
	{
	}
	else if ((CheckHover(WidgetManager) && !CheckAnyActive(WidgetManager)) || (!CheckHover(WidgetManager) && CheckActive(WidgetManager)))
	{
		BorderColor[0] = 0.898;
		BorderColor[1] = 0.765;
		BorderColor[2] = 0.396;
	}
	else
	{
	}*/

	// TODO: Think if I should outsource the entire rendering code for more generality
	// Draw list
	{
		UpdateDimensions();		// LATER: Optimize by not repeating this calculation each time, only when something changes?

		if (m_Entries.empty())
		{
			BackgroundColor[0] = 234 / 255.0;
			BackgroundColor[1] = 233 / 255.0;
			BackgroundColor[2] = 190 / 255.0;
		}

		DrawAroundBox(GetPosition(), GetDimensions(), BackgroundColor, BorderColor);

		// TEST
		auto Spot = m_Entries.end();
		if (!m_TypingModule.GetString().empty())
		{
			for (auto & Pointer : GetGestureRecognizer().GetConnected())
			{
				if (Pointer::VirtualCategory::POINTING == Pointer->GetVirtualCategory())
				{
					Vector2n GlobalPosition(Pointer->GetPointerState().GetAxisState(0).GetPosition(), Pointer->GetPointerState().GetAxisState(1).GetPosition());
					Vector2n LocalPosition(GlobalToLocal(GlobalPosition));

					Spot = m_Entries.begin() + (LocalPosition.Y() / lineHeight);
				}
			}
		}

		OpenGLStream OpenGLStream(GetPosition());
		for (auto Entry = m_Entries.begin(); m_Entries.end() != Entry; ++Entry)
		{
			if (Entry == Spot)
				OpenGLStream << endl;

			OpenGLStream << *Entry << endl;
		}
	}

#if DECISION_LIST_WIDGET_IS_COMPOSITE
	CompositeWidget::Render();
#endif
}
Beispiel #25
0
void TextInputComponent::HandleKeyEvent(KeyEvent* pEvent)
{
    int eventType = pEvent->type;

    if (eventType == KeyEvent::Type_Press)
    {
        LockDraw();

        if (m_clearOnNext)
        {
            m_text.clear();
            m_clearOnNext = false;

            if (m_numNewLines > 0)
            {
                m_numNewLines = 0;
                UpdateDimensions();
            }
        }

        int key = pEvent->key;

        if (key == Qt::Key_Backspace)
        {
            if (m_text.endsWith('\n'))
            {
                m_numNewLines--;
                UpdateDimensions();
            }

            m_text.chop(1);
            EmitText();
            Update();
        }
        else if ((key == Qt::Key_Return) ||
                 (key == Qt::Key_Enter))
        {
            if (pEvent->modifiers & KeyEvent::Modifier_Shift)
            {
                m_text.append('\n');
                m_numNewLines++;

                UpdateDimensions();
            }
            else
            {
                ActionArgs* pArgs = (m_pActionArgs != NULL) ?
                                    (m_pActionArgs) :
                                    (new ActionArgs);
                pArgs->Set("Text", m_text);

                SI()->UpdateActiveAction(m_action, pArgs);
            }
        }
        else if ((key != Qt::Key_Shift) &&
                 (key != Qt::Key_Control))
        {
            QChar ch(key);

            if (ch.isPrint())
            {
                if (pEvent->modifiers & KeyEvent::Modifier_Shift)
                {
                    m_text.append(ch);
                }
                else
                {
                    m_text.append(ch.toLower());
                }

                EmitText();
                Update();
            }
        }

        UnlockDraw();
    }
}