Commits

Herbert Breunung committed b8ce224

polish splitter class

  • Participants
  • Parent commits 353ea6d

Comments (0)

Files changed (1)

File lib/Kephra/App/Splitter.pm

 	$self->SetSplitMode( &Wx::wxSPLIT_VERTICAL )
 		if exists $parameter->{'left'}
 		or exists $parameter->{'orientation'} and $parameter->{'orientation'} eq 'vertical';
+
+
 	$self->{'dominant_child'} = exists $parameter->{'dominant_child'} 
 		? $parameter->{'dominant_child'} : 1;
+	$self->{'dominant_child'} = 1
+		if $self->{'dominant_child'} eq 'left' or $self->{'dominant_child'} eq 'top';
+	$self->{'dominant_child'} = 2
+		if $self->{'dominant_child'} eq 'right' or $self->{'dominant_child'} eq 'bottom';
 
 	$self->{'position'} = exists $parameter->{'position'} ? $parameter->{'position'} : 0;
 
-
 	return $self->unsplit()
 		if not exists $self->{'child1'} or not $self->{'child1'}
 		or not exists $self->{'child2'} or not $self->{'child2'}
 sub unsplit {
 	my $self = shift;
 	$self->Unsplit if $self->IsSplit;
-	return Kephra::Log::error("can't initialize with not existing second child")
-		if $self->{'dominant_child'} == 2 and not $self->{'child2'};
+	return Kephra::Log::error("can't initialize with a not existing child widget")
+		if $self->{'dominant_child'} == 1 and not $self->{'child1'}
+		or $self->{'dominant_child'} == 2 and not $self->{'child2'};
 	$self->Initialize( $self->{'child2'} ) if $self->{'dominant_child'} == 2;
+	$self->UpdateSize;
+	Kephra::App::Focus::stay();
 }
 
 sub toggle_split {