559
private void category_move_focus (int delta_column, int delta_row) {
560
var new_focus = category_view.app_view.get_child_at (category_column_focus + delta_column, category_row_focus + delta_row);
561
if (new_focus == null) {
562
if (delta_row < 0 && category_view.category_switcher.selected != 0) {
563
category_view.category_switcher.selected--;
567
else if (delta_row > 0 && category_view.category_switcher.selected != category_view.category_switcher.cat_size - 1) {
568
category_view.category_switcher.selected++;
572
else if (delta_column > 0 && (category_column_focus + delta_column) % category_view.app_view.get_page_columns () == 0
573
&& category_view.switcher.active + 1 != category_view.app_view.get_n_pages ()) {
574
category_view.switcher.set_active (category_view.switcher.active + 1);
578
else if (category_column_focus == 0 && delta_column < 0) {
579
searchbar.grab_focus ();
580
category_column_focus = 0;
581
category_row_focus = 0;
587
category_column_focus += delta_column;
588
category_row_focus += delta_row;
589
if (delta_column > 0 && category_column_focus % category_view.app_view.get_page_columns () == 0 ) { // check if we need to change page
590
category_view.switcher.set_active (category_view.switcher.active + 1);
592
else if (delta_column < 0 && (category_column_focus + 1) % category_view.app_view.get_page_columns () == 0) {
593
// check if we need to change page
594
category_view.switcher.set_active (category_view.switcher.active - 1);
596
new_focus.grab_focus ();
599
// this method moves focus to the first AppEntry in the top left corner of the current page. Works in CategoryView only
600
private void top_left_focus () {
601
// this is the first column of the current page
602
int first_column = category_view.switcher.active * category_view.app_view.get_page_columns ();
603
category_view.app_view.get_child_at (first_column, 0).grab_focus ();
604
category_column_focus = first_column;
605
category_row_focus = 0;
608
559
public override bool scroll_event (EventScroll event) {
839
private void category_move_focus (int delta_column, int delta_row) {
840
var new_focus = category_view.app_view.get_child_at (category_column_focus + delta_column, category_row_focus + delta_row);
841
if (new_focus == null) {
842
if (delta_row < 0 && category_view.category_switcher.selected != 0) {
843
category_view.category_switcher.selected--;
847
else if (delta_row > 0 && category_view.category_switcher.selected != category_view.category_switcher.cat_size - 1) {
848
category_view.category_switcher.selected++;
852
else if (delta_column > 0 && (category_column_focus + delta_column) % category_view.app_view.get_page_columns () == 0
853
&& category_view.switcher.active + 1 != category_view.app_view.get_n_pages ()) {
854
category_view.switcher.set_active (category_view.switcher.active + 1);
858
else if (category_column_focus == 0 && delta_column < 0) {
859
searchbar.grab_focus ();
860
category_column_focus = 0;
861
category_row_focus = 0;
867
category_column_focus += delta_column;
868
category_row_focus += delta_row;
869
if (delta_column > 0 && category_column_focus % category_view.app_view.get_page_columns () == 0 ) { // check if we need to change page
870
category_view.switcher.set_active (category_view.switcher.active + 1);
872
else if (delta_column < 0 && (category_column_focus + 1) % category_view.app_view.get_page_columns () == 0) {
873
// check if we need to change page
874
category_view.switcher.set_active (category_view.switcher.active - 1);
876
new_focus.grab_focus ();
879
// this method moves focus to the first AppEntry in the top left corner of the current page. Works in CategoryView only
880
private void top_left_focus () {
881
// this is the first column of the current page
882
int first_column = category_view.switcher.active * category_view.app_view.get_page_columns ();
883
category_view.app_view.get_child_at (first_column, 0).grab_focus ();
884
category_column_focus = first_column;
885
category_row_focus = 0;
888
888
public void reset_category_focus () {
889
889
category_column_focus = 0;
890
890
category_row_focus = 0;