AUI_ERRCODE ControlSheet::DrawThis(aui_Surface *surface, sint32 x, sint32 y) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) { if ( m_srcWidthPix || m_srcHeightPix ) { RECT srcRect = { m_srcX, m_srcY, m_srcX + m_srcWidthPix, m_srcY + m_srcHeightPix }; m_pattern->Draw( surface, &rect, &srcRect ); } else { m_pattern->Draw( surface, &rect ); } } if ( m_border ) primitives_BevelRect16( surface, &rect, 2, 1, 16, 16 ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE PictureTab::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( IsOn() ) m_pictureOn->Draw( surface, &rect ); else m_pictureOff->Draw( surface, &rect ); if ( IsActive() ) { if ( IsOn() ) m_pictureActiveOn->Draw( surface, &rect ); else m_pictureActiveOff->Draw( surface, &rect ); } else { } if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE ctp2_Button::DrawThis(aui_Surface *surface, sint32 x, sint32 y) { if(IsHidden()) return AUI_ERRCODE_OK; if(!surface) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); DrawLayers(surface, &rect); DrawThisText(surface, &rect); if(surface == m_window->TheSurface()) m_window->AddDirtyRect(&rect); if(m_window->GetFocusControl() == this) { primitives_FrameThickRect16(surface, &rect, g_colorSet->GetColor(COLOR_UI_BOX), 3); } return AUI_ERRCODE_OK; }
BOOL aui_Control::ShowTipWindow( aui_MouseEvent *mouseData ) { if ( m_tip && !m_showingTip ) { aui_Static *tipStatic = ((aui_TipWindow *)m_tip)->GetStatic(); if(tipStatic && (!tipStatic->GetText() || tipStatic->GetText()[0] == 0)) return FALSE; PlaySound( AUI_SOUNDBASE_SOUND_TIP ); m_showingTip = g_ui->AddWindow( m_tip ) == AUI_ERRCODE_OK; RECT rect = { mouseData->position.x, m_y, 0, 0 }; ToWindow( &rect ); m_tip->Move( m_window->X() + rect.left - m_tip->Width() / 2, m_window->Y() + rect.top - m_tip->Height() ); if ( m_tip->X() < 0 ) m_tip->Move( 0, m_tip->Y() ); if ( m_tip->Y() < 0 ) m_tip->Move( m_tip->X(), 0 ); sint32 adjustX = m_tip->X() + m_tip->Width() - g_ui->Width(); sint32 adjustY = m_tip->Y() + m_tip->Height() - g_ui->Height(); if ( adjustX > 0 ) m_tip->Offset( -adjustX, 0 ); if ( adjustY > 0 ) m_tip->Offset( -adjustY, 0 ); return m_showingTip; } return FALSE; }
AUI_ERRCODE aui_Control::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if(m_numberOfLayers > 0) DrawLayers(surface, &rect); else DrawThisStateImage(0, surface, &rect); DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_Control::ToScreen( RECT *rect ) { ToWindow( rect ); OffsetRect( rect, m_window->X(), m_window->Y() ); return AUI_ERRCODE_OK; }
AUI_ERRCODE TextBox::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) m_pattern->Draw( surface, &rect ); primitives_BevelRect16( surface, &rect, 1, 1, 16, 16 ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_Button::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); DrawThisStateImage( IsDown() ? 1 : 0, surface, &rect ); DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE aui_Control::ToScreen( POINT *point ) { ToWindow( point ); point->x += m_window->X(); point->y += m_window->Y(); return AUI_ERRCODE_OK; }
AUI_ERRCODE c3_Radio::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) { if ( m_srcWidthPix || m_srcHeightPix ) { RECT srcRect = { m_srcX, m_srcY, m_srcX + m_srcWidthPix, m_srcY + m_srcHeightPix }; m_pattern->Draw( surface, &rect, &srcRect ); } else { m_pattern->Draw( surface, &rect ); } } DrawThisStateImage( m_state ? m_state : IsOn() ? 1 : 0, surface, &rect ); if (m_bevelWidth > 0) { if ( m_bevelType == 2 ) { if ( IsOn() ) { primitives_FrameThickRect16( surface, &rect, g_colorSet->GetColor( COLOR_UI_BOX ), m_bevelWidth ); } } else { if ( IsOn() ) { primitives_BevelRect16( surface, &rect, m_bevelWidth, (IsOn() ? 1 : 0), 16, 16 ); } } } DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE c3_ColoredStatic::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) m_pattern->Draw( surface, &rect ); DrawThisStateImage( 0, surface, &rect ); if (m_color != COLOR_MAX) { primitives_PaintRect16(surface, &rect, g_colorSet->GetColor(m_color)); } if (m_bevelWidth > 0) { primitives_BevelRect16( surface, &rect, m_bevelWidth, m_bevelType, 16, 16 ); } DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE RadioGroup::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) m_pattern->Draw( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE LineGraph::DrawThis(aui_Surface *surface, sint32 x, sint32 y ) { if ( !m_draw ) m_draw = k_AUI_REGION_DRAWFLAG_UPDATE; if (!(m_draw && k_AUI_REGION_DRAWFLAG_UPDATE)) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); UpdateGraph(surface, rect.left, rect.top); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE ctp2_HyperTextBox::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); rect.left -= k_CTP2_HYPERTEXTBOX_INSETWIDTH; rect.top -= k_CTP2_HYPERTEXTBOX_INSETWIDTH; rect.bottom += k_CTP2_HYPERTEXTBOX_INSETWIDTH; if ( m_pattern ) { if ( m_srcWidthPix || m_srcHeightPix ) { RECT srcRect = { m_srcX, m_srcY, m_srcX + m_srcWidthPix, m_srcY + m_srcHeightPix }; m_pattern->Draw( surface, &rect, &srcRect ); } else { m_pattern->Draw( surface, &rect ); } if(m_bevelWidth > 0) { primitives_BevelRect16( surface, &rect, m_bevelWidth, 1, 16, 16); } } DrawThisStateImage( 0, surface, &rect ); rect.left += k_CTP2_HYPERTEXTBOX_INSETWIDTH; rect.top += k_CTP2_HYPERTEXTBOX_INSETWIDTH; rect.bottom -= k_CTP2_HYPERTEXTBOX_INSETWIDTH; DrawThisHyperText( surface, &rect, 0, -m_ranger->GetValueY() ); rect.left -= k_CTP2_HYPERTEXTBOX_INSETWIDTH; rect.top -= k_CTP2_HYPERTEXTBOX_INSETWIDTH; rect.bottom += k_CTP2_HYPERTEXTBOX_INSETWIDTH; if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE TextSwitch::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) m_pattern->Draw( surface, &rect ); primitives_FrameRect16(surface, &rect, g_colorSet->GetColor(COLOR_BLACK)); if ( IsOn() ) primitives_BevelRect16( surface, &rect, 2, 1, 16, 16 ); else primitives_BevelRect16( surface, &rect, 2, 0, 16, 16 ); if ( IsActive() ) { if ( IsOn() ) { } else { } if (m_text) { textutils_CenteredDropString(surface, m_text, &rect, 9, COLOR_BUTTON_TEXT_HILITE, 0); } } else { if (m_text) { textutils_CenteredDropString(surface, m_text, &rect, 9, COLOR_BUTTON_TEXT_PLAIN, 0); } } if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE C3Slider::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); RECT dirtyRect = rect; if ( m_orientation == AUI_RANGER_ORIENTATION_VERTICAL ) InflateRect( &rect, -m_width / 2 + 8, 0 ); else InflateRect( &rect, 0, -m_height / 2 + 8 ); if ( m_pattern ) { if ( m_srcWidthPix || m_srcHeightPix ) { RECT srcRect = { m_srcX, m_srcY, m_srcX + m_srcWidthPix, m_srcY + m_srcHeightPix }; m_pattern->Draw( surface, &dirtyRect , &srcRect ); } else { m_pattern->Draw( surface, &dirtyRect ); } } if ( m_ticks && m_quantized ) { if ( m_orientation == AUI_RANGER_ORIENTATION_VERTICAL ) { sint32 spacing = m_height / ( m_maxY - m_minY ) - 1; RECT tickRect; for ( sint32 i = m_maxY - m_minY; i >= 0; i -= m_ticks ) { tickRect.top = i * spacing + dirtyRect.top + m_minThumbSize / 2; tickRect.left = dirtyRect.left + 6; tickRect.bottom = tickRect.top + 3; tickRect.right = tickRect.left + 6; primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 ); tickRect.left = dirtyRect.right - 12; tickRect.right = dirtyRect.right - 6; primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 ); } } else { sint32 spacing = m_width / ( m_maxX - m_minX ) - 1; RECT tickRect; for ( sint32 i = m_maxX - m_minX; i >= 0; i -= m_ticks ) { tickRect.left = i * spacing + dirtyRect.left + m_minThumbSize / 2; tickRect.top = dirtyRect.top + 6; tickRect.right = tickRect.left + 3; tickRect.bottom = tickRect.top + 6; primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 ); tickRect.top = dirtyRect.bottom - 12; tickRect.bottom = dirtyRect.bottom - 6; primitives_BevelRect16( surface, &tickRect, 1, 1, 16, 16 ); } } } RECT origRect = rect; primitives_BevelRect16( surface, &origRect, 2, 0, 16, 16 ); InflateRect( &rect, -4, -4 ); primitives_BevelRect16( surface, &rect, 1, 1, 16, 16 ); if ( IsActive() ) { primitives_BevelRect16( surface, &rect, 1, 1, 16, 16 ); } InflateRect( &rect, -1, -1 ); primitives_PaintRect16( surface, &rect, 0x0000 ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &dirtyRect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE c3_Icon::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); if ( m_pattern ) m_pattern->Draw( surface, &rect ); DrawThisStateImage( 0, surface, &rect ); if (m_mapIcon != MAPICON_MAX) { if (m_color != COLOR_MAX) { POINT where; TileSet *tileSet = g_tiledMap->GetTileSet(); POINT iconDim = tileSet->GetMapIconDimensions( m_mapIcon ); where.x = ( m_width - iconDim.x ) / 2; if (where.x < 0) where.x = 0; where.y = ( m_height - iconDim.y ) / 2; if (where.y < 0) where.y = 0; where.x += rect.left; where.y += rect.top; Pixel16 *icon; icon = tileSet->GetMapIconData( m_mapIcon ); Assert(icon); if (!icon) return AUI_ERRCODE_OK; g_tiledMap->DrawColorizedOverlay( icon, surface, where.x, where.y, g_colorSet->GetColor(m_color) ); } } if (m_bevelWidth > 0) { primitives_BevelRect16( surface, &rect, m_bevelWidth, m_bevelType, 16, 16 ); } DrawThisText( surface, &rect ); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }
AUI_ERRCODE TextRadio::DrawThis( aui_Surface *surface, sint32 x, sint32 y ) { if ( IsHidden() ) return AUI_ERRCODE_OK; if ( !surface ) surface = m_window->TheSurface(); RECT rect = { 0, 0, m_width, m_height }; OffsetRect( &rect, m_x + x, m_y + y ); ToWindow( &rect ); RECT buttonRect = { 0, m_height / 2 - 10, 0, 0 }; buttonRect.right = buttonRect.left + 20; buttonRect.bottom = buttonRect.top + 20; OffsetRect( &buttonRect, rect.left, rect.top ); if ( m_pattern ) m_pattern->Draw( surface, &buttonRect ); if ( IsOn() ) { primitives_BevelRect16( surface, &buttonRect, 1, 1, 16, 16 ); } else { primitives_BevelRect16( surface, &buttonRect, 2, 0, 16, 16 ); } if ( IsActive() ) { if ( IsOn() ) { primitives_BevelRect16( surface, &buttonRect, 1, 1, 16, 16 ); } else { primitives_BevelRect16( surface, &buttonRect, 2, 0, 16, 16 ); } } else { } if ( IsActive() ) SetTextColor(g_colorSet->GetColorRef(COLOR_BUTTON_TEXT_HILITE)); else SetTextColor(g_colorSet->GetColorRef(COLOR_BUTTON_TEXT_PLAIN)); DrawThisText(surface, &rect); if ( surface == m_window->TheSurface() ) m_window->AddDirtyRect( &rect ); return AUI_ERRCODE_OK; }