// --------------------------------------------------------
// change the bitmap
// --------------------------------------------------------
void t_bitmap_layer_window::set_bitmap( t_bitmap_layer const* bitmap, t_screen_point point )
{
	if (bitmap == m_bitmap)
		return;

	t_screen_rect rect;
	bool          was_visible = is_visible();

	set_visible( false );
	m_bitmap = bitmap;
	if (bitmap == 0)
		rect = t_screen_rect( point.x, point.y, point.x, point.y );
	else
	{
		if (bitmap->get_alpha_depth() > 0)
			m_has_transparency = k_some_transparency;
		else
			m_has_transparency = k_no_transparency;
		rect = bitmap->get_rect() + point;
	}
	on_bitmap_changed();
	move( rect );
	set_visible( was_visible );
	get_parent()->update_size();
}
Beispiel #2
0
 /**
  * Mark this object as visible (ie not deleted) or deleted.
  *
  * @param visible Either "true" or "false"
  * @returns Reference to object to make calls chainable.
  */
 OSMObject& set_visible(const char* visible) {
     if (!strcmp("true", visible)) {
         set_visible(true);
     } else if (!strcmp("false", visible)) {
         set_visible(false);
     } else {
         throw std::invalid_argument("Unknown value for visible attribute (allowed is 'true' or 'false')");
     }
     return *this;
 }
Beispiel #3
0
static DWORD WINAPI ThreadFunc(LPVOID arg) {
    if(!setjmp(jump_buf))
        main_execute();
    else
        set_visible(1); /* could be unsafe to call it from another thread */
    return 0;
}
Beispiel #4
0
xui_method_explain(xui_timerect, on_mouserise,	void			)( xui_method_mouse& args )
{
	xui_control::on_mouserise(args);
	if (args.mouse == MB_L)
	{
		xui_timeview* timeview = xui_dynamic_cast(xui_timeview, m_parent);

		m_currrela    = args.point - timeview->get_timehead()->get_screenpt();
		m_currrela.x -= timeview->get_timehead()->get_borderrt().ax;
		s32 downframe = hit_frame(m_downrela.x);
		s32 currframe = hit_frame(m_currrela.x);

		if (downframe != currframe)
		{
			xui_method_args other_args;
			timeview->xm_selecteddrag(timeview, other_args);
			timeview->invalid();
			set_visible(false);
		}

		timeview->set_dragmode(TIMEDRAG_NONE);
		timeview->set_dragtime(-1);
		timeview->set_droptime(-1);
	}
}
Beispiel #5
0
void ToolTip::show(const Point &position)
{
	if (is_visible())
		return;
	set_geometry(Rect(position, get_size()));
	set_visible(true, false);
}
Beispiel #6
0
static void ThreadFunc(void *arg) {
    if(!setjmp(jump_buf))
        main_execute();
    else
        set_visible(1); /* could be unsafe to call it from another thread */
    _endthread();
}
Beispiel #7
0
void playlistWindow::initPlaylistStates
(
    void
)
{
    // button to open a playlist file
    openPlaylistFile->set_visible(true);
    openPlaylistFile->set_sensitive(true);
    openPlaylistFile->show();
    // button to save a playlist into a file
    savePlaylistFile->set_visible(true);
    savePlaylistFile->set_sensitive(false);
    savePlaylistFile->show();
    // button states to remove a file from the playlist
    removeFileFromPlaylist->set_visible(true);
    removeFileFromPlaylist->set_sensitive(false);
    removeFileFromPlaylist->show();
    // button states to add a file to the playlist
    addFileToPlaylist->set_visible(true);
    addFileToPlaylist->set_sensitive(true);
    addFileToPlaylist->show();
    // Initial states
    set_visible(false);
    // init popup menu
    initPlaylistMenuPopup();
    // To instanciate and initialize the player engine
    pls = new playlistEngine();
    pls->setRefButton(removeFileFromPlaylist);
    playlistScrolledWindow->add(*pls);
    // boolean
    isShuffle = false;
    isLoop = false;
}
Beispiel #8
0
void SubApplication::update(float dt)
{
    if (done)
        return;
    starting = false;
    Frame * old_frame = global_manager->frame;
    global_manager->frame = &subapp_frame;

    if (subapp_frame.next_frame != -1) {
        int next_frame = subapp_frame.next_frame;
        if (subapp_frame.index != -1)
            subapp_frame.on_end();
        global_manager->frame = old_frame;
        set_frame(next_frame);
        return;
    }

    bool ret = subapp_frame.update(dt);

    if (!ret)
        subapp_frame.on_end();

    global_manager->frame = old_frame;

    if (ret)
        return;
    done = true;
    set_visible(false);
}
Beispiel #9
0
bool SEObjectBase::create_entity(const char* _mesh_name, bool _visible/* = false*/)
{
	int i = 0;
	std::stringstream new_name;
	while(i < 100)
	{
		new_name.clear();
		new_name << _mesh_name << i++;
		if(is_mesh_exit(new_name.str().c_str()) == NULL)
			break;
	}

	object_name_ = new_name.str();
	std::string mesh_name = _mesh_name;
	mesh_name += ".mesh";
	m_scene_mgr->createEntity(object_name_, mesh_name);		//重名的会抛异常
	SceneNode* node = m_scene_mgr->getRootSceneNode()->createChildSceneNode(object_name_);
	//node->showBoundingBox(true);

	set_visible(_visible);

	cache_mesh_.push_back(object_name_);

	return true;
}
Beispiel #10
0
void CBuyBulletLayer::ShowWidnow(bool bShow)
{
    bool bVisible = visible();
    if (bVisible == bShow)
        return ;

    set_visible(bShow);
    m_btnCancle->set_visible(bShow);
    m_btnMax->set_visible(bShow);
    m_btnOk->set_visible(bShow);
    m_btnMinus->set_visible(bShow);
    m_btnAdd->set_visible(bShow);
    m_sldNumber->set_visible(bShow);

    if (bShow)
    {
        try
        {
            Sound_Instance *pSound = Root::instance()->sound_manager()->sound_instance(16);
            pSound->play(false, true);
        }
        catch(...)
        {
        }
  
    }
}
Beispiel #11
0
LLSFRefBoxShellMachine::LLSFRefBoxShellMachine(std::string name, std::string type,
					       int begin_y, int begin_x, bool visible)
  : NCursesPanel(1, 22, begin_y, begin_x),
    visible_(visible), name_(name), type_(type), puck_under_rfid_(false),
    has_correctly_reported_field_(false), correctly_reported_(false)
{
  set_visible(visible_);
}
Beispiel #12
0
void RadialMenu::on_mouse_lbutton_up(CL_InputEvent &input_event)
{
	if (!func_selected.is_null())
		func_selected.invoke(selected_index);

	set_visible(false);	
	capture_mouse(false);
}
Beispiel #13
0
static int win_main(HINSTANCE hInstance, HINSTANCE hPrevInstance,
        LPSTR lpszCmdLine, int nCmdShow) {
    WNDCLASSEX wc;
    MSG msg;
    char *classname=options.win32_name;
    DWORD iID;
    RECT rect;

    /* register the class */
    wc.cbSize=sizeof(WNDCLASSEX);
    wc.style=CS_VREDRAW|CS_HREDRAW;
    wc.lpfnWndProc=wndProc;
    wc.cbClsExtra=wc.cbWndExtra=0;
    wc.hInstance=hInstance;
    wc.hIcon=LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MYICON));
    wc.hCursor=LoadCursor(NULL, IDC_ARROW);
    wc.hbrBackground=(HBRUSH)(COLOR_WINDOW + 1);
    wc.lpszMenuName=NULL;
    wc.lpszClassName=classname;
    small_icon=LoadImage(hInstance, MAKEINTRESOURCE(IDI_MYICON), IMAGE_ICON,
        GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0);
    wc.hIconSm=small_icon; /* 16x16 icon */
    RegisterClassEx(&wc);

    /* create main window */
    if(options.option.taskbar) {/* save menu resources */
        htraymenu=LoadMenu(ghInst, MAKEINTRESOURCE(IDM_TRAYMENU));
        hpopup=GetSubMenu(htraymenu, 0);
    }
    hmainmenu=LoadMenu(ghInst, MAKEINTRESOURCE(IDM_MAINMENU));
    hwnd=CreateWindow(classname, options.win32_name, WS_TILEDWINDOW,
        CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
        NULL, hmainmenu, hInstance, NULL);

    /* create child edit window */
    EditControl=CreateWindow ("EDIT", NULL,
        WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|ES_MULTILINE|ES_READONLY,
        0, 0, 0, 0, hwnd, NULL, hInstance, NULL);
    SendMessage(EditControl, WM_SETFONT, (WPARAM)GetStockObject(OEM_FIXED_FONT),
        MAKELPARAM(FALSE, 0)); /* no need to redraw right, now */
    GetClientRect(hwnd, &rect);
    MoveWindow(EditControl, 0, 0, rect.right, rect.bottom, TRUE);
    SetFocus(EditControl);

    if(error_mode) /* log window is hidden by default */
        set_visible(1);
    else /* create the main thread */
        CloseHandle(CreateThread(NULL, 0, ThreadFunc, NULL, 0, &iID));

    while (GetMessage(&msg, NULL, 0, 0)) {
        TranslateMessage(&msg);
        DispatchMessage(&msg);
    }

    return msg.wParam;
}
Beispiel #14
0
DockedFrame::DockedFrame(GUIComponent *parent, DockableComponent *dockable)
    : GUIComponent(parent, "docked-frame"), dockable(dockable)
{
    func_resized().set(this, &DockedFrame::on_resized);
    func_render().set(this, &DockedFrame::on_render);
    dockable->set_parent_component(this);
    dockable->set_visible(true, false);
    set_visible(false, false);
    on_resized();
    request_repaint();
}
Beispiel #15
0
void CAccountLayer::ShowWidnow(bool bShow)
{                          
    set_visible(bShow);    
    m_btnAccountAndExit->set_visible(bShow);
    m_btnAccount->set_visible(bShow);
    m_btnClose->set_visible(bShow);

    if (bShow == true)
    {
        m_dwStartTime = (DWORD)time(NULL);
    }
}     
Beispiel #16
0
// -------------------------------------------------------------------
// window to display a skill icon
// -------------------------------------------------------------------
void t_spell_icon_window::set_spell( t_spell spell )
{
	if (spell == m_spell)
		return;
	m_spell = spell;
	set_visible( spell != k_spell_none );
	if (spell != k_spell_none )
	{
		set_bitmap( get_spell_icon( spell, m_height ));
		set_help_balloon_text( get_spell_name( spell ));
	}
}
// ---------------------------------------------------------------------
// run the campaign dialog
// ---------------------------------------------------------------------
bool t_campaign_selection_dialog::do_campaign_dialog( int campaign_id )
{
	int selection;
	for ( selection = 0; true; ++selection )
	{
		assert( selection < k_campaign_count );
		if ( campaign_id == k_campaign_ids[ selection ] )
			break;
	}

//	if( m_enabled[selection] )
	{
		m_campaign_id = t_standard_campaign_id( campaign_id );

		// Load this game file.
		// This MUST work, so no error checking
		m_file_header_ptr = create_multi_scenario_campaign_file_header( m_campaign_id, 0 );
		assert( m_file_header_ptr.get() != 0 );

		// campaign info dialog
		t_counted_ptr<t_multi_scenario_dialog> campaign_dialog;
		campaign_dialog = new t_multi_scenario_dialog( t_window::get_main_window(), m_file_header_ptr, 0 );
		set_visible( false );
		if( campaign_dialog->run_modal() )
		{
			m_difficulty = campaign_dialog->get_difficulty();
			m_guards_can_move = campaign_dialog->guards_can_move();
			m_return_value = true;
			close();

			return true;
		}
	}

	set_visible( true );

	return false;
}
Beispiel #18
0
PopupMenuWindow::PopupMenuWindow(const PopupMenu &menu, const Point &screen_position, GUIComponent *owner)
: GUIComponent(owner, create_toplevel_description(), CssStr::PopupMenuWindow::type_name),
  menu(menu), selected(-1)
{
	set_class(menu.get_class(), true);

	create_parts();

	Rect rect_pos(screen_position, calc_desired_size());
	set_window_geometry(rect_pos);
	set_visible(true, false);

	func_close().set(this, &PopupMenuWindow::on_close);
}
static void
gtk_source_gutter_renderer_set_property (GObject      *object,
                                         guint         prop_id,
                                         const GValue *value,
                                         GParamSpec   *pspec)
{
	GtkSourceGutterRenderer *self = GTK_SOURCE_GUTTER_RENDERER (object);

	switch (prop_id)
	{
		case PROP_VISIBLE:
			set_visible (self, g_value_get_boolean (value));
			break;
		case PROP_XPAD:
			set_xpad (self, g_value_get_int (value));
			break;
		case PROP_YPAD:
			set_ypad (self, g_value_get_int (value));
			break;
		case PROP_XALIGN:
			set_xalign (self, g_value_get_float (value), TRUE);
			break;
		case PROP_YALIGN:
			set_yalign (self, g_value_get_float (value), TRUE);
			break;
		case PROP_ALIGNMENT_MODE:
			set_alignment_mode (self, g_value_get_enum (value));
			break;
		case PROP_VIEW:
			self->priv->view = g_value_get_object (value);
			break;
		case PROP_WINDOW_TYPE:
			self->priv->window_type = g_value_get_enum (value);
			break;
		case PROP_SIZE:
			set_size (self, g_value_get_int (value));
			break;
		case PROP_BACKGROUND_RGBA:
			set_background_color (self,
			                      g_value_get_boxed (value));
			break;
		case PROP_BACKGROUND_SET:
			set_background_color_set (self,
			                          g_value_get_boolean (value));
			break;
		default:
			G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
			break;
	}
}
Beispiel #20
0
 /**
  * Set named attribute.
  *
  * @param attr Name of the attribute (must be one of "id", "version", "changeset", "timestamp", "uid", "visible")
  * @param value Value of the attribute
  */
 void set_attribute(const char* attr, const char* value) {
     if (!strcmp(attr, "id")) {
         set_id(value);
     } else if (!strcmp(attr, "version")) {
         set_version(value);
     } else if (!strcmp(attr, "changeset")) {
         set_changeset(value);
     } else if (!strcmp(attr, "timestamp")) {
         set_timestamp(osmium::Timestamp(value));
     } else if (!strcmp(attr, "uid")) {
         set_uid(value);
     } else if (!strcmp(attr, "visible")) {
         set_visible(value);
     }
 }
Beispiel #21
0
RadialMenu::RadialMenu(CL_GUIComponent *parent)
: CL_GUIComponent(parent)
{
	set_type_name("radialmenu");

	func_render().set(this, &RadialMenu::on_render);
	func_style_changed().set(this, &RadialMenu::on_style_changed);
	func_resized().set(this, &RadialMenu::on_resized);
	func_process_message().set(this, &RadialMenu::on_process_message);

	create_parts();
	
	clear_items();

	set_visible(false);
}
void GameViewBattle::attacked_area(int map_area_from_id, int map_area_to_id)
{
	attack_results.clear();
	defense_results.clear();
	current_dice_index = 0;

	GameModel *game_model = client->get_game_model();

	MapArea *area_from = game_model->get_map()->get_area_by_id(map_area_from_id);
	MapArea *area_to = game_model->get_map()->get_area_by_id(map_area_to_id);
	player_from = game_model->get_players()->get_player(area_from->player_id);
	player_to = game_model->get_players()->get_player(area_to->player_id);

	set_visible(true);

	timer_hide.start(500, true);
}
Beispiel #23
0
xui_method_explain(xui_timerect, set_range,		void			)( s32 startlayer, s32 finallayer, s32 startframe, s32 finalframe )
{
	m_startlayer = startlayer;
	m_finallayer = finallayer;
	m_startframe = startframe;
	m_finalframe = finalframe;

	xui_timeview* timeview = xui_dynamic_cast(xui_timeview, m_parent);
	xui_timehead* timehead = timeview->get_timehead();
	xui_rect2d<s32> rt;
	rt.ax = timehead->get_renderx() + timehead->get_borderrt().ax + startframe*timeview->get_keyspace();
	rt.bx = timehead->get_renderx() + timehead->get_borderrt().ax + finalframe*timeview->get_keyspace();
	rt.ay = timehead->get_rendery() + timehead->get_renderh()     + startlayer*timeview->get_timetree()->get_lineheight();
	rt.by = timehead->get_rendery() + timehead->get_renderh()     + finallayer*timeview->get_timetree()->get_lineheight() + timeview->get_timetree()->get_lineheight();
	on_perform_pt(rt.get_pt());
	on_perform_sz(rt.get_sz());
	set_visible  (rt.was_valid());
}
Beispiel #24
0
 sphere_collider::sphere_collider(sqt* _parent_transform, const glm::vec3 & _offset, float _radius)
 {
     type = SPHERE;
     radius = _radius;
     visible = false;
     draw_sphere = NULL;
     transform = new sqt(_parent_transform);
     transform->translateXYZ(_offset);
     #if DRAW_COLLISION_SOLIDS == 1
     set_visible(true);
     #endif
     #if USE_OPENCL == 1
     collider_id = global_accelerator->num_of_colliders;
     global_accelerator->increase_collider_size_to(global_accelerator->num_of_colliders+1);
     global_accelerator->colliders.push_back(this);
     push_to_cl();
     #endif
 }
GameViewBattle::GameViewBattle(GameView *view, Client *client)
: CL_GUIComponent(view), view(view), client(client)
{
	set_type_name("battle");
	set_geometry(CL_Rect(view->get_width() - 400, 0, view->get_width(), 300));
	set_visible(false);

	func_render().set(this, &GameViewBattle::on_render);
	func_process_message().set(this, &GameViewBattle::on_message);

	timer_hide.func_expired().set(this, &GameViewBattle::on_timer_hide_expired);

	CL_Texture texture_dice(get_gc(), "Resources/dices.png", CL_VirtualDirectory());
	CL_SpriteDescription dice_description;
	dice_description.add_gridclipped_frames(texture_dice, 0, 0, 42, 45, 6, 1);
	sprite_dices = CL_Sprite(get_gc(), dice_description);

	font_large = CL_Font(get_gc(), "Accidental Presidency", -40);
	font_small = CL_Font(get_gc(), "Accidental Presidency", -30);
}
Beispiel #26
0
GameViewEnd::GameViewEnd(GameView *view)
: GUIComponent(view, "game-over")
{
	set_visible(false);
	set_geometry(Rect(view->get_width() / 2 - 200, view->get_height() / 2 - 150, view->get_width() / 2 + 200, view->get_height() / 2 + 150));

	label_title = new Label(this);
	label_title->set_tag_name("title");
	label_title->set_geometry(Rect(10, 10, 100, 30));

	label_message = new Label(this);
	label_message->set_tag_name("title");
	label_message->set_geometry(Rect(10, 40, 100, 70));
	
	button_close = new PushButton(this);
	button_close->set_tag_name("close");
	button_close->set_text("Close");
	button_close->set_geometry(Rect(10, 80, 100, 110));
	button_close->func_clicked().set(this, &GameViewEnd::on_button_close_clicked);
}
int CL_GUIComponent::exec()
{
	CL_GUIComponent *owner_component = get_owner_component();
	if (owner_component)
		owner_component->get_top_level_component()->set_enabled(false);
	get_gui_manager().exec();
	if (owner_component)
	{
		// To do: Move this special modal dialog code to the window manager.
		// Important: Do not remove any of these calls even though they seem pointless, redundant or even wrong.
		// They workaround various bugs in the focus handling in Windows itself.
#ifdef WIN32
		set_visible(false, false);
#endif
		owner_component->get_top_level_component()->set_enabled(true);
#ifdef WIN32
		SetActiveWindow(owner_component->get_top_level_component()->get_display_window().get_hwnd());
#endif
	}
	return get_gui_manager().get_exit_code();
}
void
setup_window (JNIEnv *env, jobject obj, GtkWidget *window, jint width, 
	      jint height, jboolean visible)
{
  GtkWidget *layout, *vbox;

  gtk_window_set_policy (GTK_WINDOW (window), 1, 1, 0);
  gtk_widget_set_usize (window, width, height);

  vbox = gtk_vbox_new (0, 0);
  layout = gtk_layout_new (NULL, NULL);
  gtk_box_pack_end (GTK_BOX (vbox), layout, 1, 1, 0);
  gtk_container_add (GTK_CONTAINER (window), vbox);
  gtk_widget_realize (layout);
  connect_awt_hook (env, obj, 1, GTK_LAYOUT(layout)->bin_window);
  gtk_widget_show (layout);
  gtk_widget_show (vbox);

  gtk_widget_realize (window);
/*    setBounds (window, x, y, width, height); */

  connect_awt_hook (env, obj, 1, window->window);
  set_visible (window, visible);
}
void GameViewBattle::close()
{
	timer_hide.stop();
	set_visible(false);
	view->battle_over();
}
Beispiel #30
0
static LRESULT CALLBACK wndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) {
    POINT pt;
    NOTIFYICONDATA nid;
    RECT rect;
    char *txt;

#if 0
    if(message!=WM_CTLCOLORSTATIC && message!=WM_TIMER)
        log(LOG_DEBUG, "Window message: %d", message);
#endif
    switch (message) {
    case WM_CREATE:
        if (options.option.taskbar) /* taskbar update enabled? */
            SetTimer(hwnd, 0x29a, 1000, NULL); /* 1-second timer */
        return TRUE;

    case WM_SIZE:
        GetClientRect(hwnd, &rect);
        MoveWindow(EditControl, 0, 0, rect.right, rect.bottom, TRUE);
        UpdateWindow(EditControl);
        return TRUE;

    case WM_SETFOCUS:
        txt=log_txt();
        SetWindowText(EditControl, txt);
        free(txt);
        SetFocus(EditControl);
        return TRUE;

    case WM_TIMER:
        update_taskbar();
        return TRUE;

    case WM_CLOSE:
        set_visible(0);
        return TRUE;

    case WM_DESTROY:
        DestroyMenu(hmainmenu);
        DestroyMenu(htraymenu);
        ZeroMemory(&nid, sizeof(nid));
        nid.cbSize=sizeof(NOTIFYICONDATA);
        nid.hWnd=hwnd;
        nid.uID=1;
        nid.uFlags=NIF_TIP; /* not really sure what to put here, but it works */
        Shell_NotifyIcon(NIM_DELETE, &nid); /* this removes the icon */
        PostQuitMessage(0);
        KillTimer(hwnd, 0x29a);
        return TRUE;

    case WM_COMMAND:
        switch(wParam) {
        case IDM_ABOUT:
            DialogBox(ghInst, "AboutBox", hwnd, (DLGPROC)about_proc);
            break;
        case IDM_LOG:
            set_visible(!visible);
            break;
        case IDM_CLOSE:
            set_visible(0);
            break;
        case IDM_EXIT:
            DestroyWindow(hwnd);
            break;
        case IDM_SAVEAS:
            save_file(hwnd);
            break;
        case IDM_SETUP:
            MessageBox(hwnd, "Function not implemented",
                options.win32_name, MB_ICONERROR);
            break;
        };
        return TRUE;

    case UWM_SYSTRAY:
        switch (lParam) {
        case WM_RBUTTONUP: /* track a popup menu */
            /* http://support.microsoft.com/support/kb/articles/Q135/7/88.asp */
            GetCursorPos(&pt);
            SetForegroundWindow(hwnd);
            TrackPopupMenu(hpopup, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hwnd, NULL);
            PostMessage(hwnd, WM_NULL, 0, 0); /* see above */
            break;
        case WM_LBUTTONDBLCLK: /* switch log window visibility */
            set_visible(!visible);
            break;
        }
        return TRUE;
    }
    return DefWindowProc(hwnd, message, wParam, lParam);
}