/* * Copyright (C) 2004-2005 Vadim Berezniker * http://www.kryptolus.com * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with GNU Make; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. * http://www.gnu.org/copyleft/gpl.html * */ #include "stdafx.h" #include "common.h" #include "sabbu.h" #include "gui_main_karaoke.h" kryEventKaraokeTextBox::kryEventKaraokeTextBox() : m_box(NULL), m_label(NULL), m_x(0), m_y(0), m_width(0), m_height(0) { } GtkWidget *kryEventKaraokeTextBox::GetBox() { return this->m_box; } void kryEventKaraokeTextBox::SetBox(GtkWidget *box) { this->m_box = box; } GtkLabel *kryEventKaraokeTextBox::GetLabel() { return this->m_label; } void kryEventKaraokeTextBox::SetLabel(GtkLabel *label) { this->m_label = label; } int kryEventKaraokeTextBox::GetX() { return this->m_x; } void kryEventKaraokeTextBox::SetX(int x) { this->m_x = x; } int kryEventKaraokeTextBox::GetY() { return this->m_y; } void kryEventKaraokeTextBox::SetY(int y) { this->m_y = y; } int kryEventKaraokeTextBox::GetWidth() { return this->m_width; } void kryEventKaraokeTextBox::SetWidth(int width) { this->m_width = width; } int kryEventKaraokeTextBox::GetHeight() { return this->m_height; } void kryEventKaraokeTextBox::SetHeight(int height) { this->m_height= height; } kryEventKaraokeTextBox *kryEventKaraokeTextBox::GetEventNext() { return (kryEventKaraokeTextBox *) this->m_event_next; } kryEventKaraokeTextBox *kryEventKaraokeTextBox::GetEventPrev() { return (kryEventKaraokeTextBox *) this->m_event_prev; } void kryEventKaraokeTextBox::CreateUI() { GtkEventBox *event_box = GTK_EVENT_BOX(gtk_event_box_new()); GtkFrame *frame = GTK_FRAME(gtk_frame_new(NULL)); GtkLabel *label= GTK_LABEL(gtk_label_new(NULL)); char *text = this->GetIsSilence() ? (char *) "[...]" : this->GetText(); char *caption = kry_strdup_printf(KRY_LOC "%s", text); gtk_label_set_markup(label, caption); kry_free(caption); gtk_container_add(GTK_CONTAINER(frame), GTK_WIDGET(label)); gtk_container_add(GTK_CONTAINER(event_box), GTK_WIDGET(frame)); gtk_misc_set_padding(GTK_MISC(label), 3, 3); gtk_container_set_border_width(GTK_CONTAINER(frame), 0); this->SetLabel(label); this->SetBox(GTK_WIDGET(event_box)); g_signal_connect(G_OBJECT(event_box), "button-release-event", G_CALLBACK(gui_main_karaoke_part_clicked_cb), this); }